From dc65bb4cbd96e9dfddc8056fd53252607d65cdef Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期四, 08 十月 2026 21:31:20 +0800
Subject: [PATCH] 提交
---
smartor/src/main/resources/mapper/smartor/ServiceSubtaskDetailMapper.xml | 438 +++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 392 insertions(+), 46 deletions(-)
diff --git a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskDetailMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskDetailMapper.xml
index c2717fc..945af85 100644
--- a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskDetailMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskDetailMapper.xml
@@ -18,6 +18,9 @@
<result property="assigntime" column="assigntime"/>
<result property="starttime" column="starttime"/>
<result property="answertime" column="answertime"/>
+ <result property="dimension" column="lib_templateid"/>
+ <result property="isMydException" column="is_myd_exception"/>
+
<result property="silent" column="silent"/>
<result property="dtmfKey" column="dtmf_key"/>
<result property="musicpath" column="musicpath"/>
@@ -55,6 +58,9 @@
<result property="patid" column="patid"/>
<result property="guid" column="guid"/>
<result property="extemplateText" column="extemplate_text"/>
+ <result property="templateType" column="template_type"/>
+ <result property="libTemplateid" column="lib_templateid"/>
+ <result property="score" column="score"/>
</resultMap>
<resultMap type="com.smartor.domain.ServiceSubtaskDetailTarget" id="ServiceSubtaskDetailTargetResult">
<result property="targetid" column="targetid"/>
@@ -66,6 +72,9 @@
<sql id="selectServiceSubtaskDetailVo">
select id,
sub_id,
+ is_myd_exception,
+ dimension,
+ lib_templateid,
targetid,
answerps,
scriptid,
@@ -113,6 +122,8 @@
update_by,
update_time,
value_type,
+ template_type,
+ score,
create_by
from service_subtask_detail
</sql>
@@ -121,56 +132,341 @@
resultMap="ServiceSubtaskDetailResult">
<include refid="selectServiceSubtaskDetailVo"/>
where 1=1
- <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="categoryid != null ">and categoryid = #{categoryid}</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>
+ <if test="subId != null">and sub_id = #{subId}</if>
+ <if test="isMydException != null">and is_myd_exception = #{isMydException}</if>
+ <if test="dimension != null">and dimension = #{dimension}</if>
+ <if test="templateType != null">and template_type = #{templateType}</if>
+ <if test="libTemplateid != null">and lib_templateid = #{libTemplateid}</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="categoryid != null ">and categoryid = #{categoryid}</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>
+ <if test="score != null">and score = #{score}</if>
+
</select>
+ <!--
+ 寮傚父闂澶勭悊鎯呭喌鏌ヨ锛坱racedeallist锛夌殑銆屾湁鏁堝~鍐欐暟銆嶏細
+ 鍘熸潵瀵规瘡涓� scriptid 閮芥墽琛屼竴娆� selectServiceSubtaskDetailList锛堟煡鍥炲叏閮ㄥ垪鍐嶅幓 size锛夛紝
+ 涓�涓棶棰樹竴娆°�佽�屼笖鏁翠釜鎺ュ彛浼氳璋冪敤涓ら亶锛屽嚑鍗佷笂鐧句釜闂灏辨槸涓婄櫨娆″ぇ琛ㄦ壂鎻忥紱
+ 杩欓噷鍚堝苟鎴愪竴鏉� group by銆�
+ 娉ㄦ剰锛氫负涓庡師鍙e緞瀹屽叏涓�鑷达紝杩欓噷涓嶅姞 del_flag 鏉′欢锛堝師 selectServiceSubtaskDetailList
+ 铏界劧 Java 閲� setDelFlag("0")锛屼絾 SQL 閲屽苟娌℃湁 del_flag 杩囨护锛夈��
+ -->
+ <select id="countDetailByScriptIds" resultType="java.util.Map">
+ select scriptid as scriptid, count(*) as cnt
+ from service_subtask_detail
+ where scriptid in
+ <foreach collection="scriptIds" item="scriptId" open="(" separator="," close=")">
+ #{scriptId}
+ </foreach>
+ group by scriptid
+ </select>
+
+ <select id="getServiceSubtaskDetails" parameterType="com.smartor.domain.ServiceSubtaskDetailVO"
+ resultType="java.util.HashMap">
+ select
+ ssd.sub_id,
+ ssd.is_myd_exception,
+ ssd.dimension,
+ ssd.taskid,
+ ssd.patid,
+ sd.sendname,
+ ssd.questiontext,
+ ssd.matchedtext,
+ ssd.asrtext,
+ ssd.scriptid,
+ ssd.targetid,
+ ssd.template_type,
+ ssd.lib_templateid,
+ sd.deptcode,
+ sd.deptname,
+ sd.leavehospitaldistrictcode,
+ sd.leavehospitaldistrictname
+ from service_subtask_detail ssd
+ inner join service_subtask sd on ssd.sub_id = sd.id
+ where ssd.del_flag = '0'
+ and sd.del_flag = '0'
+ <if test="orgid != null and orgid != ''">and ssd.orgid = #{orgid}</if>
+ <if test="subId != null">and ssd.sub_id = #{subId}</if>
+ <if test="taskid != null">and ssd.taskid = #{taskid}</if>
+ <if test="questiontext != null and questiontext != ''">and ssd.questiontext = #{questiontext}</if>
+ <if test="isMydException != null">and ssd.is_myd_exception = #{isMydException}</if>
+ <if test="dimension != null">and ssd.dimension = #{dimension}</if>
+ <if test="matchedtext != null and matchedtext != ''">and ssd.matchedtext = #{matchedtext}</if>
+ <if test="asrtext != null and asrtext != ''">and ssd.asrtext = #{asrtext}</if>
+ <if test="scriptid != null">and ssd.scriptid = #{scriptid}</if>
+ <if test="patid != null">and ssd.patid = #{patid}</if>
+ <if test="templateType != null">and ssd.template_type = #{templateType}</if>
+ <if test="libTemplateid != null">and ssd.lib_templateid = #{libTemplateid}</if>
+ <if test="targetid != null">and ssd.targetid = #{targetid}</if>
+ <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0">
+ and sd.leavehospitaldistrictcode in
+ <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="(" separator="," close=")">
+ #{leavehospitaldistrictcode}
+ </foreach>
+ </if>
+ <if test="leaveldeptcodes != null and leaveldeptcodes.size() > 0">
+ and sd.deptcode in
+ <foreach collection="leaveldeptcodes" item="leaveldeptcode" open="(" separator="," close=")">
+ #{leaveldeptcode}
+ </foreach>
+ </if>
+ <if test="scriptIds != null and scriptIds.size() > 0">
+ and ssd.scriptid in
+ <foreach collection="scriptIds" item="scriptId" open="(" separator="," close=")">
+ #{scriptId}
+ </foreach>
+ </if>
+ <if test="isFilled != null and isFilled != '0'">
+ AND IFNULL(ssd.matchedtext,ssd.asrtext) is not null
+ AND IFNULL(ssd.matchedtext,ssd.asrtext) != ''
+ </if>
+ <if test="configValue != null and configValue != ''">
+ AND ssd.categoryid IN (${configValue})
+ </if>
+ order by ssd.sub_id desc, ssd.id desc
+ </select>
<select id="selectServiceSubtaskDetailByCalldetailid" parameterType="String" resultMap="ServiceSubtaskDetailResult">
<include refid="selectServiceSubtaskDetailVo"/>
where id = #{id}
+ </select>
+
+ <select id="queryFillCount" resultType="com.smartor.domain.DTO.ServiceSubtaskDetailDTO">
+ select id,questiontext,matchedtext,targetvalue,score
+ from service_subtask_detail
+ where del_flag = 0
+ and sub_id in
+ <foreach item="subid" collection="subids" open="(" separator="," close=")">
+ #{subid}
+ </foreach>
+ <if test="questiontext != null">and questiontext = #{questiontext}</if>
+ </select>
+
+ <!--
+ 婊℃剰搴︽煴鐘跺浘锛氫竴娆℃�х粺璁℃湰娆¤姹傚叏閮ㄦā鏉跨殑濉姤閲忋��
+ 绛変环浜庡姣忎釜妯℃澘鎵ц queryFillCount(subids, questiontext)锛屽尯鍒槸锛�
+ 1) 鐢� join service_subtask 浠f浛鍏堟妸鍏ㄩ儴 sub_id 鏌ュ洖 Java 鍐嶆嫾 IN(...)锛�
+ 2) 鎸� libtemplateid + questiontext + score 鍒嗙粍锛屽彧鍥炰紶鍒嗗�间笌鏉℃暟锛�
+ 3) visit_time 鏀规垚鍙蛋绱㈠紩鐨勮寖鍥存潯浠躲��
+ 娉ㄦ剰锛氳繖閲屽埢鎰忎笉鍦� SQL 閲岃繃婊� questiontext锛岀敱 Java 鎸夊師 queryFillCount 鐨�
+ 銆宷uestiontext 涓� null 鏃朵笉鎷艰鏉′欢銆嶈涔夊仛鍖归厤锛屼繚璇佺粨鏋滃彛寰勫畬鍏ㄤ竴鑷淬��
+ -->
+ <select id="selectSatisfactionFillStat" parameterType="com.smartor.domain.entity.SatisfactionStatQuery"
+ resultType="java.util.Map">
+ select ss.libtemplateid as libtemplateid,
+ ssd.questiontext as questiontext,
+ ssd.score as score,
+ count(*) as cnt
+ from service_subtask_detail ssd
+ join service_subtask ss on ss.id = ssd.sub_id
+ where ssd.del_flag = 0
+ and ss.del_flag = 0
+ <if test="orgid != null and orgid != ''">
+ and ss.orgid = #{orgid}
+ </if>
+ <if test="campusid != null and campusid != ''">
+ and ss.campusid = #{campusid}
+ </if>
+ <if test="type != null and type != ''">and ss.type = #{type}</if>
+ <if test="startTime != null">
+ and ss.visit_time >= #{startTime}
+ </if>
+ <if test="endTime != null">
+ and ss.visit_time < date_add(#{endTime}, interval 1 day)
+ </if>
+ <if test="libTemplateIds != null and libTemplateIds.size() > 0">
+ and ss.libtemplateid IN
+ <foreach collection="libTemplateIds" item="libTemplateId" open="(" separator="," close=")">
+ #{libTemplateId}
+ </foreach>
+ </if>
+ <if test="(hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0) or (deptcodes != null and deptcodes.size() > 0)">
+ AND (
+ <if test="hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0">
+ ss.leavehospitaldistrictcode IN
+ <foreach collection="hospitaldistrictcodes" item="hospitaldistrictcode" open="("
+ separator=","
+ close=")">
+ #{hospitaldistrictcode}
+ </foreach>
+ </if>
+ <if test="hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0 and deptcodes != null and deptcodes.size() > 0">
+ OR
+ </if>
+ <if test="deptcodes != null and deptcodes.size() > 0">
+ ss.deptcode IN
+ <foreach collection="deptcodes" item="deptcode" open="(" separator="," close=")">
+ #{deptcode}
+ </foreach>
+ </if>
+ )
+ </if>
+ group by ss.libtemplateid, ssd.questiontext, ssd.score
+ </select>
+
+ <select id="selectSatisfactionFillPersonCount" parameterType="com.smartor.domain.entity.SatisfactionStatQuery"
+ resultType="java.util.Map">
+ select ss.libtemplateid as libtemplateid,
+ count(distinct ssd.sub_id) as cnt
+ from service_subtask_detail ssd
+ join service_subtask ss on ss.id = ssd.sub_id
+ where ssd.del_flag = 0
+ and ss.del_flag = 0
+ <if test="orgid != null and orgid != ''">
+ and ss.orgid = #{orgid}
+ </if>
+ <if test="campusid != null and campusid != ''">
+ and ss.campusid = #{campusid}
+ </if>
+ <if test="type != null and type != ''">and ss.type = #{type}</if>
+ <if test="startTime != null">
+ and ss.visit_time >= #{startTime}
+ </if>
+ <if test="endTime != null">
+ and ss.visit_time < date_add(#{endTime}, interval 1 day)
+ </if>
+ <if test="libTemplateIds != null and libTemplateIds.size() > 0">
+ and ss.libtemplateid IN
+ <foreach collection="libTemplateIds" item="libTemplateId" open="(" separator="," close=")">
+ #{libTemplateId}
+ </foreach>
+ </if>
+ <if test="(hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0) or (deptcodes != null and deptcodes.size() > 0)">
+ AND (
+ <if test="hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0">
+ ss.leavehospitaldistrictcode IN
+ <foreach collection="hospitaldistrictcodes" item="hospitaldistrictcode" open="("
+ separator=","
+ close=")">
+ #{hospitaldistrictcode}
+ </foreach>
+ </if>
+ <if test="hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0 and deptcodes != null and deptcodes.size() > 0">
+ OR
+ </if>
+ <if test="deptcodes != null and deptcodes.size() > 0">
+ ss.deptcode IN
+ <foreach collection="deptcodes" item="deptcode" open="(" separator="," close=")">
+ #{deptcode}
+ </foreach>
+ </if>
+ )
+ </if>
+ group by ss.libtemplateid
+ </select>
+
+ <!--
+ 婊℃剰搴︾粺璁★紙statistics / statisticsByDimension锛夛細涓�娆℃�х粺璁℃湰娆¤姹傚叏閮ㄩ棶棰樼殑濉姤閲忋��
+ 绛変环浜庡姣忎釜闂鎵ц queryFillCount(subids, questiontext)锛屽尯鍒槸锛�
+ 1) 鐢� join service_subtask 浠f浛鍏堟妸鍏ㄩ儴 sub_id 鏌ュ洖 Java 鍐嶆嫾 IN(...)锛�
+ 2) 鎸� 妯℃澘+闂+matchedtext+score 鍒嗙粍锛屽彧鍥炰紶閫夐」/鍒嗗�间笌鏉℃暟锛�
+ 3) targetvalue 鐢� min() 鍙栬闂鐨勪竴涓潪绌洪�夐」涓诧紙鍚屼竴涓棶棰樿鍊间竴鑷达級锛�
+ 4) visit_time 鏀规垚鍙蛋绱㈠紩鐨勮寖鍥存潯浠躲��
+ 娉ㄦ剰锛氳繖閲屽埢鎰忎笉鍦� SQL 閲岃繃婊� questiontext锛岀敱 Java 鎸夊師 queryFillCount 鐨�
+ 銆宷uestiontext 涓� null 鏃朵笉鎷艰鏉′欢銆嶈涔夊仛鍖归厤锛屼繚璇佺粨鏋滃彛寰勫畬鍏ㄤ竴鑷淬��
+ -->
+ <select id="selectSatisfactionFillStatByMatchedtext" parameterType="com.smartor.domain.entity.SatisfactionStatQuery"
+ resultType="java.util.Map">
+ select ss.libtemplateid as libtemplateid,
+ ssd.questiontext as questiontext,
+ ssd.matchedtext as matchedtext,
+ ssd.score as score,
+ count(*) as cnt,
+ min(ssd.targetvalue) as targetvalue
+ from service_subtask_detail ssd
+ join service_subtask ss on ss.id = ssd.sub_id
+ where ssd.del_flag = 0
+ and ss.del_flag = 0
+ <if test="orgid != null and orgid != ''">
+ and ss.orgid = #{orgid}
+ </if>
+ <if test="campusid != null and campusid != ''">
+ and ss.campusid = #{campusid}
+ </if>
+ <if test="type != null and type != ''">and ss.type = #{type}</if>
+ <if test="startTime != null">
+ and ss.visit_time >= #{startTime}
+ </if>
+ <if test="endTime != null">
+ and ss.visit_time < date_add(#{endTime}, interval 1 day)
+ </if>
+ <if test="libTemplateIds != null and libTemplateIds.size() > 0">
+ and ss.libtemplateid IN
+ <foreach collection="libTemplateIds" item="libTemplateId" open="(" separator="," close=")">
+ #{libTemplateId}
+ </foreach>
+ </if>
+ <if test="(hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0) or (deptcodes != null and deptcodes.size() > 0)">
+ AND (
+ <if test="hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0">
+ ss.leavehospitaldistrictcode IN
+ <foreach collection="hospitaldistrictcodes" item="hospitaldistrictcode" open="("
+ separator=","
+ close=")">
+ #{hospitaldistrictcode}
+ </foreach>
+ </if>
+ <if test="hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0 and deptcodes != null and deptcodes.size() > 0">
+ OR
+ </if>
+ <if test="deptcodes != null and deptcodes.size() > 0">
+ ss.deptcode IN
+ <foreach collection="deptcodes" item="deptcode" open="(" separator="," close=")">
+ #{deptcode}
+ </foreach>
+ </if>
+ )
+ </if>
+ group by ss.libtemplateid, ssd.questiontext, ssd.matchedtext, ssd.score
+ </select>
+
+ <select id="isExistServiceSubtaskDetail" resultType="com.smartor.domain.DTO.ServiceSubtaskDetailDTO">
+ select id, questiontext, matchedtext, score
+ from service_subtask_detail
+ where del_flag = 0
+ <if test="subid != null ">and sub_id = #{subid}</if>
+ <if test="scriptid != null">and scriptid = #{scriptid}</if>
</select>
<insert id="insertServiceSubtaskDetail" parameterType="com.smartor.domain.ServiceSubtaskDetail"
@@ -228,6 +524,11 @@
<if test=" extemplateText != null">extemplate_text,</if>
<if test=" guid != null">guid,</if>
<if test=" categoryid != null">categoryid,</if>
+ <if test="templateType != null">template_type,</if>
+ <if test="libTemplateid != null">lib_templateid,</if>
+ <if test="score != null">score,</if>
+ <if test="isMydException != null">is_myd_exception,</if>
+ <if test="dimension != null">dimension,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
@@ -280,12 +581,19 @@
<if test="extemplateText != null">#{extemplateText},</if>
<if test="guid != null">#{guid},</if>
<if test="categoryid != null">#{categoryid},</if>
+ <if test="templateType != null">#{templateType},</if>
+ <if test="libTemplateid != null">#{libTemplateid},</if>
+ <if test="score != null">#{score},</if>
+ <if test="isMydException != null">#{isMydException},</if>
+ <if test="dimension != null">#{dimension},</if>
</trim>
</insert>
<update id="updateServiceSubtaskDetail" parameterType="com.smartor.domain.ServiceSubtaskDetail">
update service_subtask_detail
<trim prefix="SET" suffixOverrides=",">
+ <if test="isMydException != null">is_myd_exception = #{isMydException},</if>
+ <if test="dimension != null">dimension = #{dimension},</if>
<if test="subId != null">sub_id = #{subId},</if>
<if test="taskid != null">taskid = #{taskid},</if>
<if test="targetid != null">targetid = #{targetid},</if>
@@ -333,8 +641,11 @@
<if test="scriptid != null ">scriptid = #{scriptid},</if>
<if test=" patid != null">patid = #{patid},</if>
<if test=" extemplateText != null">extemplate_text = #{extemplateText},</if>
+ <if test="libTemplateid != null">lib_templateid = #{libTemplateid},</if>
<if test=" guid != null">guid = #{guid},</if>
<if test=" categoryid != null">categoryid = #{categoryid},</if>
+ <if test="templateType != null">template_type = #{templateType},</if>
+ <if test="score != null">score = #{score},</if>
</trim>
where id = #{id}
</update>
@@ -392,6 +703,11 @@
<if test=" extemplateText != null">extemplate_text = #{extemplateText},</if>
<if test=" guid != null">guid = #{guid},</if>
<if test=" categoryid != null">categoryid = #{categoryid},</if>
+ <if test="templateType != null">template_type = #{templateType},</if>
+ <if test="libTemplateid != null">lib_templateid = #{libTemplateid},</if>
+ <if test="score != null">score = #{score},</if>
+ <if test="isMydException != null">is_myd_exception = #{isMydException},</if>
+ <if test="dimension != null">dimension = #{dimension},</if>
</trim>
where patid = #{patid} and scriptid = #{scriptid} and sub_id = #{subId}
</update>
@@ -418,7 +734,7 @@
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
+ JOIN ivr_liba_target ON ivr_liba_target.id = service_subtask_detail.targetid
WHERE
targetid = #{targetid}
GROUP BY service_task.taskid,
@@ -426,4 +742,34 @@
ivr_liba_target.targetname,
service_subtask_detail.matchedtext
</select>
+
+ <select id="selectRepeatDetailIds" resultType="Long">
+ SELECT d1.id
+ FROM service_subtask_detail d1
+ INNER JOIN (
+ SELECT sub_id, questiontext,
+ MAX(create_time) AS max_create_time,
+ MAX(id) AS keep_id
+ FROM service_subtask_detail
+ WHERE del_flag = 0
+ GROUP BY sub_id, questiontext
+ HAVING COUNT(*) > 1
+ ) d2 ON d1.sub_id = d2.sub_id
+ AND d1.questiontext = d2.questiontext
+ AND (
+ d1.create_time < d2.max_create_time
+ OR (d1.create_time = d2.max_create_time AND d1.id < d2.keep_id)
+ )
+ WHERE d1.del_flag = 0
+ </select>
+
+ <update id="deleteRepeatDetailByIds">
+ UPDATE service_subtask_detail
+ SET del_flag = 1
+ WHERE del_flag = 0
+ AND id IN
+ <foreach collection="ids" item="id" open="(" separator="," close=")">
+ #{id}
+ </foreach>
+ </update>
</mapper>
--
Gitblit v1.9.3