xuhy
2025-01-09 c16f3bf0b16707214c3ad8acadbe5b77d35d4ccf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?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.stylefeng.guns.modular.system.dao.SystemNoticeMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.SystemNotice">
        <id column="id" property="id"/>
        <result column="type" property="type"/>
        <result column="noticeType" property="noticeType"/>
        <result column="userType" property="userType"/>
        <result column="noticesId" property="noticesId"/>
        <result column="content" property="content"/>
        <result column="userId" property="userId"/>
        <result column="insertTime" property="insertTime"/>
        <result column="read" property="read"/>
    </resultMap>
 
 
    <select id="queryNoReadNoticeNum" resultType="int">
        select count(id) from t_system_notice where userType = 1 and userId = #{uid} and `read` = 1
    </select>
 
 
    <select id="queryList" resultType="map">
        select
        id as id,
        noticeType as noticeType,
        `type` as `type`,
        content as content,
        DATE_FORMAT(insertTime, '%Y-%m-%d %H:%i') as `time`,
        `read` as `read`
        from t_system_notice where `type` = 2 and userType = 1 and userId = #{uid} order by insertTime desc limit #{pageNum}, #{size}
    </select>
 
 
 
    <update id="readSystemNotice">
        update t_system_notice set `read` = 2 where id = #{id} and userId = #{uid} and userType = 1
    </update>
 
 
    <delete id="delSystemNotice">
        delete from t_system_notice where userType = 1
        <if test="null != uid">
            and userId = #{uid}
        </if>
        <if test="null != id">
            and id = #{id}
        </if>
    </delete>
</mapper>