|  |  | 
 |  |  |     <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="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, | 
 |  |  | 
 |  |  |         <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> | 
 |  |  | 
 |  |  |         <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> | 
 |  |  | 
 |  |  |         <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> | 
 |  |  | 
 |  |  |         <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> | 
 |  |  | 
 |  |  |         <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> | 
 |  |  | 
 |  |  |             #{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> |