RuoYi-Vue/xkt/src/main/resources/mapper/UserNoticeMapper.xml

66 lines
2.0 KiB
XML

<?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.xkt.mapper.UserNoticeMapper">
<select id="selectUserNoticeList" resultType="com.ruoyi.xkt.dto.userNotice.UserNoticeResDTO">
SELECT
un.id AS userNoticeId,
n.id AS noticeId,
un.target_notice_type,
n.notice_title,
n.notice_content,
n.store_id,
n.effect_start,
n.effect_end,
n.perpetuity
FROM
user_notice un
JOIN notice n ON un.notice_id = n.id
WHERE
un.del_flag = 0
<if test="noticeTitle != null and noticeTitle != ''">
AND n.notice_title LIKE concat('%', #{noticeTitle}, '%')
</if>
<if test="noticeType != null">
AND n.notice
</if>
AND un.user_id = #{userId}
ORDER BY
un.create_time DESC,
un.target_notice_type
</select>
<select id="appList" resultType="com.ruoyi.xkt.dto.userNotice.UserNoticeAppListResDTO">
SELECT
un.target_notice_type,
n.notice_content,
un.create_time,
un.read_status
FROM
user_notice un
JOIN notice n ON un.notice_id = n.id
WHERE
un.del_flag = 0 AND un.user_id = #{userId}
ORDER BY
un.target_notice_type
</select>
<select id="selectAppTypePage" resultType="com.ruoyi.xkt.dto.userNotice.UserNoticeAppResDTO">
SELECT
n.notice_title,
n.notice_content,
un.create_time
FROM
user_notice un
JOIN notice n ON un.notice_id = n.id
WHERE
un.del_flag = 0
AND un.target_notice_type = #{targetNoticeType}
AND un.user_id = #{userId}
ORDER BY
un.create_time DESC
</select>
</mapper>