<?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.ruoyi.system.mapper.NotifySendLogMapper">
|
|
<resultMap type="NotifySendLog" id="NotifySendLogResult">
|
<result property="id" column="id" />
|
<result property="notifyTaskId" column="notify_task_id"/>
|
<result property="taskId" column="task_id" />
|
<result property="userId" column="user_id" />
|
<result property="userName" column="user_name" />
|
<result property="notifyType" column="notify_type" />
|
<result property="channel" column="channel" />
|
<result property="sendStatus" column="send_status" />
|
<result property="sendContent" column="send_content" />
|
<result property="sendTime" column="send_time" />
|
<result property="sendResult" column="send_result" />
|
<result property="responseMsg" column="response_msg" />
|
<result property="retryCount" column="retry_count" />
|
<result property="createTime" column="create_time" />
|
<result property="createBy" column="create_by" />
|
<result property="updateTime" column="update_time" />
|
<result property="updateBy" column="update_by" />
|
<result property="remark" column="remark" />
|
</resultMap>
|
|
<sql id="selectNotifySendLogVo">
|
select id, notify_task_id, task_id, user_id, user_name, notify_type, channel, send_status,
|
send_content, send_time, send_result, response_msg, retry_count, create_time, create_by,
|
update_time, update_by, remark
|
from sys_notify_send_log
|
</sql>
|
|
<select id="selectNotifySendLogList" parameterType="NotifySendLog" resultMap="NotifySendLogResult">
|
<include refid="selectNotifySendLogVo"/>
|
<where>
|
<if test="taskId != null">
|
AND task_id = #{taskId}
|
</if>
|
<if test="userId != null">
|
AND user_id = #{userId}
|
</if>
|
<if test="userName != null and userName != ''">
|
AND user_name like concat('%', #{userName}, '%')
|
</if>
|
<if test="notifyType != null and notifyType != ''">
|
AND notify_type = #{notifyType}
|
</if>
|
<if test="channel != null and channel != ''">
|
AND channel = #{channel}
|
</if>
|
<if test="sendStatus != null and sendStatus != ''">
|
AND send_status = #{sendStatus}
|
</if>
|
<if test="params.beginSendTime != null and params.beginSendTime != ''">
|
AND send_time >= #{params.beginSendTime}
|
</if>
|
<if test="params.endSendTime != null and params.endSendTime != ''">
|
AND send_time <= #{params.endSendTime}
|
</if>
|
</where>
|
order by create_time desc
|
</select>
|
|
<select id="selectNotifySendLogById" parameterType="Long" resultMap="NotifySendLogResult">
|
<include refid="selectNotifySendLogVo"/>
|
where id = #{id}
|
</select>
|
|
<select id="checkNotifySendLogExists" resultType="int">
|
select count(1) from sys_notify_send_log
|
where task_id = #{taskId}
|
and user_id = #{userId}
|
and notify_type = #{notifyType}
|
and channel = #{channel}
|
</select>
|
|
<select id="selectNotifySendLog" resultMap="NotifySendLogResult">
|
<include refid="selectNotifySendLogVo"/>
|
where task_id = #{taskId}
|
and user_id = #{userId}
|
and notify_type = #{notifyType}
|
and channel = #{channel}
|
limit 1
|
</select>
|
|
<select id="selectFailedNotifySendLogs" resultMap="NotifySendLogResult">
|
<include refid="selectNotifySendLogVo"/>
|
where send_status = '2'
|
and retry_count < #{maxRetryCount}
|
order by create_time asc
|
limit 100
|
</select>
|
|
<insert id="insertNotifySendLog" parameterType="NotifySendLog" useGeneratedKeys="true" keyProperty="id">
|
insert into sys_notify_send_log
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="notifyTaskId != null">notify_task_id,</if>
|
<if test="taskId != null">task_id,</if>
|
<if test="userId != null">user_id,</if>
|
<if test="userName != null">user_name,</if>
|
<if test="notifyType != null and notifyType != ''">notify_type,</if>
|
<if test="channel != null and channel != ''">channel,</if>
|
<if test="sendStatus != null">send_status,</if>
|
<if test="sendContent != null">send_content,</if>
|
<if test="sendTime != null">send_time,</if>
|
<if test="sendResult != null">send_result,</if>
|
<if test="responseMsg != null">response_msg,</if>
|
<if test="retryCount != null">retry_count,</if>
|
<if test="createTime != null">create_time,</if>
|
<if test="createBy != null">create_by,</if>
|
<if test="updateTime != null">update_time,</if>
|
<if test="updateBy != null">update_by,</if>
|
<if test="remark != null">remark,</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="notifyTaskId != null">#{notifyTaskId},</if>
|
<if test="taskId != null">#{taskId},</if>
|
<if test="userId != null">#{userId},</if>
|
<if test="userName != null">#{userName},</if>
|
<if test="notifyType != null and notifyType != ''">#{notifyType},</if>
|
<if test="channel != null and channel != ''">#{channel},</if>
|
<if test="sendStatus != null">#{sendStatus},</if>
|
<if test="sendContent != null">#{sendContent},</if>
|
<if test="sendTime != null">#{sendTime},</if>
|
<if test="sendResult != null">#{sendResult},</if>
|
<if test="responseMsg != null">#{responseMsg},</if>
|
<if test="retryCount != null">#{retryCount},</if>
|
<if test="createTime != null">#{createTime},</if>
|
<if test="createBy != null">#{createBy},</if>
|
<if test="updateTime != null">#{updateTime},</if>
|
<if test="updateBy != null">#{updateBy},</if>
|
<if test="remark != null">#{remark},</if>
|
</trim>
|
</insert>
|
|
<update id="updateNotifySendLog" parameterType="NotifySendLog">
|
update sys_notify_send_log
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="taskId != null">task_id = #{taskId},</if>
|
<if test="userId != null">user_id = #{userId},</if>
|
<if test="userName != null">user_name = #{userName},</if>
|
<if test="notifyType != null and notifyType != ''">notify_type = #{notifyType},</if>
|
<if test="channel != null and channel != ''">channel = #{channel},</if>
|
<if test="sendStatus != null">send_status = #{sendStatus},</if>
|
<if test="sendContent != null">send_content = #{sendContent},</if>
|
<if test="sendTime != null">send_time = #{sendTime},</if>
|
<if test="sendResult != null">send_result = #{sendResult},</if>
|
<if test="retryCount != null">retry_count = #{retryCount},</if>
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
<if test="remark != null">remark = #{remark},</if>
|
</trim>
|
where id = #{id}
|
</update>
|
|
<update id="updateSendStatus">
|
update sys_notify_send_log
|
set send_status = #{sendStatus},
|
send_result = #{sendResult},
|
send_content = #{sendContent},
|
send_time = now(),
|
update_time = now(),
|
retry_count = retry_count + 1
|
where id = #{id}
|
</update>
|
|
<delete id="deleteNotifySendLogById" parameterType="Long">
|
delete from sys_notify_send_log where id = #{id}
|
</delete>
|
|
<delete id="deleteNotifySendLogByIds" parameterType="String">
|
delete from sys_notify_send_log where id in
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</delete>
|
</mapper>
|