liusheng
12 小时以前 e180e3a496d6f29d3a3b34016400de9d997c6bd9
smartor/src/main/resources/mapper/smartor/ServiceSubtaskDetailMapper.xml
@@ -18,6 +18,7 @@
        <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"/>
@@ -35,6 +36,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"/>
@@ -54,11 +56,21 @@
        <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"/>
        <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,
               lib_templateid,
               targetid,
               answerps,
               scriptid,
@@ -93,6 +105,7 @@
               questiontext,
               questionvoice,
               categoryname,
               categoryid,
               targetoptions,
               targetvalue,
               matchedtext,
@@ -105,6 +118,8 @@
               update_by,
               update_time,
               value_type,
               template_type,
               score,
               create_by
        from service_subtask_detail
    </sql>
@@ -112,52 +127,56 @@
    <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>
        where 1=1
        <if test="subId != null">and sub_id = #{subId}</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>
    <select id="selectServiceSubtaskDetailByCalldetailid" parameterType="String" resultMap="ServiceSubtaskDetailResult">
@@ -165,7 +184,28 @@
        where id = #{id}
    </select>
    <insert id="insertServiceSubtaskDetail" parameterType="com.smartor.domain.ServiceSubtaskDetail">
    <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>
    <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"
            useGeneratedKeys="true"
            keyProperty="id">
        insert into service_subtask_detail
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
@@ -217,6 +257,10 @@
            <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>
            <if test="templateType != null">template_type,</if>
            <if test="libTemplateid != null">lib_templateid,</if>
            <if test="score != null">score,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
@@ -268,6 +312,10 @@
            <if test="patid != null">#{patid},</if>
            <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>
        </trim>
    </insert>
@@ -321,7 +369,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>
@@ -378,6 +430,10 @@
            <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>
            <if test="templateType != null">template_type = #{templateType},</if>
            <if test="libTemplateid != null">lib_templateid = #{libTemplateid},</if>
            <if test="score != null">score = #{score},</if>
        </trim>
        where patid = #{patid} and scriptid = #{scriptid} and sub_id = #{subId}
    </update>
@@ -394,4 +450,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>