feiyu02
2024-04-25 0392c333ed3d987cb2ab3dac4e1a972cff405f21
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
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
<?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="cn.flightfeather.supervision.domain.ds1.mapper.SubtaskMapper" >
  <resultMap id="BaseResultMap" type="cn.flightfeather.supervision.domain.ds1.entity.Subtask" >
    <!--
      WARNING - @mbg.generated
    -->
    <id column="ST_GUID" property="stguid" jdbcType="VARCHAR" />
    <result column="T_GUID" property="tguid" jdbcType="VARCHAR" />
    <result column="TS_GUID" property="tsguid" jdbcType="VARCHAR" />
    <result column="ST_name" property="name" jdbcType="VARCHAR" />
    <result column="ST_Priority" property="priority" jdbcType="BIT" />
    <result column="ST_TypeNo" property="typeno" jdbcType="TINYINT" />
    <result column="ST_Type" property="type" jdbcType="VARCHAR" />
    <result column="ST_ProvinceCode" property="provincecode" jdbcType="VARCHAR" />
    <result column="ST_ProvinceName" property="provincename" jdbcType="VARCHAR" />
    <result column="ST_CityCode" property="citycode" jdbcType="VARCHAR" />
    <result column="ST_CityName" property="cityname" jdbcType="VARCHAR" />
    <result column="ST_DistrictCode" property="districtcode" jdbcType="VARCHAR" />
    <result column="ST_DistrictName" property="districtname" jdbcType="VARCHAR" />
    <result column="ST_TownCode" property="towncode" jdbcType="VARCHAR" />
    <result column="ST_TownName" property="townname" jdbcType="VARCHAR" />
    <result column="ST_ScenseName" property="scensename" jdbcType="VARCHAR" />
    <result column="ST_ScenseID" property="scenseid" jdbcType="VARCHAR" />
    <result column="ST_ScenseAddress" property="scenseaddress" jdbcType="VARCHAR" />
    <result column="ST_DeadLineType" property="deadlinetype" jdbcType="VARCHAR" />
    <result column="ST_PlanStartTime" property="planstarttime" jdbcType="TIMESTAMP" />
    <result column="ST_PlanEndTime" property="planendtime" jdbcType="TIMESTAMP" />
    <result column="ST_DeployerGUID" property="deployerguid" jdbcType="VARCHAR" />
    <result column="ST_DeployerUserName" property="deployerusername" jdbcType="VARCHAR" />
    <result column="ST_DeployerRealName" property="deployerrealname" jdbcType="VARCHAR" />
    <result column="ST_DeployTime" property="deploytime" jdbcType="TIMESTAMP" />
    <result column="ST_ExecutionStartTime" property="executionstarttime" jdbcType="TIMESTAMP" />
    <result column="ST_ExecutionEndTime" property="executionendtime" jdbcType="TIMESTAMP" />
    <result column="ST_ExecutorGUIDs" property="executorguids" jdbcType="VARCHAR" />
    <result column="ST_ExecutorUserNames" property="executorusernames" jdbcType="VARCHAR" />
    <result column="ST_ExecutorRealTimes" property="executorrealtimes" jdbcType="VARCHAR" />
    <result column="ST_Status" property="status" jdbcType="VARCHAR" />
    <result column="ST_NotifedCount" property="notifedcount" jdbcType="INTEGER" />
    <result column="ST_RuleList" property="rulelist" jdbcType="VARCHAR" />
    <result column="ST_AssessorGUID" property="stAssessorguid" jdbcType="VARCHAR" />
    <result column="ST_AssessorUserName" property="assessorusername" jdbcType="VARCHAR" />
    <result column="ST_AssessorRealName" property="assessorrealname" jdbcType="VARCHAR" />
    <result column="ST_AssessTime" property="assesstime" jdbcType="TIMESTAMP" />
    <result column="ST_AssessResult" property="assessresult" jdbcType="VARCHAR" />
    <result column="ST_ThirdAssessorGUID" property="thirdassessorguid" jdbcType="VARCHAR" />
    <result column="ST_ThirdAssessorUserName" property="thirdassessorusername" jdbcType="VARCHAR" />
    <result column="ST_ThirdAssessorRealName" property="thirdassessorrealname" jdbcType="VARCHAR" />
    <result column="ST_ThirdAssessTime" property="thirdassesstime" jdbcType="TIMESTAMP" />
    <result column="ST_ThirdAssessResult" property="thirdassessresult" jdbcType="VARCHAR" />
    <result column="ST_Extension1" property="extension1" jdbcType="VARCHAR" />
    <result column="ST_Extension2" property="extension2" jdbcType="VARCHAR" />
    <result column="ST_Extension3" property="extension3" jdbcType="VARCHAR" />
    <result column="ST_Remark" property="remark" jdbcType="VARCHAR" />
  </resultMap>
  
  <resultMap id="SubtaskSearchResultVo" type="cn.flightfeather.supervision.lightshare.vo.SubtaskSearchResultVo">
    <result column="subTaskId" property="subTaskId" jdbcType="VARCHAR" />
    <result column="districtName" property="districtName" jdbcType="VARCHAR" />
    <result column="townName" property="townName" jdbcType="VARCHAR" />
    <result column="sceneId" property="sceneId" jdbcType="VARCHAR" />
    <result column="sceneName" property="sceneName" jdbcType="VARCHAR" />
    <result column="sceneTypeId" property="sceneTypeId" jdbcType="TINYINT" />
    <result column="sceneType" property="sceneType" jdbcType="VARCHAR" />
    <result column="sceneAddress" property="sceneAddress" jdbcType="VARCHAR" />
    <result column="planStartTime" property="planStartTime" jdbcType="TIMESTAMP" />
    <result column="planEndTime" property="planEndTime" jdbcType="TIMESTAMP" />
    <result column="status" property="status" jdbcType="VARCHAR" />
    <result column="path" property="path" jdbcType="VARCHAR" />
  </resultMap>
 
  <resultMap id="SubTaskSearchResultVo2" type="cn.flightfeather.supervision.lightshare.vo.SubTaskSearchResultVo2">
    <result column="subTaskId" property="subTaskId" jdbcType="VARCHAR" />
    <result column="districtName" property="districtName" jdbcType="VARCHAR" />
    <result column="townName" property="townName" jdbcType="VARCHAR" />
    <result column="sceneId" property="sceneId" jdbcType="VARCHAR" />
    <result column="sceneName" property="sceneName" jdbcType="VARCHAR" />
    <result column="sceneTypeId" property="sceneTypeId" jdbcType="TINYINT" />
    <result column="sceneType" property="sceneType" jdbcType="VARCHAR" />
    <result column="sceneAddress" property="sceneAddress" jdbcType="VARCHAR" />
    <result column="planStartTime" property="planStartTime" jdbcType="TIMESTAMP" />
    <result column="planEndTime" property="planEndTime" jdbcType="TIMESTAMP" />
    <result column="status" property="status" jdbcType="VARCHAR" />
    <result column="path" property="path" jdbcType="VARCHAR" />
 
    <result column="problemId" property="problemId" jdbcType="VARCHAR" />
    <result column="problemName" property="problemName" jdbcType="VARCHAR" />
      <result column="problemCode" property="problemCode" jdbcType="VARCHAR" />
    <result column="longitude" property="longitude" jdbcType="DECIMAL" />
    <result column="latitude" property="latitude" jdbcType="DECIMAL" />
    <result column="location" property="location" jdbcType="VARCHAR" />
    <result column="rectification" property="rectification" jdbcType="BIT" />
    <result column="rectificationTime" property="rectificationTime" jdbcType="TIMESTAMP" />
    <result column="updateTime" property="updateTime" jdbcType="TIMESTAMP" />
 
    <result column="mGuid" property="mGuid" jdbcType="VARCHAR" />
    <result column="mExtension1" property="mExtension1" jdbcType="VARCHAR" />
    <result column="isChanged" property="isChanged" jdbcType="BIT" />
  </resultMap>
 
    <resultMap id="SubtaskVoMap" type="cn.flightfeather.supervision.lightshare.vo.SubtaskVo" >
        <id column="ST_GUID" property="stguid" jdbcType="VARCHAR" />
        <result column="T_GUID" property="tguid" jdbcType="VARCHAR" />
        <result column="TS_GUID" property="tsguid" jdbcType="VARCHAR" />
        <result column="ST_name" property="name" jdbcType="VARCHAR" />
        <result column="ST_Priority" property="priority" jdbcType="BIT" />
        <result column="ST_TypeNo" property="typeno" jdbcType="TINYINT" />
        <result column="ST_Type" property="type" jdbcType="VARCHAR" />
        <result column="ST_ProvinceCode" property="provincecode" jdbcType="VARCHAR" />
        <result column="ST_ProvinceName" property="provincename" jdbcType="VARCHAR" />
        <result column="ST_CityCode" property="citycode" jdbcType="VARCHAR" />
        <result column="ST_CityName" property="cityname" jdbcType="VARCHAR" />
        <result column="ST_DistrictCode" property="districtcode" jdbcType="VARCHAR" />
        <result column="ST_DistrictName" property="districtname" jdbcType="VARCHAR" />
        <result column="ST_TownCode" property="towncode" jdbcType="VARCHAR" />
        <result column="ST_TownName" property="townname" jdbcType="VARCHAR" />
        <result column="ST_ScenseName" property="scensename" jdbcType="VARCHAR" />
        <result column="S_TypeID" property="scenseTypeId" jdbcType="VARCHAR" />
        <result column="ST_ScenseID" property="scenseid" jdbcType="VARCHAR" />
        <result column="ST_ScenseAddress" property="scenseaddress" jdbcType="VARCHAR" />
        <result column="ST_DeadLineType" property="deadlinetype" jdbcType="VARCHAR" />
        <result column="ST_PlanStartTime" property="planstarttime" jdbcType="TIMESTAMP" />
        <result column="ST_PlanEndTime" property="planendtime" jdbcType="TIMESTAMP" />
        <result column="ST_DeployerGUID" property="deployerguid" jdbcType="VARCHAR" />
        <result column="ST_DeployerUserName" property="deployerusername" jdbcType="VARCHAR" />
        <result column="ST_DeployerRealName" property="deployerrealname" jdbcType="VARCHAR" />
        <result column="ST_DeployTime" property="deploytime" jdbcType="TIMESTAMP" />
        <result column="ST_ExecutionStartTime" property="executionstarttime" jdbcType="TIMESTAMP" />
        <result column="ST_ExecutionEndTime" property="executionendtime" jdbcType="TIMESTAMP" />
        <result column="ST_ExecutorGUIDs" property="executorguids" jdbcType="VARCHAR" />
        <result column="ST_ExecutorUserNames" property="executorusernames" jdbcType="VARCHAR" />
        <result column="ST_ExecutorRealTimes" property="executorrealtimes" jdbcType="VARCHAR" />
        <result column="ST_Status" property="status" jdbcType="VARCHAR" />
        <result column="ST_NotifedCount" property="notifedcount" jdbcType="INTEGER" />
        <result column="ST_RuleList" property="rulelist" jdbcType="VARCHAR" />
        <result column="ST_AssessorGUID" property="stAssessorguid" jdbcType="VARCHAR" />
        <result column="ST_AssessorUserName" property="assessorusername" jdbcType="VARCHAR" />
        <result column="ST_AssessorRealName" property="assessorrealname" jdbcType="VARCHAR" />
        <result column="ST_AssessTime" property="assesstime" jdbcType="TIMESTAMP" />
        <result column="ST_AssessResult" property="assessresult" jdbcType="VARCHAR" />
        <result column="ST_ThirdAssessorGUID" property="thirdassessorguid" jdbcType="VARCHAR" />
        <result column="ST_ThirdAssessorUserName" property="thirdassessorusername" jdbcType="VARCHAR" />
        <result column="ST_ThirdAssessorRealName" property="thirdassessorrealname" jdbcType="VARCHAR" />
        <result column="ST_ThirdAssessTime" property="thirdassesstime" jdbcType="TIMESTAMP" />
        <result column="ST_ThirdAssessResult" property="thirdassessresult" jdbcType="VARCHAR" />
        <result column="ST_Extension1" property="extension1" jdbcType="VARCHAR" />
        <result column="ST_Extension2" property="extension2" jdbcType="VARCHAR" />
        <result column="ST_Extension3" property="extension3" jdbcType="VARCHAR" />
        <result column="ST_Remark" property="remark" jdbcType="VARCHAR" />
    </resultMap>
 
    <resultMap id="SubTaskSummary" type="cn.flightfeather.supervision.lightshare.vo.SubTaskSummary" >
        <result column="ST_GUID" property="stGuid" jdbcType="VARCHAR" />
        <result column="ST_name" property="stName" jdbcType="VARCHAR" />
        <result column="ST_PlanStartTime" property="stPlanTime" jdbcType="TIMESTAMP" />
        <result column="ST_Status" property="stStatus" jdbcType="VARCHAR" />
        <result column="S_GUID" property="sceneId" jdbcType="VARCHAR" />
        <result column="S_Name" property="sceneName" jdbcType="VARCHAR" />
        <result column="S_Type" property="sceneType" jdbcType="VARCHAR" />
        <result column="I_GUID" property="insGuid" jdbcType="VARCHAR" />
        <result column="proNum" property="proNum" jdbcType="INTEGER" />
        <result column="changeNum" property="changeNum" jdbcType="INTEGER" />
        <result column="proCheckedNum" property="proCheckedNum" jdbcType="INTEGER" />
        <result column="changeCheckedNum" property="changeCheckedNum" jdbcType="INTEGER" />
    </resultMap>
  <sql id="Base_Column_List" >
    <!--
      WARNING - @mbg.generated
    -->
    ST_GUID, T_GUID, TS_GUID, ST_name, ST_Priority, ST_TypeNo, ST_Type, ST_ProvinceCode, 
    ST_ProvinceName, ST_CityCode, ST_CityName, ST_DistrictCode, ST_DistrictName, ST_TownCode, 
    ST_TownName, ST_ScenseName, ST_ScenseID, ST_ScenseAddress, ST_DeadLineType, ST_PlanStartTime, 
    ST_PlanEndTime, ST_DeployerGUID, ST_DeployerUserName, ST_DeployerRealName, ST_DeployTime, 
    ST_ExecutionStartTime, ST_ExecutionEndTime, ST_ExecutorGUIDs, ST_ExecutorUserNames, 
    ST_ExecutorRealTimes, ST_Status, ST_NotifedCount, ST_RuleList, ST_AssessorGUID, ST_AssessorUserName, 
    ST_AssessorRealName, ST_AssessTime, ST_AssessResult, ST_ThirdAssessorGUID, ST_ThirdAssessorUserName, 
    ST_ThirdAssessorRealName, ST_ThirdAssessTime, ST_ThirdAssessResult, ST_Extension1, 
    ST_Extension2, ST_Extension3, ST_Remark
  </sql>
 
  <select id="getSubtask" resultMap="SubtaskSearchResultVo">
      SELECT
        a.ST_GUID as 'subTaskId',
        a.ST_DistrictName as 'districtName',
        b.S_TownName as 'townName',
        a.ST_ScenseID as 'sceneId',
        a.ST_ScenseName as 'sceneName',
        b.S_TypeID as 'sceneTypeId',
        b.S_Type as 'sceneType',
        a.ST_ScenseAddress as 'sceneAddress',
        a.ST_PlanStartTime as 'planStartTime',
        a.ST_PlanEndTime as 'planEndTime',
        a.ST_Status as 'status',
        c.I_Extension1 as 'path'
      FROM
        tm_t_subtask AS a
        LEFT JOIN sm_t_scense AS b ON a.ST_ScenseID = b.S_GUID
        LEFT JOIN im_t_inspection AS c ON a.ST_GUID = c.ST_GUID
        LEFT JOIN ea_t_evaluation AS d ON a.ST_GUID = d.ST_GUID
      WHERE
        a.ST_DistrictCode = #{param1}
        AND a.ST_PlanStartTime >= #{param2}
        AND a.ST_PlanEndTime  &lt;= #{param3}
      <if test="param4 != null">
        AND b.S_TypeID = #{param4}
      </if>
  </select>
    <select id="getSubtask2" resultMap="SubTaskSearchResultVo2">
        SELECT
        a.ST_GUID as 'subTaskId',
        a.ST_DistrictName as 'districtName',
        b.S_TownName as 'townName',
        a.ST_ScenseID as 'sceneId',
        a.ST_ScenseName as 'sceneName',
        b.S_TypeID as 'sceneTypeId',
        b.S_Type as 'sceneType',
        a.ST_ScenseAddress as 'sceneAddress',
        a.ST_PlanStartTime as 'planStartTime',
        a.ST_PlanEndTime as 'planEndTime',
        a.ST_Status as 'status',
        c.I_Extension1 as 'path',
        d.PL_GUID as 'problemId',
        d.PL_ProblemName as 'problemName',
        f.PT_Extension1 as 'problemCode',
        d.PL_Longitude as 'longitude',
        d.PL_Latitude as 'latitude',
        d.PL_Location as 'location',
        d.PL_IsChanged as 'rectification',
        d.PL_ChangedTime as 'rectificationTime',
        (CASE WHEN d.PL_IsChanged IS FALSE THEN d.PL_Time
          WHEN d.PL_ChangedTime IS  NULL THEN d.PL_Time
          ELSE d.PL_ChangedTime END ) as 'updateTime',
        e.MF_GUID as 'mGuid',
        e.MF_Extension1 as 'mExtension1',
        e.MF_IsChanged as 'isChanged'
        FROM
        im_t_problemlist AS d
        LEFT JOIN tm_t_subtask AS a ON a.ST_GUID = d.ST_GUID
        LEFT JOIN sm_t_scense AS b ON b.S_GUID = a.ST_ScenseID
        LEFT JOIN im_t_inspection AS c ON a.ST_GUID = c.ST_GUID
        LEFT JOIN sm_t_problemtype AS f ON d.PT_GUID = f.PT_GUID
        RIGHT JOIN im_t_mediafile AS e ON d.PL_GUID = e.MF_BusinessGUID
        WHERE
        a.ST_DistrictCode = #{param3}
        <if test="param1 != null">
            AND ((d.PL_ChangedTime is not null and d.PL_ChangedTime > #{param1}) OR d.PL_Time > #{param2})
        </if>
        <if test="param4 != null">
            AND b.S_TypeID = #{param4}
        </if>
        <if test="param5 != null">
            AND a.ST_PlanStartTime >= #{param5}
        </if>
        <if test="param6 != null">
            AND a.ST_PlanEndTime &lt;= #{param6}
        </if>
        AND d.PL_Extension3 != 'unCheck' AND d.PL_Extension3 != 'fail' AND d.PL_Extension3 != 'change_fail'
        AND d.PL_Extension3 IS NOT NULL
        ORDER BY updateTime
    </select>
 
    <select id="selectByTopTask" resultMap="SubtaskVoMap"><![CDATA[
        select * from tm_t_subtask as a left join sm_t_scense as b on a.ST_ScenseID = b.S_GUID
        where a.ST_PlanStartTime >=#{param2} and a.ST_PlanEndTime <= #{param3} and a.T_GUID = #{param1}]]>
        <if test="param4 != null">
            and b.S_TypeID = #{param4}
        </if>
    </select>
 
    <select id="selectByTopTask2" resultMap="BaseResultMap">
        select * from tm_t_subtask as a left join sm_t_scense as b on a.ST_ScenseID = b.S_GUID
        where a.T_GUID = #{param1}
        <if test="param2 != null">
            and b.S_TypeID = #{param2}
        </if>
    </select>
 
    <select id="getSummary" resultMap="SubTaskSummary">
        SELECT
        a.ST_GUID,
        a.ST_name,
        a.ST_PlanStartTime,
        a.ST_Status,
        b.S_GUID,
        b.S_Name,
        b.S_Type,
        c.I_GUID,
        SUM(d.PL_GUID is NOT null) AS proNum,
        SUM(d.PL_IsChanged = TRUE) AS changeNum,
        SUM(d.PL_Extension3 != 'unCheck') AS proCheckedNum,
        SUM(
        d.PL_Extension3 = 'change_pass' || d.PL_Extension3 = 'change_fail'
        ) AS changeCheckedNum
 
        FROM
        tm_t_subtask AS a
        LEFT JOIN sm_t_scense AS b ON a.ST_ScenseID = b.S_GUID
        LEFT JOIN im_t_inspection AS c ON a.ST_GUID = c.ST_GUID
        LEFT JOIN im_t_problemlist AS d ON a.ST_GUID = d.ST_GUID
        WHERE
        a.T_GUID = #{param1}
        <if test="param2 != null">
            and b.S_TypeID = #{param2}
        </if>
        GROUP BY
        a.ST_GUID
    </select>
 
    <select id="getSummaryByScene" resultMap="SubTaskSummary">
        SELECT
        a.ST_GUID,
        a.ST_name,
        a.ST_PlanStartTime,
        a.ST_Status,
        b.S_GUID,
        b.S_Name,
        b.S_Type,
        c.I_GUID,
        SUM(d.PL_GUID is NOT null) AS proNum,
        SUM(d.PL_IsChanged = TRUE) AS changeNum,
        SUM(d.PL_Extension3 != 'unCheck') AS proCheckedNum,
        SUM(
        d.PL_Extension3 = 'change_pass' || d.PL_Extension3 = 'change_fail'
        ) AS changeCheckedNum
 
        FROM
        tm_t_subtask AS a
        LEFT JOIN sm_t_scense AS b ON a.ST_ScenseID = b.S_GUID
        LEFT JOIN im_t_inspection AS c ON a.ST_GUID = c.ST_GUID
        LEFT JOIN im_t_problemlist AS d ON a.ST_GUID = d.ST_GUID
        WHERE
        a.ST_ScenseID = #{sceneId}
        <if test="startTime != null">
            and a.ST_PlanStartTime BETWEEN #{startTime} AND #{endTime}
        </if>
        GROUP BY
        a.ST_GUID
        ORDER BY a.ST_PlanStartTime DESC
    </select>
 
    <select id="findSubTasksByProType" resultMap="BaseResultMap">
        SELECT
        a.*
        FROM
        tm_t_subtask AS a
        LEFT JOIN im_t_problemlist AS b ON a.ST_GUID = b.ST_GUID
        LEFT JOIN sm_t_problemtype AS c ON b.PT_GUID = c.PT_GUID
        LEFT JOIN sm_t_scense AS d ON a.ST_ScenseID = d.S_GUID
        WHERE
        a.T_GUID = #{topTaskId}
        AND c.PT_TypeName = #{proType}
        AND d.S_TypeID = #{sceneTypeId}
        GROUP BY a.ST_GUID
    </select>
</mapper>