| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- <?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.CompanySmsLogsMapper">
- <resultMap type="CompanySmsLogs" id="CompanySmsLogsResult">
- <result property="logsId" column="logs_id" />
- <result property="companyId" column="company_id" />
- <result property="companyUserId" column="company_user_id" />
- <result property="customerId" column="customer_id" />
- <result property="tempId" column="temp_id" />
- <result property="tempCode" column="temp_code" />
- <result property="phone" column="phone" />
- <result property="content" column="content" />
- <result property="createTime" column="create_time" />
- <result property="sendTime" column="send_time" />
- <result property="status" column="status" />
- <result property="mid" column="mid" />
- <result property="stat" column="stat" />
- <result property="replyContent" column="reply_content" />
- <result property="number" column="number" />
- <result property="type" column="type" />
- <result property="apiId" column="api_id" />
- <result property="portId" column="port_id" />
- </resultMap>
- <sql id="selectCompanySmsLogsVo">
- select logs_id, company_id,type, company_user_id, customer_id, temp_id, temp_code, phone, content, create_time, send_time, status,mid,stat,reply_content,number,api_id,port_id from company_sms_logs
- </sql>
- <select id="selectCompanySmsLogsById" resultMap="CompanySmsLogsResult">
- <include refid="selectCompanySmsLogsVo"/>
- where logs_id = #{logsId}
- </select>
- <insert id="insertCompanySmsLogs" useGeneratedKeys="true" keyProperty="logsId">
- insert into company_sms_logs
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="companyId != null">company_id,</if>
- <if test="companyUserId != null">company_user_id,</if>
- <if test="customerId != null">customer_id,</if>
- <if test="tempId != null">temp_id,</if>
- <if test="tempCode != null">temp_code,</if>
- <if test="phone != null">phone,</if>
- <if test="content != null">content,</if>
- <if test="createTime != null">create_time,</if>
- <if test="sendTime != null">send_time,</if>
- <if test="status != null">status,</if>
- <if test="mid != null">mid,</if>
- <if test="stat != null">stat,</if>
- <if test="replyContent != null">reply_content,</if>
- <if test="number != null">number,</if>
- <if test="type != null">type,</if>
- <if test="apiId != null">api_id,</if>
- <if test="portId != null">port_id,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="companyId != null">#{companyId},</if>
- <if test="companyUserId != null">#{companyUserId},</if>
- <if test="customerId != null">#{customerId},</if>
- <if test="tempId != null">#{tempId},</if>
- <if test="tempCode != null">#{tempCode},</if>
- <if test="phone != null">#{phone},</if>
- <if test="content != null">#{content},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="sendTime != null">#{sendTime},</if>
- <if test="status != null">#{status},</if>
- <if test="mid != null">#{mid},</if>
- <if test="stat != null">#{stat},</if>
- <if test="replyContent != null">#{replyContent},</if>
- <if test="number != null">#{number},</if>
- <if test="type != null">#{type},</if>
- <if test="apiId != null">#{apiId},</if>
- <if test="portId != null">#{portId},</if>
- </trim>
- </insert>
- <update id="updateCompanySmsLogs">
- update company_sms_logs
- <trim prefix="SET" suffixOverrides=",">
- <if test="companyId != null">company_id = #{companyId},</if>
- <if test="companyUserId != null">company_user_id = #{companyUserId},</if>
- <if test="customerId != null">customer_id = #{customerId},</if>
- <if test="tempId != null">temp_id = #{tempId},</if>
- <if test="tempCode != null">temp_code = #{tempCode},</if>
- <if test="phone != null">phone = #{phone},</if>
- <if test="content != null">content = #{content},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="sendTime != null">send_time = #{sendTime},</if>
- <if test="status != null">status = #{status},</if>
- <if test="mid != null">mid = #{mid},</if>
- <if test="stat != null">stat = #{stat},</if>
- <if test="replyContent != null">reply_content = #{replyContent},</if>
- <if test="number != null">number = #{number},</if>
- <if test="type != null">type = #{type},</if>
- <if test="apiId != null">api_id = #{apiId},</if>
- <if test="portId != null">port_id = #{portId},</if>
- </trim>
- where logs_id = #{logsId}
- </update>
- <delete id="deleteCompanySmsLogsById">
- delete from company_sms_logs where logs_id = #{logsId}
- </delete>
- <delete id="deleteCompanySmsLogsByIds">
- delete from company_sms_logs where logs_id in
- <foreach item="logsId" collection="array" open="(" separator="," close=")">
- #{logsId}
- </foreach>
- </delete>
- <select id="selectSmsLogsCounts" resultType="com.alibaba.fastjson.JSONObject">
- SELECT count(t.company_user_id ) AS smsCount,count( IF ( t.status =1,1, NULL ) ) AS successCount, t.type
- FROM
- (
- SELECT DATE_FORMAT( s.create_time, #{sqlDateFormat} ) AS type, s.company_user_id,s.status
- FROM
- company_sms_logs AS s
- WHERE
- (DATE_FORMAT(s.create_time,#{sqlDateFormat}) between #{beginTime} and #{finalTime})
- AND s.company_user_id IN
- <foreach item="item" collection="userIds" open="(" separator="," close=")">
- #{item}
- </foreach>
- ) t
- GROUP BY t.type
- </select>
- </mapper>
|