无关风月
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?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.TNoticesMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.dsh.course.entity.TNotices">
        <id column="id" property="id"/>
        <result column="title" property="title"/>
        <result column="content" property="content"/>
        <result column="sort" property="sort"/>
        <result column="isShow" property="isShow"/>
        <result column="isBroadcast" property="isBroadcast"/>
        <result column="type" property="type"/>
        <result column="imgUrl" property="imgUrl"/>
        <result column="isDelete" property="isDelete"/>
        <result column="isUser" property="isUser"/>
        <result column="isDriver" property="isDriver"/>
 
        <result column="flag" property="flag"/>
        <result column="insertTime" property="insertTime"/>
        <result column="insertUser" property="insertUser"/>
        <result column="updateTime" property="updateTime"/>
        <result column="updateUser" property="updateUser"/>
    </resultMap>
 
 
    <select id="queryNotices" resultType="com.dsh.course.entity.TNotices">
        select
        id as id,
        title as title,
        content as content,
        sort as sort,
        isShow as isShow,
        isBroadcast as isBroadcast,
        `type` as `type`,
        imgUrl as imgUrl,
        flag as flag,
        insertTime as insertTime,
        insertUser as insertUser,
        updateTime as updateTime,
        updateUser as updateUser
        from t_notices where flag != 3 and isDelete = 1 and `type` = #{type}
        <if test="type == 2">
            and isBroadcast = 1
        </if>
        <if test="type == 1">
            and isShow = 1
        </if>
    </select>
 
 
    <select id="queryList" resultType="map">
        select
        b.id as id,
        a.title as title,
        a.content as content,
        (1) as `type`,
        a.imgUrl as img,
        DATE_FORMAT(b.insertTime, '%Y-%m-%d %H:%i') as `time`,
        b.`isRead` as `read`
        from t_notices a
        left join t_system_notice b on (a.id = b.noticesId)
        where a.`type` = 2 and a.flag != 3 and a.isShow = 1 and b.type = 1 and b.userType = 1
        and b.userId = #{uid} and b.userType = #{userType} and b.language =#{language} order by b.insertTime desc limit #{pageNum}, #{size}
    </select>
 
    <!--根据条件查询滚动消息列表-->
    <select id="getRollingNoticeList" resultType="map" parameterType="com.baomidou.mybatisplus.extension.plugins.pagination.Page">
        SELECT * FROM t_notices as o
        <where>
            o.type = #{typeValue} and o.isDelete = 1
            <if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
                AND (o.insertTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59'))
            </if>
            <if test="content != null and content != ''">
                and o.content LIKE CONCAT('%',#{content},'%')
            </if>
            <if test="yy != null and yy != ''">
                and o.language =#{yy}
            </if>
        </where>
        order by o.sort asc,o.insertTime desc
    </select>
</mapper>