|
@@ -7,8 +7,8 @@
|
7
|
7
|
FROM
|
8
|
8
|
ta_device_job t
|
9
|
9
|
INNER JOIN ta_machinery s ON t.machinery_id = s.machinery_id
|
10
|
|
- INNER JOIN ta_org m ON s.org_id = m.org_id
|
11
|
|
- LEFT JOIN sys_user n ON t.user_id = n.user_id
|
|
10
|
+-- INNER JOIN ta_org m ON s.org_id = m.org_id
|
|
11
|
+-- LEFT JOIN sys_user n ON t.user_id = n.user_id
|
12
|
12
|
WHERE
|
13
|
13
|
1 = 1
|
14
|
14
|
<if test="deviceKind != null and deviceKind != ''">
|
|
@@ -18,10 +18,10 @@
|
18
|
18
|
AND t.device_no = #{deviceNo}
|
19
|
19
|
</if>
|
20
|
20
|
<if test="orgId != null and orgId != ''">
|
21
|
|
- AND m.org_id = #{orgId}
|
|
21
|
+ AND t.org_id = #{orgId}
|
22
|
22
|
</if>
|
23
|
23
|
<if test="orgName != null and orgName != ''">
|
24
|
|
- AND m.`name` LIKE CONCAT( '%', #{orgName}, '%' )
|
|
24
|
+ AND t.org_name LIKE CONCAT( '%', #{orgName}, '%' )
|
25
|
25
|
</if>
|
26
|
26
|
<if test="machineryId != null and machineryId != ''">
|
27
|
27
|
AND s.machinery_id = #{machineryId}
|
|
@@ -33,25 +33,21 @@
|
33
|
33
|
AND s.`name` LIKE CONCAT( '%', #{machineryName}, '%' )
|
34
|
34
|
</if>
|
35
|
35
|
<if test="userName != null and userName != ''">
|
36
|
|
- AND n.user_name LIKE CONCAT( '%', #{userName}, '%' )
|
|
36
|
+ AND t.user_name LIKE CONCAT( '%', #{userName}, '%' )
|
37
|
37
|
</if>
|
38
|
38
|
<if test="phone != null and phone != ''">
|
39
|
|
- AND n.phone LIKE CONCAT( '%', #{phone}, '%' )
|
|
39
|
+ AND t.phone LIKE CONCAT( '%', #{phone}, '%' )
|
40
|
40
|
</if>
|
41
|
41
|
<if test="startDate != null and startDate != ''">
|
42
|
42
|
AND t.job_date BETWEEN #{startDate} AND #{endDate}
|
43
|
43
|
</if>
|
44
|
44
|
AND s.`status` > -1
|
45
|
45
|
ORDER BY
|
46
|
|
- t.job_date DESC
|
|
46
|
+ t.job_date DESC, t.job_time DESC
|
47
|
47
|
</sql>
|
48
|
48
|
|
49
|
49
|
<select id="statisOrgBy" resultType="com.yunzhi.nanyang.entity.TaDeviceJob">
|
50
|
50
|
SELECT
|
51
|
|
- m.`name` AS org_name,
|
52
|
|
- n.user_id,
|
53
|
|
- n.user_name,
|
54
|
|
- n.phone,
|
55
|
51
|
s.`name` AS machinery_name,
|
56
|
52
|
t.*
|
57
|
53
|
<include refid="statisOrg"></include>
|
|
@@ -62,10 +58,6 @@
|
62
|
58
|
</select>
|
63
|
59
|
<select id="listOrgBy" resultType="com.yunzhi.nanyang.entity.TaDeviceJob">
|
64
|
60
|
SELECT
|
65
|
|
- m.`name` AS org_name,
|
66
|
|
- n.user_id,
|
67
|
|
- n.user_name,
|
68
|
|
- n.phone,
|
69
|
61
|
s.`name` AS machinery_name,
|
70
|
62
|
t.*
|
71
|
63
|
<include refid="statisOrg"></include>
|