2024-11-28 16:05:52 +08:00
|
|
|
<?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.zsc.edu.gateway.modules.notice.repo.UserMessageRepository">
|
|
|
|
<resultMap id="userMessageMap" type="com.zsc.edu.gateway.modules.notice.vo.UserMessageVo">
|
|
|
|
<id column="id" jdbcType="BIGINT" property="id"/>
|
|
|
|
<result column="is_read" jdbcType="BOOLEAN" property="isRead"/>
|
|
|
|
<result column="read_time" jdbcType="TIMESTAMP" property="readTime"/>
|
|
|
|
<result column="username" jdbcType="VARCHAR" property="username"/>
|
|
|
|
<result column="address" jdbcType="VARCHAR" property="address"/>
|
|
|
|
<result column="avatar" jdbcType="VARCHAR" property="avatar"/>
|
|
|
|
<result column="name" jdbcType="VARCHAR" property="name"/>
|
|
|
|
<result column="type" jdbcType="INTEGER" property="type"/>
|
|
|
|
<result column="system" jdbcType="BOOLEAN" property="system"/>
|
|
|
|
<result column="email" jdbcType="BOOLEAN" property="email"/>
|
|
|
|
<result column="sms" jdbcType="BOOLEAN" property="sms"/>
|
|
|
|
<result column="html" jdbcType="BOOLEAN" property="html"/>
|
|
|
|
<result column="title" jdbcType="VARCHAR" property="title"/>
|
|
|
|
<result column="content" jdbcType="VARCHAR" property="content"/>
|
|
|
|
<result column="create_by" jdbcType="VARCHAR" property="createBy"/>
|
|
|
|
<result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
|
|
|
|
<result column="create_time" jdbcType="DATE" property="createTime"/>
|
|
|
|
<result column="update_time" jdbcType="DATE" property="updateTime"/>
|
|
|
|
<result column="remark" jdbcType="VARCHAR" property="remark"/>
|
2024-12-03 14:31:51 +08:00
|
|
|
<collection property="attachments" ofType="com.zsc.edu.gateway.modules.attachment.vo.AttachmentVo">
|
2024-11-28 16:05:52 +08:00
|
|
|
<result column="file_name" jdbcType="VARCHAR" property="fileName"/>
|
|
|
|
<result column="url" jdbcType="VARCHAR" property="url"/>
|
|
|
|
</collection>
|
|
|
|
</resultMap>
|
|
|
|
<select id="selectByMessageIdAndUserId" resultType="com.zsc.edu.gateway.modules.notice.vo.UserMessageVo"
|
|
|
|
resultMap="userMessageMap">
|
2024-12-03 14:31:51 +08:00
|
|
|
select sum.*,sm.*,su.username,su.address,su.avatar,su.name,a.*
|
2024-11-28 16:05:52 +08:00
|
|
|
from sys_user_message sum
|
2024-12-03 14:31:51 +08:00
|
|
|
left join sys_user su on sum.user_id = su.id
|
|
|
|
left join sys_message sm on sm.id = sum.message_id
|
|
|
|
left join sys_message_attachment sma on sm.id = sma.message_id
|
|
|
|
left join attachment a on sma.attachment_id = a.id
|
2024-11-28 16:05:52 +08:00
|
|
|
<where>
|
|
|
|
sm.id=#{messageId}
|
|
|
|
and su.id=#{userId}
|
|
|
|
</where>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="query" resultType="com.zsc.edu.gateway.modules.notice.vo.UserMessageVo" resultMap="userMessageMap">
|
2024-12-03 14:31:51 +08:00
|
|
|
select sum.*,sm.*,su.username,su.address,su.avatar,su.name,a.*
|
2024-11-28 16:05:52 +08:00
|
|
|
from sys_user_message sum
|
2024-12-03 14:31:51 +08:00
|
|
|
left join sys_user su on sum.user_id = su.id
|
|
|
|
left join sys_message sm on sm.id = sum.message_id
|
|
|
|
left join sys_message_attachment sma on sm.id = sma.message_id
|
|
|
|
left join attachment a on sma.attachment_id = a.id
|
2024-11-28 16:05:52 +08:00
|
|
|
where 1=1
|
|
|
|
<if test="query.userId != null">
|
|
|
|
AND sum.user_id = #{query.userId}
|
|
|
|
</if>
|
|
|
|
<if test="query.title != null and query.title != ''">
|
|
|
|
AND sm.title LIKE CONCAT('%', #{query.title}, '%')
|
|
|
|
</if>
|
|
|
|
<if test="query.type != null">
|
|
|
|
AND sm.type = #{query.type}
|
|
|
|
</if>
|
|
|
|
<if test="query.name != null and query.name != ''">
|
|
|
|
AND su.username LIKE CONCAT('%', #{query.name}, '%')
|
|
|
|
</if>
|
|
|
|
<if test="query.system != null">
|
|
|
|
AND sm.system = #{query.system}
|
|
|
|
</if>
|
|
|
|
<if test="query.isRead != null">
|
|
|
|
AND sum.is_read = #{query.isRead}
|
|
|
|
</if>
|
|
|
|
<if test="query.createAtBegin != null and query.createAtEnd != null">
|
|
|
|
AND sm.create_time BETWEEN #{query.createAtBegin} AND #{query.createAtEnd}
|
|
|
|
</if>
|
|
|
|
ORDER BY
|
|
|
|
sm.create_time DESC
|
|
|
|
</select>
|
|
|
|
</mapper>
|