send-message-log-mapper.xml 1.72 KB
<?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.cjs.cms.dao.pub.SendMessageLogDao">
	<sql id="send_message">
		id, phone_number, message, send_result, create_at,send_status
	</sql>
	
	 <sql id="searchCondition">
	    where 1 = 1
		<if test="phoneNumber != null and phoneNumber != ''">
			and phone_number like CONCAT('%',#{phoneNumber},'%')
		</if>
		<if test="message!=null and message!=''"> 
			and message like CONCAT('%',#{message},'%')
		</if>
		<if test="sendResult!=null and sendResult!=''">
			and send_result=#{sendResult}
		</if>
	</sql>
	
	<insert id="insertMegLog">
		insert into
		send_message_log(phone_number, message, send_result, create_at)
		values(#{phoneNumber}, #{message}, #{sendResult}, now())
	</insert>

	<select id="getSendMessageList" parameterType="java.util.Map"
		resultType="java.util.Map">
		select
		<include refid="send_message" />
		from send_message_log 
		<include refid="searchCondition" />
		order by create_at desc
		<include refid="common.pageLimit" />
	</select>

	<select id="getSendMessageCount" parameterType="java.util.Map"
		resultType="int">
		select count(*) from send_message_log
		<include refid="searchCondition" />
	</select>
	
	<update id="update" parameterType="java.util.Map">
		update send_message_log set send_status=#{sendStatus} , send_at
		=#{sendAt} where send_result=#{send_result}
	</update>
	
	<select id="queryByStatus" parameterType="java.util.Map"
		resultType="java.util.Map">
		select
		<include refid="send_message" />
		from send_message_log 
		where 1=1
		<if test="sendResult!=null and sendResult!=''">
			and send_result=#{sendResult}
		</if>
	</select>
</mapper>