无关风月
2025-05-08 9486766c806fe1d9e082b2fd02ea1cc558f1b443
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
52
53
54
55
<?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.dsh.course.mapper.SystemNoticeMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.dsh.course.entity.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="isRead"/>
    </resultMap>
 
 
    <select id="queryNoReadNoticeNum" resultType="int">
        select count(id) from t_system_notice where userType = #{userType} and userId = #{uid} and `isRead` = 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`,
        `isRead` as `read`
        from t_system_notice where `type` = 2 and userType = 1 and userId = #{uid} and userType = #{userType}
        <if test="null != language">
            and `language` =#{language}
        </if>
        order by insertTime desc limit #{pageNum}, #{size}
    </select>
 
 
 
    <update id="readSystemNotice">
        update t_system_notice set `isRead` = 2 where id = #{id} and userId = #{uid} and userType = #{userType}
    </update>
 
 
    <delete id="delSystemNotice">
        delete from t_system_notice where userType = #{userType}
        <if test="null != uid">
            and userId = #{uid}
        </if>
        <if test="null != id">
            and id = #{id}
        </if>
    </delete>
</mapper>