| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415 |
- <?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.ruoyi.aicall.mapper.CcCallPhoneMapper">
-
- <resultMap type="CcCallPhone" id="CcCallPhoneResult">
- <result property="id" column="id" />
- <result property="batchId" column="batch_id" />
- <result property="batchName" column="batchName" />
- <result property="telephone" column="telephone" />
- <result property="custName" column="cust_name" />
- <result property="createtime" column="createtime" />
- <result property="callstatus" column="callstatus" />
- <result property="calloutTime" column="callout_time" />
- <result property="callcount" column="callcount" />
- <result property="callEndTime" column="call_end_time" />
- <result property="timeLen" column="time_len" />
- <result property="validTimeLen" column="valid_time_len" />
- <result property="uuid" column="uuid" />
- <result property="connectedTime" column="connected_time" />
- <result property="hangupCause" column="hangup_cause" />
- <result property="answeredTime" column="answered_time" />
- <result property="dialogue" column="dialogue" />
- <result property="wavfile" column="wavfile" />
- <result property="recordServerUrl" column="record_server_url" />
- <result property="bizJson" column="biz_json" />
- <result property="dialogueCount" column="dialogue_count" />
- <result property="acdOpnum" column="acd_opnum" />
- <result property="acdQueueTime" column="dialogue_count" />
- <result property="acdWaitTime" column="dialogue_count" />
- <result property="ttsText" column="tts_text" />
- <result property="intent" column="intent" />
- <result property="asrSeconds" column="asr_seconds" />
- <result property="ttsTimes" column="tts_times" />
- <result property="ttsFlowTokens" column="tts_flow_tokens" />
- <result property="inputTokens" column="input_tokens" />
- <result property="outputTokens" column="output_tokens" />
- <result property="totalCost" column="total_cost" />
- <result property="billingStatus" column="billing_status" />
- <result property="callerNumber" column="caller_number" />
- <result property="ivrDtmfDigits" column="ivr_dtmf_digits" />
- <result property="manualAnsweredTime" column="manual_answered_time" />
- <result property="manualAnsweredTimeLen" column="manual_answered_time_len" />
- </resultMap>
- <sql id="selectCcCallPhoneVo">
- select id, batch_id, telephone, cust_name, createtime, callstatus, callout_time,
- callcount, call_end_time, time_len, valid_time_len, uuid, connected_time,
- hangup_cause, answered_time, dialogue, wavfile, record_server_url, biz_json,
- dialogue_count, acd_opnum, acd_queue_time, acd_wait_time, tts_text, intent,
- asr_seconds, tts_times, tts_flow_tokens, input_tokens, output_tokens,
- total_cost, billing_status, caller_number, ivr_dtmf_digits, manual_answered_time, manual_answered_time_len from cc_call_phone
- </sql>
- <sql id="ccCallPhoneListWhere">
- <if test="uuid != null and uuid != '' "> and cp.uuid = #{uuid}</if>
- <if test="telephone != null and telephone != ''"> and cp.telephone = #{telephone}</if>
- <if test="custName != null and custName != ''"> and cp.cust_name = #{custName}</if>
- <if test="callstatus != null "> and cp.callstatus = #{callstatus}</if>
- <if test="params.calloutTimeStart != null and params.calloutTimeStart != ''"><!-- 开始时间检索 -->
- AND cp.callout_time >= #{params.calloutTimeStart}
- </if>
- <if test="params.calloutTimeEnd != null and params.calloutTimeEnd != ''"><!-- 结束时间检索 -->
- AND cp.callout_time <= #{params.calloutTimeEnd}
- </if>
- <if test="params.callEndTimeStart != null and params.callEndTimeStart != ''"><!-- 开始时间检索 -->
- AND cp.call_end_time >= #{params.callEndTimeStart}
- </if>
- <if test="params.callEndTimeEnd != null and params.callEndTimeEnd != ''"><!-- 结束时间检索 -->
- AND cp.call_end_time <= #{params.callEndTimeEnd}
- </if>
- <if test="params.timeLenStart != null and params.timeLenStart != ''"><!-- 开始时间检索 -->
- AND cp.time_len >= #{params.timeLenStart}
- </if>
- <if test="params.timeLenEnd != null and params.timeLenEnd != ''"><!-- 结束时间检索 -->
- AND cp.time_len <= #{params.timeLenEnd}
- </if>
- <if test="params.connectedTimeStart != null and params.connectedTimeStart != ''"><!-- 开始时间检索 -->
- AND cp.connected_time >= #{params.connectedTimeStart}
- </if>
- <if test="params.connectedTimeEnd != null and params.connectedTimeEnd != ''"><!-- 结束时间检索 -->
- AND cp.connected_time <= #{params.connectedTimeEnd}
- </if>
- <if test="params.answeredTimeStart != null and params.answeredTimeStart != ''"><!-- 开始时间检索 -->
- AND cp.answered_time >= #{params.answeredTimeStart}
- </if>
- <if test="params.answeredTimeEnd != null and params.answeredTimeEnd != ''"><!-- 结束时间检索 -->
- AND cp.answered_time <= #{params.answeredTimeEnd}
- </if>
- <if test="batchId != null">
- AND cp.batch_id = #{batchId}
- </if>
- <if test="params.batchIds != null and params.batchIds.size() > 0">
- AND cp.batch_id IN
- <foreach collection="params.batchIds" item="bid" open="(" separator="," close=")">
- #{bid}
- </foreach>
- </if>
- <if test="batchName != null and batchName != ''">
- AND EXISTS (
- SELECT 1 FROM cc_call_task ct
- WHERE ct.batch_id = cp.batch_id
- AND ct.batch_name like concat('%', #{batchName}, '%')
- )
- </if>
- <if test="intent != null and intent != ''">
- AND cp.intent = #{intent}
- </if>
- <if test="billingStatus != null ">
- and cp.billing_status = #{billingStatus}
- </if>
- <if test="callerNumber != null and callerNumber != '' ">
- and cp.caller_number = #{callerNumber}
- </if>
- AND cp.callstatus >= 3 AND cp.call_end_time > 0
- </sql>
- <!-- 列表完整查询(导出/API/计费等仍可用,含大字段) -->
- <select id="selectCcCallPhoneList" parameterType="CcCallPhone" resultMap="CcCallPhoneResult">
- select cp.*, ct.batch_name as batchName
- from cc_call_phone cp
- left join cc_call_task ct on cp.batch_id = ct.batch_id
- <where>
- <include refid="ccCallPhoneListWhere"/>
- </where>
- order by cp.call_end_time desc
- </select>
- <!-- 列表加速第1步:仅查 id,避免分页/COUNT 触碰 TEXT 大字段 -->
- <select id="selectCcCallPhoneIds" parameterType="CcCallPhone" resultType="java.lang.String">
- select cp.id
- from cc_call_phone cp
- <where>
- <include refid="ccCallPhoneListWhere"/>
- </where>
- order by cp.call_end_time desc
- </select>
- <!-- 列表加速第2步:按 id 回表列表展示字段(不含 dialogue/biz_json/tts_text) -->
- <select id="selectCcCallPhoneLiteByIds" resultMap="CcCallPhoneResult">
- select
- cp.id, cp.batch_id, cp.telephone, cp.cust_name, cp.createtime, cp.callstatus,
- cp.callout_time, cp.callcount, cp.call_end_time, cp.time_len, cp.valid_time_len,
- cp.uuid, cp.connected_time, cp.hangup_cause, cp.answered_time,
- cp.wavfile, cp.record_server_url, cp.dialogue_count, cp.acd_opnum,
- cp.acd_queue_time, cp.acd_wait_time, cp.intent, cp.caller_number,
- cp.ivr_dtmf_digits, cp.manual_answered_time, cp.manual_answered_time_len
- from cc_call_phone cp
- where cp.id in
- <foreach collection="ids" item="id" open="(" separator="," close=")">
- #{id}
- </foreach>
- order by field(cp.id,
- <foreach collection="ids" item="id" separator=",">
- #{id}
- </foreach>
- )
- </select>
- <select id="getCustIntentionList" parameterType="CcCallPhone" resultMap="CcCallPhoneResult">
- <include refid="selectCcCallPhoneVo"/>
- where intent = '' AND callstatus >= 3 AND call_end_time > 0 limit 100
- </select>
-
- <select id="selectCcCallPhoneById" parameterType="String" resultMap="CcCallPhoneResult">
- <include refid="selectCcCallPhoneVo"/>
- where id = #{id}
- </select>
- <insert id="insertCcCallPhone" parameterType="CcCallPhone">
- insert into cc_call_phone
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="id != null">id,</if>
- <if test="batchId != null">batch_id,</if>
- <if test="telephone != null and telephone != ''">telephone,</if>
- <if test="custName != null and custName != ''">cust_name,</if>
- <if test="createtime != null">createtime,</if>
- <if test="callstatus != null">callstatus,</if>
- <if test="calloutTime != null">callout_time,</if>
- <if test="callcount != null">callcount,</if>
- <if test="callEndTime != null">call_end_time,</if>
- <if test="timeLen != null">time_len,</if>
- <if test="validTimeLen != null">valid_time_len,</if>
- <if test="uuid != null and uuid != ''">uuid,</if>
- <if test="connectedTime != null">connected_time,</if>
- <if test="hangupCause != null and hangupCause != ''">hangup_cause,</if>
- <if test="answeredTime != null">answered_time,</if>
- <if test="dialogue != null">dialogue,</if>
- <if test="wavfile != null and wavfile != ''">wavfile,</if>
- <if test="recordServerUrl != null and recordServerUrl != ''">record_server_url,</if>
- <if test="bizJson != null and bizJson != ''">biz_json,</if>
- <if test="dialogueCount != null">dialogue_count,</if>
- <if test="acdOpnum != null and acdOpnum != ''">acd_opnum,</if>
- <if test="acdQueueTime != null">acd_queue_time,</if>
- <if test="acdWaitTime != null">acd_wait_time,</if>
- <if test="ttsText != null">tts_text,</if>
- <if test="intent != null">intent,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="id != null">#{id},</if>
- <if test="batchId != null">#{batchId},</if>
- <if test="telephone != null and telephone != ''">#{telephone},</if>
- <if test="custName != null and custName != ''">#{cust_name},</if>
- <if test="createtime != null">#{createtime},</if>
- <if test="callstatus != null">#{callstatus},</if>
- <if test="calloutTime != null">#{calloutTime},</if>
- <if test="callcount != null">#{callcount},</if>
- <if test="callEndTime != null">#{callEndTime},</if>
- <if test="timeLen != null">#{timeLen},</if>
- <if test="validTimeLen != null">#{validTimeLen},</if>
- <if test="uuid != null and uuid != ''">#{uuid},</if>
- <if test="connectedTime != null">#{connectedTime},</if>
- <if test="hangupCause != null and hangupCause != ''">#{hangupCause},</if>
- <if test="answeredTime != null">#{answeredTime},</if>
- <if test="dialogue != null">#{dialogue},</if>
- <if test="wavfile != null and wavfile != ''">#{wavfile},</if>
- <if test="recordServerUrl != null and recordServerUrl != ''">#{recordServerUrl},</if>
- <if test="bizJson != null and bizJson != ''">#{bizJson},</if>
- <if test="dialogueCount != null">#{dialogueCount},</if>
- <if test="acdOpnum != null and acdOpnum != ''">#{acdOpnum},</if>
- <if test="acdQueueTime != null">#{acdQueueTime},</if>
- <if test="acdWaitTime != null">#{acdWaitTime},</if>
- <if test="ttsText != null">#{ttsText},</if>
- <if test="intent != null">#{intent},</if>
- </trim>
- </insert>
- <update id="updateCcCallPhone" parameterType="CcCallPhone">
- update cc_call_phone
- <trim prefix="SET" suffixOverrides=",">
- <if test="batchId != null">batch_id = #{batchId},</if>
- <if test="telephone != null and telephone != ''">telephone = #{telephone},</if>
- <if test="custName != null and custName != ''">cust_name = #{custName},</if>
- <if test="createtime != null">createtime = #{createtime},</if>
- <if test="callstatus != null">callstatus = #{callstatus},</if>
- <if test="calloutTime != null">callout_time = #{calloutTime},</if>
- <if test="callcount != null">callcount = #{callcount},</if>
- <if test="callEndTime != null">call_end_time = #{callEndTime},</if>
- <if test="timeLen != null">time_len = #{timeLen},</if>
- <if test="validTimeLen != null">valid_time_len = #{validTimeLen},</if>
- <if test="uuid != null and uuid != ''">uuid = #{uuid},</if>
- <if test="connectedTime != null">connected_time = #{connectedTime},</if>
- <if test="hangupCause != null and hangupCause != ''">hangup_cause = #{hangupCause},</if>
- <if test="answeredTime != null">answered_time = #{answeredTime},</if>
- <if test="dialogue != null">dialogue = #{dialogue},</if>
- <if test="wavfile != null and wavfile != ''">wavfile = #{wavfile},</if>
- <if test="recordServerUrl != null and recordServerUrl != ''">record_server_url = #{recordServerUrl},</if>
- <if test="bizJson != null and bizJson != ''">biz_json = #{bizJson},</if>
- <if test="dialogueCount != null">dialogue_count = #{dialogueCount},</if>
- <if test="acdOpnum != null and acdOpnum != ''">acd_opnum = #{acdOpnum},</if>
- <if test="acdQueueTime != null">acd_queue_time = #{acdQueueTime},</if>
- <if test="acdWaitTime != null">acd_wait_time = #{acdWaitTime},</if>
- <if test="ttsText != null">tts_text = #{ttsText},</if>
- <if test="intent != null">intent = #{intent},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteCcCallPhoneById" parameterType="String">
- delete from cc_call_phone where id = #{id}
- </delete>
- <delete id="deleteCcCallPhoneByIds" parameterType="String">
- delete from cc_call_phone where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- <select id="statByBatchId" parameterType="Long" resultType="com.ruoyi.aicall.model.CallTaskStatModel">
- SELECT batch_id AS batchId,
- COUNT(1) AS phoneCount,
- SUM(CASE WHEN callout_time > 0 THEN 1 ELSE 0 END) AS callCount,
- SUM(CASE WHEN answered_time > 0 THEN 1 ELSE 0 END) AS connectCount
- FROM cc_call_phone
- WHERE batch_id = #{batchId}
- </select>
- <select id="statByBatchIds" resultType="com.ruoyi.aicall.model.CallTaskStatModel">
- SELECT batch_id AS batchId,
- COUNT(1) AS phoneCount,
- SUM(CASE WHEN callout_time > 0 THEN 1 ELSE 0 END) AS callCount,
- SUM(CASE WHEN answered_time > 0 THEN 1 ELSE 0 END) AS connectCount
- FROM cc_call_phone
- WHERE batch_id IN
- <foreach collection="batchIds" item="batchId" open="(" separator="," close=")">
- #{batchId}
- </foreach>
- GROUP BY batch_id
- </select>
- <insert id="batchInsertCcCallPhone" parameterType="java.util.List">
- INSERT INTO cc_call_phone (
- id, batch_id, telephone, cust_name, createtime, callstatus,
- callout_time, callcount, call_end_time, time_len, valid_time_len,
- uuid, connected_time, hangup_cause,
- answered_time, dialogue, wavfile, record_server_url, biz_json,
- dialogue_count,acd_opnum,acd_queue_time,acd_wait_time,
- tts_text, intent
- )
- VALUES
- <foreach collection="list" item="item" separator=",">
- (
- #{item.id}, #{item.batchId}, #{item.telephone}, #{item.custName},
- #{item.createtime}, #{item.callstatus}, #{item.calloutTime},
- #{item.callcount}, #{item.callEndTime}, #{item.timeLen},
- #{item.validTimeLen}, #{item.uuid},
- #{item.connectedTime}, #{item.hangupCause},
- #{item.answeredTime}, #{item.dialogue}, #{item.wavfile},
- #{item.recordServerUrl}, #{item.bizJson}, #{item.dialogueCount},
- #{item.acdOpnum}, #{item.acdQueueTime}, #{item.acdWaitTime},
- #{item.ttsText}, #{item.intent}
- )
- </foreach>
- </insert>
- <update id="updateIntentionByIds">
- UPDATE cc_call_phone
- SET intent = #{intention}
- WHERE id IN
- <foreach collection="phoneIds" item="id" open="(" separator="," close=")">
- #{id}
- </foreach>
- </update>
- <select id="selectNoHangupCalls" parameterType="Long" resultMap="CcCallPhoneResult">
- <include refid="selectCcCallPhoneVo"/>
- <where>
- AND batch_id = #{batchId}
- AND callstatus >= 2
- AND call_end_time = 0
- </where>
- order by call_end_time desc
- </select>
- <insert id="bakCallPhoneByBatchId" parameterType="Long">
- insert into his_cc_call_phone select * from cc_call_phone where batch_id = #{batchId}
- </insert>
- <delete id="delCallPhoneByBatchId" parameterType="Long">
- delete from cc_call_phone where batch_id = #{batchId}
- </delete>
- <select id="selectCcCallPhoneYlrzList" parameterType="CcCallPhone" resultMap="CcCallPhoneResult">
- select ccp.*, cct.batch_name as batchName from cc_call_phone ccp left join cc_call_task cct on cct.batch_id = ccp.batch_id
- <where>
- <if test="uuid != null and uuid != '' "> and ccp.uuid = #{uuid}</if>
- <if test="batchId != null "> and ccp.batch_id = #{batchId}</if>
- <if test="telephone != null and telephone != ''"> and ccp.telephone = #{telephone}</if>
- <if test="custName != null and custName != ''"> and ccp.cust_name = #{custName}</if>
- <if test="callstatus != null "> and ccp.callstatus = #{callstatus}</if>
- <if test="params.calloutTimeStart != null and params.calloutTimeStart != ''"><!-- 开始时间检索 -->
- AND ccp.callout_time >= #{params.calloutTimeStart}
- </if>
- <if test="params.calloutTimeEnd != null and params.calloutTimeEnd != ''"><!-- 结束时间检索 -->
- AND ccp.callout_time <= #{params.calloutTimeEnd}
- </if>
- <if test="params.callEndTimeStart != null and params.callEndTimeStart != ''"><!-- 开始时间检索 -->
- AND ccp.call_end_time >= #{params.callEndTimeStart}
- </if>
- <if test="params.callEndTimeEnd != null and params.callEndTimeEnd != ''"><!-- 结束时间检索 -->
- AND ccp.call_end_time <= #{params.callEndTimeEnd}
- </if>
- <if test="params.timeLenStart != null and params.timeLenStart != ''"><!-- 开始时间检索 -->
- AND ccp.time_len >= #{params.timeLenStart}
- </if>
- <if test="params.timeLenEnd != null and params.timeLenEnd != ''"><!-- 结束时间检索 -->
- AND ccp.time_len <= #{params.timeLenEnd}
- </if>
- <if test="params.connectedTimeStart != null and params.connectedTimeStart != ''"><!-- 开始时间检索 -->
- AND ccp.connected_time >= #{params.connectedTimeStart}
- </if>
- <if test="params.connectedTimeEnd != null and params.connectedTimeEnd != ''"><!-- 结束时间检索 -->
- AND ccp.connected_time <= #{connectedTimeEnd}
- </if>
- <if test="params.answeredTimeStart != null and params.answeredTimeStart != ''"><!-- 开始时间检索 -->
- AND ccp.answered_time >= #{params.answeredTimeStart}
- </if>
- <if test="params.answeredTimeEnd != null and params.answeredTimeEnd != ''"><!-- 结束时间检索 -->
- AND ccp.answered_time <= #{params.answeredTimeEnd}
- </if>
- <if test="batchId != null and batchId != ''">
- AND ccp.batch_id = #{batchId}
- </if>
- <if test="intent != null and intent != ''">
- AND ccp.intent = #{intent}
- </if>
- <if test="billingStatus != null ">
- and ccp.billing_status = #{billingStatus}
- </if>
- <if test="callerNumber != null and callerNumber != '' ">
- and ccp.caller_number = #{callerNumber}
- </if>
- AND ccp.callstatus >= 3 AND ccp.call_end_time > 0
- </where>
- order by ccp.call_end_time desc
- </select>
- <select id="selectCcCallPhoneListByIds" parameterType="java.util.List" resultMap="CcCallPhoneResult">
- <include refid="selectCcCallPhoneVo"/>
- where uuid is not null and id in
- <foreach item="id" collection="list" open="(" separator="," close=")">
- #{id}
- </foreach>
- </select>
- <select id="selectCcCallPhoneDialogueByUuid" resultType="java.lang.String">
- select dialogue from cc_call_phone where uuid = #{uuid} limit 1
- </select>
- </mapper>
|