|
|
@@ -5,84 +5,151 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<mapper namespace="org.dromara.business.mapper.MessageReceiversMapper">
|
|
|
|
|
|
|
|
|
+ <!-- 查询分页 VO -->
|
|
|
<select id="selectVoPage" resultType="org.dromara.business.domain.vo.MessageReceiversVo">
|
|
|
SELECT
|
|
|
- id, message_id, user_id, read_status, read_time, created_at, updated_at
|
|
|
- FROM message_receivers ${ew.customSqlSegment}
|
|
|
+ id,
|
|
|
+ user_id,
|
|
|
+ title,
|
|
|
+ content,
|
|
|
+ target_type,
|
|
|
+ reward_id,
|
|
|
+ template_code,
|
|
|
+ message_type,
|
|
|
+ create_by,
|
|
|
+ send_time,
|
|
|
+ created_at,
|
|
|
+ updated_at,
|
|
|
+ send_name
|
|
|
+ FROM message_receivers
|
|
|
+ ${ew.customSqlSegment}
|
|
|
</select>
|
|
|
|
|
|
-
|
|
|
+ <!-- 查询列表 -->
|
|
|
<select id="selectMessagesReceiversList" resultType="org.dromara.business.domain.vo.MessageReceiversVo">
|
|
|
SELECT
|
|
|
- id, message_id, user_id, read_status, read_time, created_at, updated_at
|
|
|
- FROM message_receivers ${ew.customSqlSegment}
|
|
|
+ id,
|
|
|
+ user_id,
|
|
|
+ title,
|
|
|
+ content,
|
|
|
+ target_type,
|
|
|
+ reward_id,
|
|
|
+ template_code,
|
|
|
+ message_type,
|
|
|
+ create_by,
|
|
|
+ send_time,
|
|
|
+ created_at,
|
|
|
+ updated_at,
|
|
|
+ send_name
|
|
|
+ FROM message_receivers
|
|
|
+ ${ew.customSqlSegment}
|
|
|
</select>
|
|
|
|
|
|
+ <!-- 根据 ID 查询详情 -->
|
|
|
<select id="selectVoInfoById" resultType="org.dromara.business.domain.vo.MessageReceiversVo">
|
|
|
SELECT
|
|
|
- id, message_id, user_id, read_status, read_time, created_at, updated_at
|
|
|
- FROM message_receivers WHERE id = #{id}
|
|
|
+ id,
|
|
|
+ user_id,
|
|
|
+ title,
|
|
|
+ content,
|
|
|
+ target_type,
|
|
|
+ reward_id,
|
|
|
+ template_code,
|
|
|
+ message_type,
|
|
|
+ create_by,
|
|
|
+ send_time,
|
|
|
+ created_at,
|
|
|
+ updated_at,
|
|
|
+ send_name
|
|
|
+ FROM message_receivers
|
|
|
+ WHERE id = #{id}
|
|
|
</select>
|
|
|
|
|
|
+
|
|
|
<update id="updateMessageReceiver">
|
|
|
UPDATE message_receivers
|
|
|
<set>
|
|
|
- <if test="readStatus != null">read_status = #{readStatus},</if>
|
|
|
- read_time=now()
|
|
|
+ <if test="title != null">title = #{title},</if>
|
|
|
+ <if test="content != null">content = #{content},</if>
|
|
|
+ updated_at = now()
|
|
|
</set>
|
|
|
WHERE id = #{id}
|
|
|
</update>
|
|
|
|
|
|
- <insert id="insertMessageReceiver" useGeneratedKeys="true" keyProperty="id">
|
|
|
+ <!-- 插入单条记录 -->
|
|
|
+ <insert id="insertMessageReceiver" useGeneratedKeys="true" keyProperty="id">
|
|
|
INSERT INTO message_receivers
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
- <if test="messageId != null">message_id,</if>
|
|
|
<if test="userId != null">user_id,</if>
|
|
|
- <if test="readStatus != null">read_status,</if>
|
|
|
- <if test="readTime != null">read_time,</if>
|
|
|
+ <if test="title != null">title,</if>
|
|
|
+ <if test="content != null">content,</if>
|
|
|
+ <if test="targetType != null">target_type,</if>
|
|
|
+ <if test="rewardId != null">reward_id,</if>
|
|
|
+ <if test="templateCode != null">template_code,</if>
|
|
|
+ <if test="messageType != null">message_type,</if>
|
|
|
+ <if test="createBy != null">create_by,</if>
|
|
|
+ <if test="sendTime != null">send_time,</if>
|
|
|
+ <if test="sendName != null">send_name,</if>
|
|
|
</trim>
|
|
|
VALUES
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
- <if test="messageId != null">#{messageId},</if>
|
|
|
<if test="userId != null">#{userId},</if>
|
|
|
- <if test="readStatus != null">#{readStatus},</if>
|
|
|
- <if test="readTime != null">#{readTime},</if>
|
|
|
+ <if test="title != null">#{title},</if>
|
|
|
+ <if test="content != null">#{content},</if>
|
|
|
+ <if test="targetType != null">#{targetType},</if>
|
|
|
+ <if test="rewardId != null">#{rewardId},</if>
|
|
|
+ <if test="templateCode != null">#{templateCode},</if>
|
|
|
+ <if test="messageType != null">#{messageType},</if>
|
|
|
+ <if test="createBy != null">#{createBy},</if>
|
|
|
+ <if test="sendTime != null">#{sendTime},</if>
|
|
|
+ <if test="sendName != null">#{sendName},</if>
|
|
|
</trim>
|
|
|
</insert>
|
|
|
|
|
|
-
|
|
|
- <delete id="deleteMessageReceiversById">
|
|
|
- DELETE FROM message_receivers
|
|
|
- <where>
|
|
|
- id IN
|
|
|
- <foreach item="id" collection="ids" open="(" separator="," close=")">
|
|
|
- <if test="id > 0">
|
|
|
- #{id}
|
|
|
- </if>
|
|
|
- </foreach>
|
|
|
- </where>
|
|
|
- </delete>
|
|
|
-
|
|
|
+ <!-- 批量插入 -->
|
|
|
<insert id="batchInsertMessageReceiver">
|
|
|
INSERT INTO message_receivers
|
|
|
<!-- 动态生成列名 -->
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
- <if test="list[0].messageId != null">message_id,</if>
|
|
|
<if test="list[0].userId != null">user_id,</if>
|
|
|
- <if test="list[0].readStatus != null">read_status,</if>
|
|
|
- <if test="list[0].readTime != null">read_time,</if>
|
|
|
+ <if test="list[0].title != null">title,</if>
|
|
|
+ <if test="list[0].content != null">content,</if>
|
|
|
+ <if test="list[0].targetType != null">target_type,</if>
|
|
|
+ <if test="list[0].rewardId != null">reward_id,</if>
|
|
|
+ <if test="list[0].templateCode != null">template_code,</if>
|
|
|
+ <if test="list[0].messageType != null">message_type,</if>
|
|
|
+ <if test="list[0].createBy != null">create_by,</if>
|
|
|
+ <if test="list[0].sendTime != null">send_time,</if>
|
|
|
</trim>
|
|
|
<!-- 动态生成每条记录的值 -->
|
|
|
VALUES
|
|
|
<foreach collection="list" item="item" separator=",">
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
- <if test="item.messageId != null">#{item.messageId},</if>
|
|
|
<if test="item.userId != null">#{item.userId},</if>
|
|
|
- <if test="item.readStatus != null">#{item.readStatus},</if>
|
|
|
- <if test="item.readTime != null">#{item.readTime},</if>
|
|
|
+ <if test="item.title != null">#{item.title},</if>
|
|
|
+ <if test="item.content != null">#{item.content},</if>
|
|
|
+ <if test="item.targetType != null">#{item.targetType},</if>
|
|
|
+ <if test="item.rewardId != null">#{item.rewardId},</if>
|
|
|
+ <if test="item.templateCode != null">#{item.templateCode},</if>
|
|
|
+ <if test="item.messageType != null">#{item.messageType},</if>
|
|
|
+ <if test="item.createBy != null">#{item.createBy},</if>
|
|
|
+ <if test="item.sendTime != null">#{item.sendTime},</if>
|
|
|
</trim>
|
|
|
</foreach>
|
|
|
</insert>
|
|
|
|
|
|
+ <!-- 根据 ID 删除 -->
|
|
|
+ <delete id="deleteMessageReceiversById">
|
|
|
+ DELETE FROM message_receivers
|
|
|
+ <where>
|
|
|
+ id IN
|
|
|
+ <foreach item="id" collection="ids" open="(" separator="," close=")">
|
|
|
+ <if test="id > 0">
|
|
|
+ #{id}
|
|
|
+ </if>
|
|
|
+ </foreach>
|
|
|
+ </where>
|
|
|
+ </delete>
|
|
|
+
|
|
|
|
|
|
</mapper>
|