auth-server-java/service/src/main/resources/mapper/MessageMapper.xml

93 lines
4.0 KiB
XML
Raw Normal View History

<?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="cn.bunny.services.mapper.MessageMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.bunny.dao.entity.system.Message">
<id column="id" property="id"/>
2024-10-30 16:56:30 +08:00
<id column="create_time" property="createTime"/>
<id column="update_time" property="updateTime"/>
<id column="create_user" property="createUser"/>
<id column="update_user" property="updateUser"/>
<id column="is_deleted" property="isDeleted"/>
<id column="title" property="title"/>
2024-10-31 16:58:50 +08:00
<id column="received_user_ids" property="receivedUserIds"/>
2024-10-30 16:56:30 +08:00
<id column="send_user_id" property="sendUserId"/>
<id column="message_type" property="messageType"/>
<id column="content" property="content"/>
2024-10-31 16:58:50 +08:00
<id column="cover" property="cover"/>
<id column="summary" property="summary"/>
2024-10-30 16:56:30 +08:00
<id column="editor_type" property="editorType"/>
<id column="status" property="status"/>
2024-11-01 00:09:11 +08:00
<id column="level" property="level"/>
<id column="extra" property="extra"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
2024-11-01 00:09:11 +08:00
id, create_time, update_time, create_user, update_user, is_deleted, title, received_user_ids, send_user_id, send_nick_name, message_type, content, editor_type, status, level, extra
</sql>
2024-10-30 16:56:30 +08:00
<!-- 分页查询系统消息内容 -->
<select id="selectListByPage" resultType="cn.bunny.dao.vo.system.message.MessageVo">
2024-10-30 16:56:30 +08:00
select
message.*,
create_user.username as create_username,
update_user.username as update_username,
2024-11-01 00:09:11 +08:00
send_user.nickname as send_nickname,
message_recived.received_user_id as message_recivedids
from sys_message message
left join sys_user create_user on create_user.id = message.create_user
left join sys_user update_user on update_user.id = message.update_user
left join sys_user send_user on send_user.id = message.send_user_id
2024-11-01 00:09:11 +08:00
left join sys_message_recived message_recived on message_recived.message_id = message.id
2024-10-30 16:56:30 +08:00
<where>
message.is_deleted = 0
2024-10-30 16:56:30 +08:00
<if test="dto.title != null and dto.title != ''">
and message.title like CONCAT('%',#{dto.title},'%')
2024-10-30 16:56:30 +08:00
</if>
<if test="dto.sendNickname != null and dto.sendNickname != ''">
and send_user.nickname like CONCAT('%',#{dto.sendNickname},'%')
2024-10-30 16:56:30 +08:00
</if>
<if test="dto.messageType != null and dto.messageType != ''">
and message.message_type like CONCAT('%',#{dto.messageType},'%')
2024-10-30 16:56:30 +08:00
</if>
<if test="dto.content != null and dto.content != ''">
and message.content like CONCAT('%',#{dto.content},'%')
2024-10-30 16:56:30 +08:00
</if>
<if test="dto.editorType != null and dto.editorType != ''">
and message.editor_type = #{dto.editorType}
2024-10-30 16:56:30 +08:00
</if>
2024-11-01 00:09:11 +08:00
<if test="dto.editorType != null and dto.editorType != ''">
and message.editor_type = #{dto.editorType}
</if>
<if test="dto.level != null and dto.level != ''">
and message.level = #{dto.level}
</if>
<if test="dto.extra != null and dto.extra != ''">
and message.extra = #{dto.extra}
</if>
<if test="dto.status != null">
and message.status = #{dto.status}
2024-10-30 16:56:30 +08:00
</if>
</where>
</select>
2024-11-01 00:09:11 +08:00
<!-- 分页查询用户消息 -->
<select id="selectUserMessageList" resultType="cn.bunny.dao.vo.system.message.MessageUserVo">
</select>
2024-10-30 16:56:30 +08:00
<!-- 物理删除系统消息 -->
<delete id="deleteBatchIdsWithPhysics">
delete
from sys_message
where id in
<foreach collection="ids" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
</delete>
</mapper>