| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- <?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.CompanyVoiceRoboticCallLogSendmsgMapper">
-
- <resultMap type="CompanyVoiceRoboticCallLogSendmsg" id="CompanyVoiceRoboticCallLogSendmsgResult">
- <result property="logId" column="log_id" />
- <result property="roboticId" column="robotic_id" />
- <result property="callerId" column="caller_id" />
- <result property="runTime" column="run_time" />
- <result property="runParam" column="run_param" />
- <result property="result" column="result" />
- <result property="status" column="status" />
- <result property="createTime" column="create_time" />
- <result property="companyId" column="company_id" />
- <result property="companyUserId" column="company_user_id" />
- <result property="tempId" column="temp_id" />
- <result property="cost" column="cost" />
- <result property="contentLen" column="content_len" />
- </resultMap>
- <sql id="selectCompanyVoiceRoboticCallLogSendmsgVo">
- select log_id, robotic_id, caller_id, run_time, run_param, result, status, create_time, company_id, company_user_id, temp_id, cost, content_len from company_voice_robotic_call_log_sendmsg
- </sql>
- <select id="selectCompanyVoiceRoboticCallLogSendmsgList" parameterType="CompanyVoiceRoboticCallLogSendmsg" resultMap="CompanyVoiceRoboticCallLogSendmsgResult">
- <include refid="selectCompanyVoiceRoboticCallLogSendmsgVo"/>
- <where>
- <if test="roboticId != null "> and robotic_id = #{roboticId}</if>
- <if test="callerId != null "> and caller_id = #{callerId}</if>
- <if test="runTime != null "> and run_time = #{runTime}</if>
- <if test="runParam != null and runParam != ''"> and run_param = #{runParam}</if>
- <if test="result != null and result != ''"> and result = #{result}</if>
- <if test="status != null "> and status = #{status}</if>
- <if test="companyId != null "> and company_id = #{companyId}</if>
- <if test="companyUserId != null "> and company_user_id = #{companyUserId}</if>
- <if test="tempId != null "> and temp_id = #{tempId}</if>
- <if test="cost != null "> and cost = #{cost}</if>
- <if test="contentLen != null "> and content_len = #{contentLen}</if>
- </where>
- </select>
- <select id="selectCompanyVoiceRoboticCallLogSendmsgGroupList" parameterType="CompanyVoiceRoboticCallLogSendmsg" resultType="com.fs.company.domain.CompanyVoiceRoboticCallLogSendmsg">
- select
- robotic_id,
- cvr.name,
- count(1) as totalRecordCount,
- sum(case when status = 1 then 1 else 0 end) as runningCount,
- sum(case when status = 2 then 1 else 0 end) as successCount,
- sum(case when status = 3 then 1 else 0 end) as failCount
- from company_voice_robotic_call_log_sendmsg msg
- left join company_voice_robotic cvr on cvr.id = msg.robotic_id
- <where>
- <if test="roboticId != null">and robotic_id = #{roboticId}</if>
- <if test="callerId != null">and caller_id = #{callerId}</if>
- <if test="runTime != null">and run_time = #{runTime}</if>
- <if test="runParam != null and runParam != ''">and run_param = #{runParam}</if>
- <if test="result != null and result != ''">and result = #{result}</if>
- <if test="status != null">and status = #{status}</if>
- <if test="companyId != null">and company_id = #{companyId}</if>
- <if test="companyUserId != null">and company_user_id = #{companyUserId}</if>
- <if test="tempId != null">and temp_id = #{tempId}</if>
- <if test="cost != null">and cost = #{cost}</if>
- <if test="contentLen != null">and content_len = #{contentLen}</if>
- </where>
- group by robotic_id
- </select>
-
- <select id="selectCompanyVoiceRoboticCallLogSendmsgByLogId" parameterType="Long" resultMap="CompanyVoiceRoboticCallLogSendmsgResult">
- <include refid="selectCompanyVoiceRoboticCallLogSendmsgVo"/>
- where log_id = #{logId}
- </select>
-
- <insert id="insertCompanyVoiceRoboticCallLogSendmsg" parameterType="CompanyVoiceRoboticCallLogSendmsg" useGeneratedKeys="true" keyProperty="logId">
- insert into company_voice_robotic_call_log_sendmsg
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="roboticId != null">robotic_id,</if>
- <if test="callerId != null">caller_id,</if>
- <if test="runTime != null">run_time,</if>
- <if test="runParam != null">run_param,</if>
- <if test="result != null">result,</if>
- <if test="status != null">status,</if>
- <if test="createTime != null">create_time,</if>
- <if test="companyId != null">company_id,</if>
- <if test="companyUserId != null">company_user_id,</if>
- <if test="tempId != null">temp_id,</if>
- <if test="cost != null">cost,</if>
- <if test="contentLen != null">content_len,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="roboticId != null">#{roboticId},</if>
- <if test="callerId != null">#{callerId},</if>
- <if test="runTime != null">#{runTime},</if>
- <if test="runParam != null">#{runParam},</if>
- <if test="result != null">#{result},</if>
- <if test="status != null">#{status},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="companyId != null">#{companyId},</if>
- <if test="companyUserId != null">#{companyUserId},</if>
- <if test="tempId != null">#{tempId},</if>
- <if test="cost != null">#{cost},</if>
- <if test="contentLen != null">#{contentLen},</if>
- </trim>
- </insert>
- <update id="updateCompanyVoiceRoboticCallLogSendmsg" parameterType="CompanyVoiceRoboticCallLogSendmsg">
- update company_voice_robotic_call_log_sendmsg
- <trim prefix="SET" suffixOverrides=",">
- <if test="roboticId != null">robotic_id = #{roboticId},</if>
- <if test="callerId != null">caller_id = #{callerId},</if>
- <if test="runTime != null">run_time = #{runTime},</if>
- <if test="runParam != null">run_param = #{runParam},</if>
- <if test="result != null">result = #{result},</if>
- <if test="status != null">status = #{status},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="companyId != null">company_id = #{companyId},</if>
- <if test="companyUserId != null">company_user_id = #{companyUserId},</if>
- <if test="tempId != null">temp_id = #{tempId},</if>
- <if test="cost != null">cost = #{cost},</if>
- <if test="contentLen != null">content_len = #{contentLen},</if>
- </trim>
- where log_id = #{logId}
- </update>
- <delete id="deleteCompanyVoiceRoboticCallLogSendmsgByLogId" parameterType="Long">
- delete from company_voice_robotic_call_log_sendmsg where log_id = #{logId}
- </delete>
- <delete id="deleteCompanyVoiceRoboticCallLogSendmsgByLogIds" parameterType="String">
- delete from company_voice_robotic_call_log_sendmsg where log_id in
- <foreach item="logId" collection="array" open="(" separator="," close=")">
- #{logId}
- </foreach>
- </delete>
- <select id="listByCallerIdAndRoboticId" resultType="com.fs.company.vo.CompanyVoiceRoboticCallLogSendmsgVO" parameterType="CompanyVoiceRoboticCallLogSendmsg">
- SELECT
- t1.*,
- t2.company_name,
- t3.nick_name as companyUserName,
- t4.title as smsTempName,
- cc.phone
- FROM company_voice_robotic_call_log_sendmsg t1
- left join company_voice_robotic_callees cc on cc.id = t1.caller_id
- left join company t2 on t1.company_id = t2.company_id
- left join company_user t3 on t3.user_id = t1.company_user_id
- left join company_sms_temp t4 on t4.temp_id = t1.temp_id
- where 1=1
- <if test="roboticId != null">and t1.robotic_id = #{roboticId}</if>
- <if test="callerId != null">and t1.caller_id = #{callerId}</if>
- <if test="callerIds != null and callerIds.size() > 0">
- AND t1.caller_id IN
- <foreach collection='callerIds' item='item' open='(' separator=',' close=')'>
- #{item}
- </foreach>
- </if>
- <if test="phone != null and phone != ''">
- and cc.phone like concat('%', #{phone}, '%')
- </if>
- </select>
- <select id="selectCompanyVoiceRoboticCallLogSendMsgCount" resultType="com.fs.company.vo.CompanyVoiceRoboticCallLogCount">
- select
- count(1) as recordCount,
- sum(case when status = 2 then 1 else 0 end) as successRecordCount,
- sum(case when run_time >= CURDATE() and run_time < DATE_ADD(CURDATE(), INTERVAL 1 DAY) then 1 else 0 end) as todayCount,
- sum(case when status = 2 and run_time >= CURDATE() and run_time < DATE_ADD(CURDATE(), INTERVAL 1 DAY) then 1 else 0 end) as todaySuccessCount
- from company_voice_robotic_call_log_sendmsg msg
- </select>
- </mapper>
|