liusheng
5 天以前 0c621621889c90a119e2ff9e41c4f5528f395f7e
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
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
<?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.smartor.mapper.ServiceSubtaskDetailMapper">
 
    <resultMap type="com.smartor.domain.ServiceSubtaskDetail" id="ServiceSubtaskDetailResult">
        <result property="id" column="id"/>
        <result property="subId" column="sub_id"/>
        <result property="targetid" column="targetid"/>
        <result property="taskid" column="taskid"/>
        <result property="uuid" column="uuid"/>
        <result property="phone" column="phone"/>
        <result property="operate" column="operate"/>
        <result property="displayno" column="displayno"/>
        <result property="inbound" column="inbound"/>
        <result property="incoming" column="incoming"/>
        <result property="assigntime" column="assigntime"/>
        <result property="starttime" column="starttime"/>
        <result property="answertime" column="answertime"/>
        <result property="silent" column="silent"/>
        <result property="dtmfKey" column="dtmf_key"/>
        <result property="musicpath" column="musicpath"/>
        <result property="sentIndex" column="sent_index"/>
        <result property="sentBegin" column="sent_begin"/>
        <result property="asrtext" column="asrtext"/>
        <result property="beginTime" column="begin_time"/>
        <result property="endTime" column="end_time"/>
        <result property="sentEnd" column="sent_end"/>
        <result property="recordpath" column="recordpath"/>
        <result property="recordurl" column="recordurl"/>
        <result property="templateid" column="templateid"/>
        <result property="templatequestionnum" column="templatequestionnum"/>
        <result property="switchid" column="switchid"/>
        <result property="questiontext" column="questiontext"/>
        <result property="questionvoice" column="questionvoice"/>
        <result property="categoryname" column="categoryname"/>
        <result property="targetoptions" column="targetoptions"/>
        <result property="targetvalue" column="targetvalue"/>
        <result property="matchedtext" column="matchedtext"/>
        <result property="addtime" column="addtime"/>
        <result property="isupload" column="isupload"/>
        <result property="uploadTime" column="upload_time"/>
        <result property="orgid" column="orgid"/>
        <result property="createTime" column="create_time"/>
        <result property="delFlag" column="del_flag"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
        <result property="createBy" column="create_by"/>
        <result property="valueType" column="value_type"/>
        <result property="scriptid" column="scriptid"/>
        <result property="answerps" column="answerps"/>
        <result property="comment" column="comment"/>
        <result property="patid" column="patid"/>
        <result property="guid" column="guid"/>
        <result property="extemplateText" column="extemplate_text"/>
    </resultMap>
    <resultMap type="com.smartor.domain.ServiceSubtaskDetailTarget" id="ServiceSubtaskDetailTargetResult">
        <result property="targetid" column="targetid"/>
        <result property="taskid" column="taskid"/>
        <result property="targetname" column="targetname"/>
        <result property="matchedtext" column="matchedtext"/>
        <result property="count" column="count"/>
    </resultMap>
    <sql id="selectServiceSubtaskDetailVo">
        select id,
               sub_id,
               targetid,
               answerps,
               scriptid,
               extemplate_text,
               comment,
               patid,
               taskid,
               uuid,
               guid,
               phone,
               operate,
               displayno,
               inbound,
               incoming,
               assigntime,
               starttime,
               answertime,
               silent,
               dtmf_key,
               musicpath,
               sent_index,
               sent_begin,
               asrtext,
               begin_time,
               end_time,
               sent_end,
               recordpath,
               recordurl,
               templateid,
               templatequestionnum,
               switchid,
               questiontext,
               questionvoice,
               categoryname,
               targetoptions,
               targetvalue,
               matchedtext,
               addtime,
               isupload,
               upload_time,
               orgid,
               create_time,
               del_flag,
               update_by,
               update_time,
               value_type,
               create_by
        from service_subtask_detail
    </sql>
 
    <select id="selectServiceSubtaskDetailList" parameterType="com.smartor.domain.ServiceSubtaskDetail"
            resultMap="ServiceSubtaskDetailResult">
        <include refid="selectServiceSubtaskDetailVo"/>
        <where>
            <if test="subId != null">and sub_id = #{subId}</if>
            <if test="targetid != null">and targetid = #{targetid}</if>
            <if test="extemplateText != null">and extemplate_text = #{extemplateText}</if>
            <if test="taskid != null">and taskid = #{taskid}</if>
            <if test="uuid != null  and uuid != ''">and uuid = #{uuid}</if>
            <if test="phone != null  and phone != ''">and phone = #{phone}</if>
            <if test="operate != null  and operate != ''">and operate = #{operate}</if>
            <if test="displayno != null  and displayno != ''">and displayno = #{displayno}</if>
            <if test="inbound != null ">and inbound = #{inbound}</if>
            <if test="incoming != null ">and incoming = #{incoming}</if>
            <if test="assigntime != null ">and assigntime = #{assigntime}</if>
            <if test="starttime != null ">and starttime = #{starttime}</if>
            <if test="answertime != null ">and answertime = #{answertime}</if>
            <if test="silent != null ">and silent = #{silent}</if>
            <if test="dtmfKey != null  and dtmfKey != ''">and dtmf_key = #{dtmfKey}</if>
            <if test="musicpath != null  and musicpath != ''">and musicpath = #{musicpath}</if>
            <if test="sentIndex != null ">and sent_index = #{sentIndex}</if>
            <if test="sentBegin != null ">and sent_begin = #{sentBegin}</if>
            <if test="asrtext != null  and asrtext != ''">and asrtext = #{asrtext}</if>
            <if test="beginTime != null ">and begin_time = #{beginTime}</if>
            <if test="endTime != null ">and end_time = #{endTime}</if>
            <if test="sentEnd != null ">and sent_end = #{sentEnd}</if>
            <if test="recordpath != null  and recordpath != ''">and recordpath = #{recordpath}</if>
            <if test="recordurl != null  and recordurl != ''">and recordurl = #{recordurl}</if>
            <if test="templateid != null  and templateid != ''">and templateid = #{templateid}</if>
            <if test="templatequestionnum != null ">and templatequestionnum = #{templatequestionnum}</if>
            <if test="switchid != null ">and switchid = #{switchid}</if>
            <if test="questiontext != null  and questiontext != ''">and questiontext = #{questiontext}</if>
            <if test="questionvoice != null  and questionvoice != ''">and questionvoice = #{questionvoice}</if>
            <if test="categoryname != null  and categoryname != ''">and categoryname like concat('%', #{categoryname},
                '%')
            </if>
            <if test="targetoptions != null  and targetoptions != ''">and targetoptions = #{targetoptions}</if>
            <if test="targetvalue != null  and targetvalue != ''">and targetvalue = #{targetvalue}</if>
            <if test="matchedtext != null  and matchedtext != ''">and matchedtext = #{matchedtext}</if>
            <if test="addtime != null ">and addtime = #{addtime}</if>
            <if test="isupload != null ">and isupload = #{isupload}</if>
            <if test="uploadTime != null ">and upload_time = #{uploadTime}</if>
            <if test="orgid != null  and orgid != ''">and orgid = #{orgid}</if>
            <if test="valueType != null  and valueType != ''">and value_type = #{valueType}</if>
            <if test="answerps != null  and answerps != ''">and answerps = #{answerps}</if>
            <if test="comment != null  and comment != ''">and comment = #{comment}</if>
            <if test="scriptid != null ">and scriptid = #{scriptid}</if>
            <if test=" patid != null">and patid = #{patid}</if>
        </where>
    </select>
 
    <select id="selectServiceSubtaskDetailByCalldetailid" parameterType="String" resultMap="ServiceSubtaskDetailResult">
        <include refid="selectServiceSubtaskDetailVo"/>
        where id = #{id}
    </select>
 
    <insert id="insertServiceSubtaskDetail" parameterType="com.smartor.domain.ServiceSubtaskDetail">
        insert into service_subtask_detail
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="subId != null">sub_id,</if>
            <if test="targetid != null">targetid,</if>
            <if test="taskid != null">taskid,</if>
            <if test="uuid != null">uuid,</if>
            <if test="phone != null">phone,</if>
            <if test="operate != null">operate,</if>
            <if test="displayno != null">displayno,</if>
            <if test="inbound != null">inbound,</if>
            <if test="incoming != null">incoming,</if>
            <if test="assigntime != null">assigntime,</if>
            <if test="starttime != null">starttime,</if>
            <if test="answertime != null">answertime,</if>
            <if test="silent != null">silent,</if>
            <if test="dtmfKey != null">dtmf_key,</if>
            <if test="musicpath != null">musicpath,</if>
            <if test="sentIndex != null">sent_index,</if>
            <if test="sentBegin != null">sent_begin,</if>
            <if test="asrtext != null">asrtext,</if>
            <if test="beginTime != null">begin_time,</if>
            <if test="endTime != null">end_time,</if>
            <if test="sentEnd != null">sent_end,</if>
            <if test="recordpath != null">recordpath,</if>
            <if test="recordurl != null">recordurl,</if>
            <if test="templateid != null">templateid,</if>
            <if test="templatequestionnum != null">templatequestionnum,</if>
            <if test="switchid != null">switchid,</if>
            <if test="questiontext != null">questiontext,</if>
            <if test="questionvoice != null">questionvoice,</if>
            <if test="categoryname != null">categoryname,</if>
            <if test="targetoptions != null">targetoptions,</if>
            <if test="targetvalue != null">targetvalue,</if>
            <if test="matchedtext != null">matchedtext,</if>
            <if test="addtime != null">addtime,</if>
            <if test="isupload != null">isupload,</if>
            <if test="uploadTime != null">upload_time,</if>
            <if test="orgid != null">orgid,</if>
            <if test="createTime != null">create_time,</if>
            <if test="delFlag != null and delFlag != ''">del_flag,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="createBy != null">create_by,</if>
            <if test="valueType != null">value_type,</if>
            <if test="answerps != null  and answerps != ''">answerps,</if>
            <if test="comment != null  and comment != ''">comment,</if>
            <if test="scriptid != null ">scriptid,</if>
            <if test=" patid != null">patid,</if>
            <if test=" extemplateText != null">extemplate_text,</if>
            <if test=" guid != null">guid,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="subId != null">#{subId},</if>
            <if test="targetid != null">#{targetid},</if>
            <if test="taskid != null">#{taskid},</if>
            <if test="uuid != null">#{uuid},</if>
            <if test="phone != null">#{phone},</if>
            <if test="operate != null">#{operate},</if>
            <if test="displayno != null">#{displayno},</if>
            <if test="inbound != null">#{inbound},</if>
            <if test="incoming != null">#{incoming},</if>
            <if test="assigntime != null">#{assigntime},</if>
            <if test="starttime != null">#{starttime},</if>
            <if test="answertime != null">#{answertime},</if>
            <if test="silent != null">#{silent},</if>
            <if test="dtmfKey != null">#{dtmfKey},</if>
            <if test="musicpath != null">#{musicpath},</if>
            <if test="sentIndex != null">#{sentIndex},</if>
            <if test="sentBegin != null">#{sentBegin},</if>
            <if test="asrtext != null">#{asrtext},</if>
            <if test="beginTime != null">#{beginTime},</if>
            <if test="endTime != null">#{endTime},</if>
            <if test="sentEnd != null">#{sentEnd},</if>
            <if test="recordpath != null">#{recordpath},</if>
            <if test="recordurl != null">#{recordurl},</if>
            <if test="templateid != null">#{templateid},</if>
            <if test="templatequestionnum != null">#{templatequestionnum},</if>
            <if test="switchid != null">#{switchid},</if>
            <if test="questiontext != null">#{questiontext},</if>
            <if test="questionvoice != null">#{questionvoice},</if>
            <if test="categoryname != null">#{categoryname},</if>
            <if test="targetoptions != null">#{targetoptions},</if>
            <if test="targetvalue != null">#{targetvalue},</if>
            <if test="matchedtext != null">#{matchedtext},</if>
            <if test="addtime != null">#{addtime},</if>
            <if test="isupload != null">#{isupload},</if>
            <if test="uploadTime != null">#{uploadTime},</if>
            <if test="orgid != null">#{orgid},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="delFlag != null and delFlag != ''">#{delFlag},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="valueType != null">#{valueType},</if>
            <if test="answerps != null  and answerps != ''">#{answerps},</if>
            <if test="comment != null  and comment != ''">#{comment},</if>
            <if test="scriptid != null ">#{scriptid},</if>
            <if test="patid != null">#{patid},</if>
            <if test="extemplateText != null">#{extemplateText},</if>
            <if test="guid != null">#{guid},</if>
        </trim>
    </insert>
 
    <update id="updateServiceSubtaskDetail" parameterType="com.smartor.domain.ServiceSubtaskDetail">
        update service_subtask_detail
        <trim prefix="SET" suffixOverrides=",">
            <if test="subId != null">sub_id = #{subId},</if>
            <if test="taskid != null">taskid = #{taskid},</if>
            <if test="targetid != null">targetid = #{targetid},</if>
            <if test="uuid != null">uuid = #{uuid},</if>
            <if test="phone != null">phone = #{phone},</if>
            <if test="operate != null">operate = #{operate},</if>
            <if test="displayno != null">displayno = #{displayno},</if>
            <if test="inbound != null">inbound = #{inbound},</if>
            <if test="incoming != null">incoming = #{incoming},</if>
            <if test="assigntime != null">assigntime = #{assigntime},</if>
            <if test="starttime != null">starttime = #{starttime},</if>
            <if test="answertime != null">answertime = #{answertime},</if>
            <if test="silent != null">silent = #{silent},</if>
            <if test="dtmfKey != null">dtmf_key = #{dtmfKey},</if>
            <if test="musicpath != null">musicpath = #{musicpath},</if>
            <if test="sentIndex != null">sent_index = #{sentIndex},</if>
            <if test="sentBegin != null">sent_begin = #{sentBegin},</if>
            <if test="asrtext != null">asrtext = #{asrtext},</if>
            <if test="beginTime != null">begin_time = #{beginTime},</if>
            <if test="endTime != null">end_time = #{endTime},</if>
            <if test="sentEnd != null">sent_end = #{sentEnd},</if>
            <if test="recordpath != null">recordpath = #{recordpath},</if>
            <if test="recordurl != null">recordurl = #{recordurl},</if>
            <if test="templateid != null">templateid = #{templateid},</if>
            <if test="templatequestionnum != null">templatequestionnum = #{templatequestionnum},</if>
            <if test="switchid != null">switchid = #{switchid},</if>
            <if test="questiontext != null">questiontext = #{questiontext},</if>
            <if test="questionvoice != null">questionvoice = #{questionvoice},</if>
            <if test="categoryname != null">categoryname = #{categoryname},</if>
            <if test="targetoptions != null">targetoptions = #{targetoptions},</if>
            <if test="targetvalue != null">targetvalue = #{targetvalue},</if>
            <if test="matchedtext != null">matchedtext = #{matchedtext},</if>
            <if test="addtime != null">addtime = #{addtime},</if>
            <if test="isupload != null">isupload = #{isupload},</if>
            <if test="uploadTime != null">upload_time = #{uploadTime},</if>
            <if test="orgid != null">orgid = #{orgid},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="valueType != null">value_type = #{valueType},</if>
            <if test="answerps != null  and answerps != ''">answerps = #{answerps},</if>
            <if test="comment != null  and comment != ''">comment = #{comment},</if>
            <if test="scriptid != null ">scriptid = #{scriptid},</if>
            <if test=" patid != null">patid = #{patid},</if>
            <if test=" extemplateText != null">extemplate_text = #{extemplateText},</if>
            <if test=" guid != null">guid = #{guid},</if>
        </trim>
        where id = #{id}
    </update>
 
 
    <update id="updateSSDByCondition" parameterType="com.smartor.domain.ServiceSubtaskDetail">
        update service_subtask_detail
        <trim prefix="SET" suffixOverrides=",">
            <if test="subId != null">sub_id = #{subId},</if>
            <if test="taskid != null">taskid = #{taskid},</if>
            <if test="targetid != null">targetid = #{targetid},</if>
            <if test="uuid != null">uuid = #{uuid},</if>
            <if test="phone != null">phone = #{phone},</if>
            <if test="operate != null">operate = #{operate},</if>
            <if test="displayno != null">displayno = #{displayno},</if>
            <if test="inbound != null">inbound = #{inbound},</if>
            <if test="incoming != null">incoming = #{incoming},</if>
            <if test="assigntime != null">assigntime = #{assigntime},</if>
            <if test="starttime != null">starttime = #{starttime},</if>
            <if test="answertime != null">answertime = #{answertime},</if>
            <if test="silent != null">silent = #{silent},</if>
            <if test="dtmfKey != null">dtmf_key = #{dtmfKey},</if>
            <if test="musicpath != null">musicpath = #{musicpath},</if>
            <if test="sentIndex != null">sent_index = #{sentIndex},</if>
            <if test="sentBegin != null">sent_begin = #{sentBegin},</if>
            <if test="asrtext != null">asrtext = #{asrtext},</if>
            <if test="beginTime != null">begin_time = #{beginTime},</if>
            <if test="endTime != null">end_time = #{endTime},</if>
            <if test="sentEnd != null">sent_end = #{sentEnd},</if>
            <if test="recordpath != null">recordpath = #{recordpath},</if>
            <if test="recordurl != null">recordurl = #{recordurl},</if>
            <if test="templateid != null">templateid = #{templateid},</if>
            <if test="templatequestionnum != null">templatequestionnum = #{templatequestionnum},</if>
            <if test="switchid != null">switchid = #{switchid},</if>
            <if test="questiontext != null">questiontext = #{questiontext},</if>
            <if test="questionvoice != null">questionvoice = #{questionvoice},</if>
            <if test="categoryname != null">categoryname = #{categoryname},</if>
            <if test="targetoptions != null">targetoptions = #{targetoptions},</if>
            <if test="targetvalue != null">targetvalue = #{targetvalue},</if>
            <if test="matchedtext != null">matchedtext = #{matchedtext},</if>
            <if test="addtime != null">addtime = #{addtime},</if>
            <if test="isupload != null">isupload = #{isupload},</if>
            <if test="uploadTime != null">upload_time = #{uploadTime},</if>
            <if test="orgid != null">orgid = #{orgid},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="valueType != null">value_type = #{valueType},</if>
            <if test="answerps != null  and answerps != ''">answerps = #{answerps},</if>
            <if test="comment != null  and comment != ''">comment = #{comment},</if>
            <if test="scriptid != null ">scriptid = #{scriptid},</if>
            <if test=" patid != null">patid = #{patid},</if>
            <if test=" extemplateText != null">extemplate_text = #{extemplateText},</if>
            <if test=" guid != null">guid = #{guid},</if>
        </trim>
        where patid = #{patid} and scriptid = #{scriptid} and sub_id = #{subId}
    </update>
 
    <delete id="deleteServiceSubtaskDetailByCalldetailid" parameterType="String">
        delete
        from service_subtask_detail
        where id = #{id}
    </delete>
 
    <delete id="deleteServiceSubtaskDetailByCalldetailids" parameterType="String">
        delete from service_subtask_detail where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
 
    <select id="countPatByTarget" parameterType="Long" resultMap="ServiceSubtaskDetailTargetResult">
        SELECT service_task.taskid,
               service_subtask_detail.targetid,
               ivr_liba_target.targetname,
               service_subtask_detail.matchedtext,
               count(service_subtask_detail.matchedtext) count
        FROM service_subtask_detail
            JOIN service_task
        ON service_task.taskid = service_subtask_detail.taskid
            JOIN ivr_liba_target ON ivr_liba_target.id = service_subtask_detail.targetid
        WHERE
            targetid = #{targetid}
        GROUP BY service_task.taskid,
            service_subtask_detail.targetid,
            ivr_liba_target.targetname,
            service_subtask_detail.matchedtext
    </select>
</mapper>