OrderWorkSMapper.xml
12.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zteits.order.mapper.smapper.OrderWorkSMapper">
<resultMap id="BaseResultMap" type="com.zteits.order.domain.OrderWork">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="work_id" jdbcType="VARCHAR" property="workId" />
<result column="work_big_type" jdbcType="INTEGER" property="workBigType" />
<result column="work_type" jdbcType="INTEGER" property="workType" />
<result column="pl_province_id" jdbcType="BIGINT" property="plProvinceId" />
<result column="pl_province_name" jdbcType="VARCHAR" property="plProvinceName" />
<result column="pl_city_id" jdbcType="BIGINT" property="plCityId" />
<result column="pl_city_name" jdbcType="VARCHAR" property="plCityName" />
<result column="pl_country_id" jdbcType="BIGINT" property="plCountryId" />
<result column="pl_country_name" jdbcType="VARCHAR" property="plCountryName" />
<result column="pl_area_block_id" jdbcType="BIGINT" property="plAreaBlockId" />
<result column="pl_area_block_name" jdbcType="VARCHAR" property="plAreaBlockName" />
<result column="pl_no" jdbcType="VARCHAR" property="plNo" />
<result column="pl_name" jdbcType="VARCHAR" property="plName" />
<result column="park_area_codes" jdbcType="VARCHAR" property="parkAreaCodes" />
<result column="park_area_names" jdbcType="VARCHAR" property="parkAreaNames" />
<result column="input_time" jdbcType="TIMESTAMP" property="inputTime" />
<result column="solving_duration" jdbcType="BIGINT" property="solvingDuration" />
<result column="solve_state" jdbcType="INTEGER" property="solveState" />
<result column="solve_id" jdbcType="VARCHAR" property="solveId" />
<result column="solve_name" jdbcType="VARCHAR" property="solveName" />
<result column="solve_phone" jdbcType="VARCHAR" property="solvePhone" />
<result column="reason" jdbcType="VARCHAR" property="reason" />
<result column="img_path" jdbcType="OTHER" property="imgPath" />
<result column="data_sources" jdbcType="VARCHAR" property="dataSources" />
<result column="complaint_name" jdbcType="VARCHAR" property="complaintName" />
<result column="complaint_phone" jdbcType="VARCHAR" property="complaintPhone" />
<result column="work_title" jdbcType="VARCHAR" property="workTitle" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="data_state" jdbcType="INTEGER" property="dataState" />
<result column="create_emp_id" jdbcType="VARCHAR" property="createEmpId" />
<result column="create_emp_name" jdbcType="VARCHAR" property="createEmpName" />
<result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
<result column="modfiy_emp_id" jdbcType="VARCHAR" property="modfiyEmpId" />
<result column="modfiy_emp_name" jdbcType="VARCHAR" property="modfiyEmpName" />
<result column="modfiy_date" jdbcType="TIMESTAMP" property="modfiyDate" />
<result column="org_id" jdbcType="BIGINT" property="orgId" />
<result column="accept_date" jdbcType="TIMESTAMP" property="acceptDate" />
</resultMap>
<sql id="Base_Column_List">
id, work_id, work_big_type, work_type, pl_province_id, pl_province_name, pl_city_id,
pl_city_name, pl_country_id, pl_country_name, pl_area_block_id, pl_area_block_name,
pl_no, pl_name, park_area_codes, park_area_names, input_time, solving_duration, solve_state,
solve_id, solve_name, solve_phone, reason,img_path, data_sources, complaint_name, complaint_phone, work_title,
remark, data_state, create_emp_id, create_emp_name, create_date, modfiy_emp_id, modfiy_emp_name,
modfiy_date, org_id, accept_date
</sql>
<select id="queryOrderWorkForPage" parameterType="com.zteits.clouds.api.dto.order.workorder.param.OrderWorkForPageQueryRequest"
resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List" />
from order_work
WHERE data_state=1
<if test="plAreaBlockIds != null and plAreaBlockIds.size >0 ">
AND pl_area_block_id IN
<foreach collection="plAreaBlockIds" item="plAreaBlockId" index="index" open="(" close=")" separator=",">
#{plAreaBlockId}
</foreach>
</if>
<if test="plNos != null and plNos.size >0 ">
AND pl_no IN
<foreach collection="plNos" item="plNo" index="index" open="(" close=")" separator=",">
/*停车场编号*/
#{plNo}
</foreach>
</if>
<if test="workBigTypes != null and workBigTypes.size >0 ">
AND work_big_type IN
<foreach collection="workBigTypes" item="workBigType" index="index" open="(" close=")" separator=",">
#{workBigType}
</foreach>
</if>
<if test="workTypes != null and workTypes.size >0 ">
AND work_type IN
<foreach collection="workTypes" item="workType" index="index" open="(" close=")" separator=",">
#{workType}
</foreach>
</if>
<if test="remark !=null and remark !=''">
AND (work_id like CONCAT('%',#{remark},'%') or remark like CONCAT('%',#{remark},'%'))
</if>
<if test="beginTime !=null">
AND input_time >= #{beginTime}
</if>
<if test="endTime !=null">
AND input_time <= #{endTime}
</if>
<if test="complaintName !=null and complaintName !=''">
AND complaint_name like CONCAT('%',#{complaintName},'%')
</if>
<if test="createEmpId !=null">
AND create_emp_id =#{createEmpId}
</if>
<if test="solveId !=null">
AND solve_id =#{solveId}
</if>
<if test="solveStates != null and solveStates.size >0 ">
AND solve_state IN
<foreach collection="solveStates" item="solveState" index="index" open="(" close=")" separator=",">
#{solveState}
</foreach>
</if>
ORDER BY input_time DESC
</select>
<select id="queryOrderWorkForPageForHistoty" parameterType="com.zteits.clouds.api.dto.order.workorder.param.OrderWorkForPageQueryRequest"
resultType="com.zteits.order.domain.OrderWork">
SELECT
a.id as id,
a.work_id as workId,
a.work_big_type as workBigType,
a.work_type as workType,
a.pl_province_id as plProvince,
a.pl_province_name as plProvinceName,
a.pl_city_id as plCityId,
a.pl_city_name as plCityName,
a.pl_country_id as plCountryId,
a.pl_country_name as plCountryName,
a.pl_area_block_id as plAreaBlockId,
a.pl_area_block_name as plAreaBlockName,
a.pl_no as plNo,
a.pl_name as plName,
a.input_time as inputTime,
a.solving_duration as solvingDuration,
a.solve_state as solveState,
a.solve_id as solveId,
a.solve_name as solveName,
a.solve_phone as solvePhone,
a.complaint_name as complaintName,
a.complaint_phone as complaintPhone,
a.remark as remark,
a.data_state as dataState,
a.create_emp_id as createEmpId,
a.create_emp_name as createEmpName ,
a.create_date as createDate,
a.modfiy_emp_id as modfiyEmpId,
a.modfiy_emp_name as modfiyEmpName,
a.modfiy_date as modfiyDate,
a.org_id as orgId
from order_work a,
order_work_track b
where a.data_state=1
and a.work_id=b.rlt_work_id
<if test="plAreaBlockIds != null and plAreaBlockIds.size >0 ">
AND a.pl_area_block_id IN
<foreach collection="plAreaBlockIds" item="plAreaBlockId" index="index" open="(" close=")" separator=",">
#{plAreaBlockId}
</foreach>
</if>
<if test="plNos != null and plNos.size >0 ">
AND a.pl_no IN
<foreach collection="plNos" item="plNo" index="index" open="(" close=")" separator=",">
/*停车场编号*/
#{plNo}
</foreach>
</if>
<if test="workBigTypes != null and workBigTypes.size >0 ">
AND a.work_big_type IN
<foreach collection="workBigTypes" item="workBigType" index="index" open="(" close=")" separator=",">
#{workBigType}
</foreach>
</if>
<if test="workTypes != null and workTypes.size >0 ">
AND a.work_type IN
<foreach collection="workTypes" item="workType" index="index" open="(" close=")" separator=",">
#{workType}
</foreach>
</if>
<if test="remark !=null and remark !=''">
AND (a.work_id like CONCAT('%',#{remark},'%') or a.remark like CONCAT('%',#{remark},'%'))
</if>
<if test="beginTime !=null">
AND a.input_time >= #{beginTime}
</if>
<if test="endTime !=null">
AND a.input_time <= #{endTime}
</if>
<if test="complaintName !=null and complaintName !=''">
AND a.complaint_name like CONCAT('%',#{complaintName},'%')
</if>
<if test="createEmpId !=null">
AND a.solve_state =3 and b.solve_id=#{createEmpId} and b.solve_id != b.next_id
</if>
<if test="solveStates != null and solveStates.size >0 ">
AND a.solve_state IN
<foreach collection="solveStates" item="solveState" index="index" open="(" close=")" separator=",">
#{solveState}
</foreach>
</if>
group by id
ORDER BY a.input_time DESC
</select>
<!-- 工单统计 -->
<select id="queryOrderWorkStatistic" parameterType="com.zteits.clouds.api.dto.order.workorder.param.OrderWorkForPageQueryRequest"
resultType="com.zteits.clouds.api.dto.order.workorder.dto.OrderWorkStatisticNumDTO">
SELECT
count(case when solve_state = 1 then id end ) as unTreatedNum,
count(case when solve_state = 2 then id end ) as processingNum,
count(case when solve_state = 3 then id end ) as completeNum,
count(case when solve_state = 4 then id end ) as unReceivedNum,
count(case when solve_state = 5 then id end ) as unSendNum,
count(id) as totalNum
from order_work
WHERE data_state=1
<if test="plAreaBlockIds != null and plAreaBlockIds.size >0 ">
AND pl_area_block_id IN
<foreach collection="plAreaBlockIds" item="plAreaBlockId" index="index" open="(" close=")" separator=",">
#{plAreaBlockId}
</foreach>
</if>
<if test="plNos != null and plNos.size >0 ">
AND pl_no IN
<foreach collection="plNos" item="plNo" index="index" open="(" close=")" separator=",">
/*停车场编号*/
#{plNo}
</foreach>
</if>
<if test="workBigTypes != null and workBigTypes.size >0 ">
AND work_big_type IN
<foreach collection="workBigTypes" item="workBigType" index="index" open="(" close=")" separator=",">
#{workBigType}
</foreach>
</if>
<if test="workTypes != null and workTypes.size >0 ">
AND work_type IN
<foreach collection="workTypes" item="workType" index="index" open="(" close=")" separator=",">
#{workType}
</foreach>
</if>
<if test="remark !=null and remark !=''">
AND (work_id like CONCAT('%',#{remark},'%') or remark like CONCAT('%',#{remark},'%'))
</if>
<if test="beginTime !=null">
AND input_time >= #{beginTime}
</if>
<if test="endTime !=null">
AND input_time <= #{endTime}
</if>
<if test="complaintName !=null and complaintName !=''">
AND complaint_name like CONCAT('%',#{complaintName},'%')
</if>
<if test="createEmpId !=null">
AND create_emp_id =#{createEmpId}
</if>
<if test="solveId !=null">
AND solve_id =#{solveId}
</if>
<if test="solveStates != null and solveStates.size >0 ">
AND solve_state IN
<foreach collection="solveStates" item="solveState" index="index" open="(" close=")" separator=",">
#{solveState}
</foreach>
</if>
ORDER BY input_time DESC
</select>
</mapper>