|
|
@@ -0,0 +1,323 @@
|
|
|
+<?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.EasyCallInboundLlmMapper">
|
|
|
+
|
|
|
+ <resultMap id="InboundLlmResult" type="com.fs.company.vo.easycall.EasyCallInboundLlmVO">
|
|
|
+ <id property="id" column="id"/>
|
|
|
+ <result property="llmAccountId" column="llm_account_id"/>
|
|
|
+ <result property="inboundAlias" column="inbound_alias"/>
|
|
|
+ <result property="callee" column="callee"/>
|
|
|
+ <result property="voiceCode" column="voice_code"/>
|
|
|
+ <result property="voiceSource" column="voice_source"/>
|
|
|
+ <result property="serviceType" column="service_type"/>
|
|
|
+ <result property="asrProvider" column="asr_provider"/>
|
|
|
+ <result property="aiTransferType" column="ai_transfer_type"/>
|
|
|
+ <result property="aiTransferData" column="ai_transfer_data"/>
|
|
|
+ <result property="ivrId" column="ivr_id"/>
|
|
|
+ <result property="satisfSurveyIvrId" column="satisf_survey_ivr_id"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <resultMap id="LlmAccountResult" type="com.fs.company.vo.easycall.EasyCallLlmAccountVO">
|
|
|
+ <id property="id" column="id"/>
|
|
|
+ <result property="name" column="name"/>
|
|
|
+ <result property="accountJson" column="account_json"/>
|
|
|
+ <result property="accountEntity" column="account_entity"/>
|
|
|
+ <result property="providerClassName" column="provider_class_name"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <resultMap id="VoiceCodeResult" type="com.fs.company.vo.easycall.EasyCallVoiceCodeVO">
|
|
|
+ <result property="voiceCode" column="voice_code"/>
|
|
|
+ <result property="voiceName" column="voice_name"/>
|
|
|
+ <result property="voiceSource" column="voice_source"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <resultMap id="BizGroupResult" type="com.fs.company.vo.easycall.EasyCallBizGroupVO">
|
|
|
+ <result property="groupId" column="group_id"/>
|
|
|
+ <result property="bizGroupName" column="biz_group_name"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <resultMap id="GatewayResult" type="com.fs.company.vo.easycall.EasyCallGatewayVO">
|
|
|
+ <result property="id" column="id"/>
|
|
|
+ <result property="gwName" column="gw_name"/>
|
|
|
+ <result property="profileName" column="profile_name"/>
|
|
|
+ <result property="caller" column="caller"/>
|
|
|
+ <result property="calleePrefix" column="callee_prefix"/>
|
|
|
+ <result property="gwAddr" column="gw_addr"/>
|
|
|
+ <result property="codec" column="codec"/>
|
|
|
+ <result property="gwDesc" column="gw_desc"/>
|
|
|
+ <result property="purpose" column="purpose"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <resultMap id="IvrResult" type="com.fs.company.vo.easycall.EasyCallIvrVO">
|
|
|
+ <result property="id" column="id"/>
|
|
|
+ <result property="ivrNodeName" column="node_name"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="selectInboundLlmVo">
|
|
|
+ select id, llm_account_id, callee, voice_code, voice_source, service_type, asr_provider, ai_transfer_type, ai_transfer_data, ivr_id, satisf_survey_ivr_id, inbound_alias,call_back_url,fs_scene_type from cc_inbound_llm_account
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectInboundLlmList" parameterType="com.fs.company.vo.easycall.EasyCallInboundLlmVO" resultMap="InboundLlmResult">
|
|
|
+ <include refid="selectInboundLlmVo"/>
|
|
|
+ <where>
|
|
|
+ <if test="llmAccountId != null">and llm_account_id = #{llmAccountId}</if>
|
|
|
+ <if test="callee != null and callee != ''">and callee = #{callee}</if>
|
|
|
+ <if test="inboundAlias != null and inboundAlias != ''">and inbound_alias = #{inboundAlias}</if>
|
|
|
+ <if test="voiceCode != null and voiceCode != ''">and voice_code = #{voiceCode}</if>
|
|
|
+ <if test="voiceSource != null and voiceSource != ''">and voice_source = #{voiceSource}</if>
|
|
|
+ <if test="serviceType != null and serviceType != ''">and service_type = #{serviceType}</if>
|
|
|
+ <if test="asrProvider != null and asrProvider != ''">and asr_provider = #{asrProvider}</if>
|
|
|
+ <if test="aiTransferType != null and aiTransferType != ''">and ai_transfer_type = #{aiTransferType}</if>
|
|
|
+ <if test="aiTransferData != null and aiTransferData != ''">and ai_transfer_data = #{aiTransferData}</if>
|
|
|
+ <if test="visibleIds != null ">
|
|
|
+ <if test="visibleIds.size() > 0">
|
|
|
+ and id in
|
|
|
+ <foreach item="item" collection="visibleIds" index="index" separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ order by id desc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectInboundLlmById" parameterType="Integer" resultMap="InboundLlmResult">
|
|
|
+ <include refid="selectInboundLlmVo"/>
|
|
|
+ where id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectInboundLlmByCallee" parameterType="String" resultMap="InboundLlmResult">
|
|
|
+ <include refid="selectInboundLlmVo"/>
|
|
|
+ where callee = #{callee}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertInboundLlm" parameterType="com.fs.company.vo.easycall.EasyCallInboundLlmVO" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
|
|
|
+ insert into cc_inbound_llm_account
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="id != null">id,</if>
|
|
|
+ <if test="llmAccountId != null">llm_account_id,</if>
|
|
|
+ <if test="callee != null and callee != ''">callee,</if>
|
|
|
+ <if test="inboundAlias != null and inboundAlias != ''">inbound_alias,</if>
|
|
|
+ <if test="voiceCode != null and voiceCode != ''">voice_code,</if>
|
|
|
+ <if test="voiceSource != null and voiceSource != ''">voice_source,</if>
|
|
|
+ <if test="serviceType != null and serviceType != ''">service_type,</if>
|
|
|
+ <if test="asrProvider != null and asrProvider != ''">asr_provider,</if>
|
|
|
+ <if test="aiTransferType != null and aiTransferType != ''">ai_transfer_type,</if>
|
|
|
+ <if test="aiTransferData != null and aiTransferData != ''">ai_transfer_data,</if>
|
|
|
+ <if test="ivrId != null">ivr_id,</if>
|
|
|
+ <if test="satisfSurveyIvrId != null">satisf_survey_ivr_id,</if>
|
|
|
+ <if test="companyId != null">fs_company_id,</if>
|
|
|
+ <if test="callBackUrl != null">call_back_url,</if>
|
|
|
+ <if test="fsSceneType != null">fs_scene_type,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="id != null">#{id},</if>
|
|
|
+ <if test="llmAccountId != null">#{llmAccountId},</if>
|
|
|
+ <if test="callee != null and callee != ''">#{callee},</if>
|
|
|
+ <if test="inboundAlias != null and inboundAlias != ''">#{inboundAlias},</if>
|
|
|
+ <if test="voiceCode != null and voiceCode != ''">#{voiceCode},</if>
|
|
|
+ <if test="voiceSource != null and voiceSource != ''">#{voiceSource},</if>
|
|
|
+ <if test="serviceType != null and serviceType != ''">#{serviceType},</if>
|
|
|
+ <if test="asrProvider != null and asrProvider != ''">#{asrProvider},</if>
|
|
|
+ <if test="aiTransferType != null and aiTransferType != ''">#{aiTransferType},</if>
|
|
|
+ <if test="aiTransferData != null and aiTransferData != ''">#{aiTransferData},</if>
|
|
|
+ <if test="ivrId != null">#{ivrId},</if>
|
|
|
+ <if test="satisfSurveyIvrId != null">#{satisfSurveyIvrId},</if>
|
|
|
+ <if test="companyId != null">#{companyId},</if>
|
|
|
+ <if test="callBackUrl != null">#{callBackUrl},</if>
|
|
|
+ <if test="fsSceneType != null">#{fsSceneType},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateInboundLlm" parameterType="com.fs.company.vo.easycall.EasyCallInboundLlmVO">
|
|
|
+ update cc_inbound_llm_account
|
|
|
+ <set>
|
|
|
+ <if test="llmAccountId != null">llm_account_id = #{llmAccountId},</if>
|
|
|
+ <if test="callee != null and callee != ''">callee = #{callee},</if>
|
|
|
+ <if test="inboundAlias != null and inboundAlias != ''">inbound_alias = #{inboundAlias},</if>
|
|
|
+ <if test="voiceCode != null and voiceCode != ''">voice_code = #{voiceCode},</if>
|
|
|
+ <if test="voiceSource != null and voiceSource != ''">voice_source = #{voiceSource},</if>
|
|
|
+ <if test="serviceType != null and serviceType != ''">service_type = #{serviceType},</if>
|
|
|
+ <if test="asrProvider != null and asrProvider != ''">asr_provider = #{asrProvider},</if>
|
|
|
+ <if test="aiTransferType != null and aiTransferType != ''">ai_transfer_type = #{aiTransferType},</if>
|
|
|
+ <if test="aiTransferData != null and aiTransferData != ''">ai_transfer_data = #{aiTransferData},</if>
|
|
|
+ <if test="ivrId != null">ivr_id = #{ivrId},</if>
|
|
|
+ <if test="satisfSurveyIvrId != null">satisf_survey_ivr_id = #{satisfSurveyIvrId},</if>
|
|
|
+ <if test="callBackUrl != null">call_back_url = #{callBackUrl},</if>
|
|
|
+ <if test="fsSceneType != null">fs_scene_type = #{fsSceneType},</if>
|
|
|
+ </set>
|
|
|
+ where id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="deleteInboundLlmById" parameterType="Integer">
|
|
|
+ delete from cc_inbound_llm_account where id = #{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteInboundLlmByIds" parameterType="String">
|
|
|
+ delete from cc_inbound_llm_account where id in
|
|
|
+ <foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <select id="selectLlmAccountList" resultMap="LlmAccountResult">
|
|
|
+ select id, name, account_json, account_entity, provider_class_name
|
|
|
+ from cc_llm_agent_account
|
|
|
+ <where>
|
|
|
+ <if test="modelsId != null and modelsId.size() > 0"> and id in
|
|
|
+ <foreach item="modelId" collection="modelsId" open="(" separator="," close=")">
|
|
|
+ #{modelId}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ order by id desc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectLlmAccountById" parameterType="Integer" resultMap="LlmAccountResult">
|
|
|
+ select id, name, account_json, account_entity, provider_class_name
|
|
|
+ from cc_llm_agent_account
|
|
|
+ where id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectVoiceCodeByCode" parameterType="String" resultMap="VoiceCodeResult">
|
|
|
+ select voice_code, voice_name, voice_source
|
|
|
+ from cc_tts_aliyun
|
|
|
+ where voice_code = #{voiceCode}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 查询ASR提供商列表 -->
|
|
|
+ <select id="selectAsrProviderList" resultType="java.util.Map">
|
|
|
+ select distinct provider as 'key', provider as 'value'
|
|
|
+ from cc_tts_aliyun
|
|
|
+ where provider is not null and provider != ''
|
|
|
+ order by provider
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 查询TTS音色来源列表 -->
|
|
|
+ <select id="selectVoiceSourceList" resultType="java.util.Map">
|
|
|
+ select distinct voice_source as 'key', voice_source as 'value'
|
|
|
+ from cc_tts_aliyun
|
|
|
+ where voice_source is not null and voice_source != ''
|
|
|
+ order by voice_source
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 根据音色来源查询音色列表 -->
|
|
|
+ <select id="selectVoiceListBySource" parameterType="String" resultMap="VoiceCodeResult">
|
|
|
+ select voice_code, voice_name, voice_source
|
|
|
+ from cc_tts_aliyun
|
|
|
+ where voice_source = #{voiceSource}
|
|
|
+ and voice_enabled = 1
|
|
|
+ order by priority, id
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 查询业务组列表 -->
|
|
|
+ <select id="selectBizGroupList" resultMap="BizGroupResult">
|
|
|
+ select group_id, biz_group_name
|
|
|
+ from cc_biz_group
|
|
|
+ order by sort_no, group_id
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 查询出局网关列表 -->
|
|
|
+ <select id="selectOutboundGatewayList" resultMap="GatewayResult">
|
|
|
+ select id, gw_name, profile_name, caller, callee_prefix, gw_addr, codec, gw_desc, purpose
|
|
|
+ from cc_gateways
|
|
|
+ where purpose in (2, 3)
|
|
|
+ order by id
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 查询IVR列表 -->
|
|
|
+ <select id="selectIvrList" resultMap="IvrResult">
|
|
|
+ select id, node_name
|
|
|
+ from cc_ivr
|
|
|
+ order by id
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <resultMap type="com.fs.company.domain.EasyCallInboundCdrVO" id="EasyCallInboundCdrResult">
|
|
|
+ <result property="id" column="id" />
|
|
|
+ <result property="caller" column="caller" />
|
|
|
+ <result property="callee" column="callee" />
|
|
|
+ <result property="inboundTime" column="inbound_time" />
|
|
|
+ <result property="groupId" column="group_id" />
|
|
|
+ <result property="answeredTime" column="answered_time" />
|
|
|
+ <result property="extnum" column="extnum" />
|
|
|
+ <result property="opnum" column="opnum" />
|
|
|
+ <result property="hangupTime" column="hangup_time" />
|
|
|
+ <result property="answeredTimeLen" column="answered_time_len" />
|
|
|
+ <result property="timeLen" column="time_len" />
|
|
|
+ <result property="uuid" column="uuid" />
|
|
|
+ <result property="wavFile" column="wav_file" />
|
|
|
+ <result property="chatContent" column="chat_content" />
|
|
|
+ <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="ivrDtmfDigits" column="ivr_dtmf_digits" />
|
|
|
+ <result property="hangupCause" column="hangup_cause" />
|
|
|
+ <result property="manualAnsweredTime" column="manual_answered_time" />
|
|
|
+ <result property="manualAnsweredTimeLen" column="manual_answered_time_len" />
|
|
|
+ <result property="groupName" column="group_name" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <select id="selectInboundCdrList" parameterType="com.fs.company.domain.EasyCallInboundCdrVO" resultMap="EasyCallInboundCdrResult">
|
|
|
+ select c.id, c.caller, c.callee, c.inbound_time, c.group_id, c.answered_time, c.extnum, c.opnum,
|
|
|
+ c.hangup_time, c.answered_time_len, c.time_len, c.uuid, c.wav_file, c.chat_content,
|
|
|
+ c.asr_seconds, c.tts_times, c.tts_flow_tokens, c.input_tokens, c.output_tokens,
|
|
|
+ c.total_cost, c.billing_status, c.ivr_dtmf_digits, c.hangup_cause,
|
|
|
+ c.manual_answered_time, c.manual_answered_time_len,
|
|
|
+ g.biz_group_name as group_name
|
|
|
+ from cc_inbound_cdr c
|
|
|
+ LEFT JOIN cc_biz_group g ON c.group_id = g.group_id
|
|
|
+ <where>
|
|
|
+ c.hangup_time > 0
|
|
|
+ <if test="uuid != null and uuid != ''"> and c.uuid = #{uuid}</if>
|
|
|
+ <if test="caller != null and caller != ''"> and c.caller = #{caller}</if>
|
|
|
+ <if test="callee != null and callee != ''"> and c.callee = #{callee}</if>
|
|
|
+ <if test="extnum != null and extnum != ''"> and c.extnum = #{extnum}</if>
|
|
|
+ <if test="opnum != null and opnum != ''"> and c.opnum = #{opnum}</if>
|
|
|
+ <if test="groupId != null and groupId != ''"> and c.group_id = #{groupId}</if>
|
|
|
+ <if test="billingStatus != null"> and c.billing_status = #{billingStatus}</if>
|
|
|
+ <!-- 呼入时间范围 -->
|
|
|
+ <if test="params != null and params.inboundTimeStart != null">
|
|
|
+ and c.inbound_time >= #{params.inboundTimeStart}
|
|
|
+ </if>
|
|
|
+ <if test="params != null and params.inboundTimeEnd != null">
|
|
|
+ and c.inbound_time <= #{params.inboundTimeEnd}
|
|
|
+ </if>
|
|
|
+ <!-- 接听时间范围 -->
|
|
|
+ <if test="params != null and params.answeredTimeStart != null">
|
|
|
+ and c.answered_time >= #{params.answeredTimeStart}
|
|
|
+ </if>
|
|
|
+ <if test="params != null and params.answeredTimeEnd != null">
|
|
|
+ and c.answered_time <= #{params.answeredTimeEnd}
|
|
|
+ </if>
|
|
|
+ <!-- 挂机时间范围 -->
|
|
|
+ <if test="params != null and params.hangupTimeStart != null">
|
|
|
+ and c.hangup_time >= #{params.hangupTimeStart}
|
|
|
+ </if>
|
|
|
+ <if test="params != null and params.hangupTimeEnd != null">
|
|
|
+ and c.hangup_time <= #{params.hangupTimeEnd}
|
|
|
+ </if>
|
|
|
+ <!-- 通话时长范围 -->
|
|
|
+ <if test="params != null and params.timeLenStart != null">
|
|
|
+ and c.time_len >= #{params.timeLenStart}
|
|
|
+ </if>
|
|
|
+ <if test="params != null and params.timeLenEnd != null">
|
|
|
+ and c.time_len <= #{params.timeLenEnd}
|
|
|
+ </if>
|
|
|
+ <!-- 多租户隔离:可见被叫号码过滤 -->
|
|
|
+ <if test="visibleCallees != null and visibleCallees.size() > 0">
|
|
|
+ and c.callee in
|
|
|
+ <foreach item="calleeItem" collection="visibleCallees" open="(" separator="," close=")">
|
|
|
+ #{calleeItem}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ order by c.hangup_time desc
|
|
|
+ </select>
|
|
|
+
|
|
|
+</mapper>
|