From 6659135780e718758417efde4c8c351c69e3755b Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期四, 11 十二月 2025 15:52:19 +0800
Subject: [PATCH] 代码提交

---
 smartor/src/main/resources/mapper/smartor/ServiceSubtaskDetailMapper.xml |   37 +++++++++++++++++++++++++++++++++++--
 1 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskDetailMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskDetailMapper.xml
index f0b9dd2..dd283ea 100644
--- a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskDetailMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskDetailMapper.xml
@@ -35,6 +35,7 @@
         <result property="questiontext" column="questiontext"/>
         <result property="questionvoice" column="questionvoice"/>
         <result property="categoryname" column="categoryname"/>
+        <result property="categoryid" column="categoryid"/>
         <result property="targetoptions" column="targetoptions"/>
         <result property="targetvalue" column="targetvalue"/>
         <result property="matchedtext" column="matchedtext"/>
@@ -55,7 +56,13 @@
         <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,
@@ -93,6 +100,7 @@
                questiontext,
                questionvoice,
                categoryname,
+               categoryid,
                targetoptions,
                targetvalue,
                matchedtext,
@@ -140,6 +148,7 @@
             <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},
@@ -165,7 +174,9 @@
         where id = #{id}
     </select>
 
-    <insert id="insertServiceSubtaskDetail" parameterType="com.smartor.domain.ServiceSubtaskDetail">
+    <insert id="insertServiceSubtaskDetail" parameterType="com.smartor.domain.ServiceSubtaskDetail"
+            useGeneratedKeys="true"
+            keyProperty="id">
         insert into service_subtask_detail
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="id != null">id,</if>
@@ -217,6 +228,7 @@
             <if test=" patid != null">patid,</if>
             <if test=" extemplateText != null">extemplate_text,</if>
             <if test=" guid != null">guid,</if>
+            <if test=" categoryid != null">categoryid,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="id != null">#{id},</if>
@@ -268,6 +280,7 @@
             <if test="patid != null">#{patid},</if>
             <if test="extemplateText != null">#{extemplateText},</if>
             <if test="guid != null">#{guid},</if>
+            <if test="categoryid != null">#{categoryid},</if>
         </trim>
     </insert>
 
@@ -322,6 +335,7 @@
             <if test=" patid != null">patid = #{patid},</if>
             <if test=" extemplateText != null">extemplate_text = #{extemplateText},</if>
             <if test=" guid != null">guid = #{guid},</if>
+            <if test=" categoryid != null">categoryid = #{categoryid},</if>
         </trim>
         where id = #{id}
     </update>
@@ -378,6 +392,7 @@
             <if test=" patid != null">patid = #{patid},</if>
             <if test=" extemplateText != null">extemplate_text = #{extemplateText},</if>
             <if test=" guid != null">guid = #{guid},</if>
+            <if test=" categoryid != null">categoryid = #{categoryid},</if>
         </trim>
         where patid = #{patid} and scriptid = #{scriptid} and sub_id = #{subId}
     </update>
@@ -394,4 +409,22 @@
             #{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>

--
Gitblit v1.9.3