|
|
@@ -0,0 +1,250 @@
|
|
|
+<?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.fs.company.mapper.QwSopTtDialogMapper">
|
|
|
+
|
|
|
+ <resultMap type="QwSopTtDialog" id="QwSopTtDialogResult">
|
|
|
+ <result property="id" column="id"/>
|
|
|
+ <result property="sopTtTaskId" column="sop_tt_task_id"/>
|
|
|
+ <result property="phone" column="phone"/>
|
|
|
+ <result property="userLogsId" column="user_logs_id"/>
|
|
|
+ <result property="fsUserId" column="fs_user_id"/>
|
|
|
+ <result property="externalId" column="external_id"/>
|
|
|
+ <result property="qwUserKey" column="qw_user_key"/>
|
|
|
+ <result property="dialogId" column="dialog_id"/>
|
|
|
+ <result property="dialogName" column="dialog_name"/>
|
|
|
+ <result property="callStatus" column="call_status"/>
|
|
|
+ <result property="isAnswered" column="is_answered"/>
|
|
|
+ <result property="callDuration" column="call_duration"/>
|
|
|
+ <result property="hangupReason" column="hangup_reason"/>
|
|
|
+ <result property="callTime" column="call_time"/>
|
|
|
+ <result property="sendStatus" column="send_status"/>
|
|
|
+ <result property="sendTime" column="send_time"/>
|
|
|
+ <result property="createTime" column="create_time"/>
|
|
|
+ <result property="updateTime" column="update_time"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="selectQwSopTtDialogVo">
|
|
|
+ select id, sop_tt_task_id, phone, user_logs_id, fs_user_id, external_id, qw_user_key,
|
|
|
+ dialog_id, dialog_name, call_status, is_answered, call_duration, hangup_reason,
|
|
|
+ call_time, send_status, send_time, create_time, update_time
|
|
|
+ from qw_sop_tt_call_detail
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectQwSopTtDialogList" parameterType="QwSopTtDialog" resultMap="QwSopTtDialogResult">
|
|
|
+ <include refid="selectQwSopTtDialogVo"/>
|
|
|
+ <where>
|
|
|
+ <if test="sopTtTaskId != null"> and sop_tt_task_id = #{sopTtTaskId}</if>
|
|
|
+ <if test="phone != null and phone != ''"> and phone like concat('%', #{phone}, '%')</if>
|
|
|
+ <if test="userLogsId != null and userLogsId != ''"> and user_logs_id like concat('%', #{userLogsId}, '%')</if>
|
|
|
+ <if test="fsUserId != null"> and fs_user_id = #{fsUserId}</if>
|
|
|
+ <if test="externalId != null"> and external_id = #{externalId}</if>
|
|
|
+ <if test="qwUserKey != null"> and qw_user_key = #{qwUserKey}</if>
|
|
|
+ <if test="dialogId != null"> and dialog_id = #{dialogId}</if>
|
|
|
+ <if test="dialogName != null and dialogName != ''"> and dialog_name like concat('%', #{dialogName}, '%')</if>
|
|
|
+ <if test="callStatus != null and callStatus != ''"> and call_status = #{callStatus}</if>
|
|
|
+ <if test="isAnswered != null"> and is_answered = #{isAnswered}</if>
|
|
|
+ <if test="sendStatus != null"> and send_status = #{sendStatus}</if>
|
|
|
+ </where>
|
|
|
+ order by create_time desc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectQwSopTtDialogById" parameterType="Long" resultMap="QwSopTtDialogResult">
|
|
|
+ <include refid="selectQwSopTtDialogVo"/>
|
|
|
+ where id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectQwSopTtDialogByTaskId" parameterType="Long" resultMap="QwSopTtDialogResult">
|
|
|
+ <include refid="selectQwSopTtDialogVo"/>
|
|
|
+ where sop_tt_task_id = #{sopTtTaskId}
|
|
|
+ order by id
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectPendingSendDetails" parameterType="Integer" resultMap="QwSopTtDialogResult">
|
|
|
+ <include refid="selectQwSopTtDialogVo"/>
|
|
|
+ where send_status = 0
|
|
|
+ order by create_time
|
|
|
+ limit #{limit}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="countUnfinishedByTaskId" parameterType="Long" resultType="Integer">
|
|
|
+ select count(1)
|
|
|
+ from qw_sop_tt_call_detail
|
|
|
+ where sop_tt_task_id = #{sopTtTaskId}
|
|
|
+ and (call_status is null or call_status = '')
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertQwSopTtDialog" parameterType="QwSopTtDialog" useGeneratedKeys="true" keyProperty="id">
|
|
|
+ insert into qw_sop_tt_call_detail
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="sopTtTaskId != null">sop_tt_task_id,</if>
|
|
|
+ <if test="phone != null">phone,</if>
|
|
|
+ <if test="userLogsId != null">user_logs_id,</if>
|
|
|
+ <if test="fsUserId != null">fs_user_id,</if>
|
|
|
+ <if test="externalId != null">external_id,</if>
|
|
|
+ <if test="qwUserKey != null">qw_user_key,</if>
|
|
|
+ <if test="dialogId != null">dialog_id,</if>
|
|
|
+ <if test="dialogName != null">dialog_name,</if>
|
|
|
+ <if test="callStatus != null">call_status,</if>
|
|
|
+ <if test="isAnswered != null">is_answered,</if>
|
|
|
+ <if test="callDuration != null">call_duration,</if>
|
|
|
+ <if test="hangupReason != null">hangup_reason,</if>
|
|
|
+ <if test="callTime != null">call_time,</if>
|
|
|
+ <if test="sendStatus != null">send_status,</if>
|
|
|
+ <if test="sendTime != null">send_time,</if>
|
|
|
+ <if test="createTime != null">create_time,</if>
|
|
|
+ <if test="updateTime != null">update_time,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="sopTtTaskId != null">#{sopTtTaskId},</if>
|
|
|
+ <if test="phone != null">#{phone},</if>
|
|
|
+ <if test="userLogsId != null">#{userLogsId},</if>
|
|
|
+ <if test="fsUserId != null">#{fsUserId},</if>
|
|
|
+ <if test="externalId != null">#{externalId},</if>
|
|
|
+ <if test="qwUserKey != null">#{qwUserKey},</if>
|
|
|
+ <if test="dialogId != null">#{dialogId},</if>
|
|
|
+ <if test="dialogName != null">#{dialogName},</if>
|
|
|
+ <if test="callStatus != null">#{callStatus},</if>
|
|
|
+ <if test="isAnswered != null">#{isAnswered},</if>
|
|
|
+ <if test="callDuration != null">#{callDuration},</if>
|
|
|
+ <if test="hangupReason != null">#{hangupReason},</if>
|
|
|
+ <if test="callTime != null">#{callTime},</if>
|
|
|
+ <if test="sendStatus != null">#{sendStatus},</if>
|
|
|
+ <if test="sendTime != null">#{sendTime},</if>
|
|
|
+ <if test="createTime != null">#{createTime},</if>
|
|
|
+ <if test="updateTime != null">#{updateTime},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <insert id="batchInsertQwSopTtDialog" parameterType="list">
|
|
|
+ insert into qw_sop_tt_call_detail
|
|
|
+ (sop_tt_task_id, phone,
|
|
|
+ user_logs_id, fs_user_id, external_id, qw_user_key, dialog_id, dialog_name,
|
|
|
+ send_status, create_time, update_time)
|
|
|
+ values
|
|
|
+ <foreach collection="list" item="item" separator=",">
|
|
|
+ (
|
|
|
+ #{item.sopTtTaskId},
|
|
|
+ #{item.phone},
|
|
|
+ <choose>
|
|
|
+ <when test="item.userLogsId != null">#{item.userLogsId}</when>
|
|
|
+ <otherwise>null</otherwise>
|
|
|
+ </choose>,
|
|
|
+ <choose>
|
|
|
+ <when test="item.fsUserId != null">#{item.fsUserId}</when>
|
|
|
+ <otherwise>null</otherwise>
|
|
|
+ </choose>,
|
|
|
+ <choose>
|
|
|
+ <when test="item.externalId != null">#{item.externalId}</when>
|
|
|
+ <otherwise>null</otherwise>
|
|
|
+ </choose>,
|
|
|
+ <choose>
|
|
|
+ <when test="item.qwUserKey != null">#{item.qwUserKey}</when>
|
|
|
+ <otherwise>null</otherwise>
|
|
|
+ </choose>,
|
|
|
+ <choose>
|
|
|
+ <when test="item.dialogId != null">#{item.dialogId}</when>
|
|
|
+ <otherwise>null</otherwise>
|
|
|
+ </choose>,
|
|
|
+ <choose>
|
|
|
+ <when test="item.dialogName != null and item.dialogName != ''">#{item.dialogName}</when>
|
|
|
+ <otherwise>null</otherwise>
|
|
|
+ </choose>,
|
|
|
+ 0, now(), now()
|
|
|
+ )
|
|
|
+ </foreach>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateQwSopTtDialog" parameterType="QwSopTtDialog">
|
|
|
+ update qw_sop_tt_call_detail
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="sopTtTaskId != null">sop_tt_task_id = #{sopTtTaskId},</if>
|
|
|
+ <if test="phone != null">phone = #{phone},</if>
|
|
|
+ <if test="userLogsId != null">user_logs_id = #{userLogsId},</if>
|
|
|
+ <if test="fsUserId != null">fs_user_id = #{fsUserId},</if>
|
|
|
+ <if test="externalId != null">external_id = #{externalId},</if>
|
|
|
+ <if test="qwUserKey != null">qw_user_key = #{qwUserKey},</if>
|
|
|
+ <if test="dialogId != null">dialog_id = #{dialogId},</if>
|
|
|
+ <if test="dialogName != null">dialog_name = #{dialogName},</if>
|
|
|
+ <if test="callStatus != null">call_status = #{callStatus},</if>
|
|
|
+ <if test="isAnswered != null">is_answered = #{isAnswered},</if>
|
|
|
+ <if test="callDuration != null">call_duration = #{callDuration},</if>
|
|
|
+ <if test="hangupReason != null">hangup_reason = #{hangupReason},</if>
|
|
|
+ <if test="callTime != null">call_time = #{callTime},</if>
|
|
|
+ <if test="sendStatus != null">send_status = #{sendStatus},</if>
|
|
|
+ <if test="sendTime != null">send_time = #{sendTime},</if>
|
|
|
+ <if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
+ </trim>
|
|
|
+ where id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <update id="updateQwSopTtDialogByTaskIdAndPhone" parameterType="QwSopTtDialog">
|
|
|
+ update qw_sop_tt_call_detail
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="callStatus != null">call_status = #{callStatus},</if>
|
|
|
+ <if test="isAnswered != null">is_answered = #{isAnswered},</if>
|
|
|
+ <if test="callDuration != null">call_duration = #{callDuration},</if>
|
|
|
+ <if test="hangupReason != null">hangup_reason = #{hangupReason},</if>
|
|
|
+ <if test="callTime != null">call_time = #{callTime},</if>
|
|
|
+ <if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
+ </trim>
|
|
|
+ where sop_tt_task_id = #{sopTtTaskId} and phone = #{phone}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <update id="batchUpdateCallResult" parameterType="list">
|
|
|
+ <foreach collection="list" item="item" separator=";">
|
|
|
+ update qw_sop_tt_call_detail
|
|
|
+ <set>
|
|
|
+ call_status = #{item.callStatus},
|
|
|
+ is_answered = #{item.isAnswered},
|
|
|
+ call_duration = #{item.callDuration},
|
|
|
+ hangup_reason = #{item.hangupReason},
|
|
|
+ call_time = #{item.callTime},
|
|
|
+ update_time = now()
|
|
|
+ </set>
|
|
|
+ where sop_tt_task_id = #{item.sopTtTaskId} and phone = #{item.phone}
|
|
|
+ </foreach>
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="deleteQwSopTtDialogById" parameterType="Long">
|
|
|
+ delete from qw_sop_tt_call_detail where id = #{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteQwSopTtDialogByIds" parameterType="Long">
|
|
|
+ delete from qw_sop_tt_call_detail where id in
|
|
|
+ <foreach item="id" collection="ids" open="(" separator="," close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteQwSopTtDialogByTaskId" parameterType="Long">
|
|
|
+ delete from qw_sop_tt_call_detail where sop_tt_task_id = #{sopTtTaskId}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <update id="batchUpdateQwSopTtDialogByIds" parameterType="QwSopTtDialog">
|
|
|
+ UPDATE qw_sop_tt_call_detail
|
|
|
+ <set>
|
|
|
+ <if test="sopTtTaskId != null">sop_tt_task_id = #{sopTtTaskId},</if>
|
|
|
+ <if test="phone != null">phone = #{phone},</if>
|
|
|
+ <if test="userLogsId != null">user_logs_id = #{userLogsId},</if>
|
|
|
+ <if test="fsUserId != null">fs_user_id = #{fsUserId},</if>
|
|
|
+ <if test="externalId != null">external_id = #{externalId},</if>
|
|
|
+ <if test="qwUserKey != null">qw_user_key = #{qwUserKey},</if>
|
|
|
+ <if test="dialogId != null">dialog_id = #{dialogId},</if>
|
|
|
+ <if test="dialogName != null and dialogName != ''">dialog_name = #{dialogName},</if>
|
|
|
+ <if test="callStatus != null">call_status = #{callStatus},</if>
|
|
|
+ <if test="isAnswered != null">is_answered = #{isAnswered},</if>
|
|
|
+ <if test="callDuration != null">call_duration = #{callDuration},</if>
|
|
|
+ <if test="hangupReason != null">hangup_reason = #{hangupReason},</if>
|
|
|
+ <if test="callTime != null">call_time = #{callTime},</if>
|
|
|
+ <if test="sendStatus != null">send_status = #{sendStatus},</if>
|
|
|
+ <if test="sendTime != null">send_time = #{sendTime},</if>
|
|
|
+ <if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
+ </set>
|
|
|
+ WHERE id IN
|
|
|
+ <foreach collection="ids" item="id" open="(" separator="," close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </update>
|
|
|
+</mapper>
|