|
|
@@ -0,0 +1,78 @@
|
|
|
+<?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.communication.mapper.CompanyCallGatewayLogMapper">
|
|
|
+
|
|
|
+ <sql id="callGatewayLogSelect">
|
|
|
+ select g.log_id as voice_id,
|
|
|
+ g.company_id,
|
|
|
+ g.company_user_id,
|
|
|
+ cast(json_unquote(json_extract(g.request_body, '$.calleeId')) as unsigned) as customer_id,
|
|
|
+ u.nick_name as user_nick_name,
|
|
|
+ crm.customer_name,
|
|
|
+ null as voice_url,
|
|
|
+ g.create_time as start_time,
|
|
|
+ null as finish_time,
|
|
|
+ g.caller_phone,
|
|
|
+ g.callee_phone,
|
|
|
+ coalesce(floor(g.duration_ms / 1000), 0) as times,
|
|
|
+ coalesce(g.billing_quantity, 0) as billing_time,
|
|
|
+ g.caller_phone as display_caller_number,
|
|
|
+ g.callee_phone as display_callee_number,
|
|
|
+ g.result_msg as remark,
|
|
|
+ crm.source,
|
|
|
+ g.create_time as create_time,
|
|
|
+ case when g.success = 1 then 1 else -1 end as status
|
|
|
+ from company_comm_gateway_log g
|
|
|
+ left join company_user u on u.user_id = g.company_user_id
|
|
|
+ left join crm_customer crm
|
|
|
+ on crm.customer_id = cast(json_unquote(json_extract(g.request_body, '$.calleeId')) as unsigned)
|
|
|
+ where g.api_type = 'call'
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectCallGatewayLogList" resultType="com.fs.company.vo.CompanyVoiceLogsVO">
|
|
|
+ <include refid="callGatewayLogSelect"/>
|
|
|
+ <if test="maps.companyId != null">
|
|
|
+ and g.company_id = #{maps.companyId}
|
|
|
+ </if>
|
|
|
+ <if test="maps.customerId != null">
|
|
|
+ and cast(json_unquote(json_extract(g.request_body, '$.calleeId')) as unsigned) = #{maps.customerId}
|
|
|
+ </if>
|
|
|
+ <if test="maps.userNickName != null and maps.userNickName != ''">
|
|
|
+ and u.nick_name like concat('%', #{maps.userNickName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.calleePhone != null and maps.calleePhone != ''">
|
|
|
+ and g.callee_phone like concat('%', #{maps.calleePhone}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="maps.gatewayId != null">
|
|
|
+ and (g.gateway_id = #{maps.gatewayId}
|
|
|
+ or cast(json_unquote(json_extract(g.request_body, '$.gatewayId')) as unsigned) = #{maps.gatewayId})
|
|
|
+ </if>
|
|
|
+ <if test="maps.status != null">
|
|
|
+ <choose>
|
|
|
+ <when test="maps.status == 1">
|
|
|
+ and g.success = 1
|
|
|
+ </when>
|
|
|
+ <when test="maps.status == 0">
|
|
|
+ and 1 = 0
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ and g.success = 0
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
+ <if test="maps.params != null and maps.params.beginTime != null and maps.params.beginTime != ''">
|
|
|
+ and date_format(g.create_time, '%y%m%d') >= date_format(#{maps.params.beginTime}, '%y%m%d')
|
|
|
+ and date_format(g.create_time, '%y%m%d') <= date_format(#{maps.params.endTime}, '%y%m%d')
|
|
|
+ </if>
|
|
|
+ <if test="maps.params != null and maps.params.dataScope != null and maps.params.dataScope != ''">
|
|
|
+ ${maps.params.dataScope}
|
|
|
+ </if>
|
|
|
+ order by g.log_id desc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectCallGatewayLogById" resultType="com.fs.company.vo.CompanyVoiceLogsVO">
|
|
|
+ <include refid="callGatewayLogSelect"/>
|
|
|
+ and g.log_id = #{logId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+</mapper>
|