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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?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.TNoticesMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.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.stylefeng.guns.modular.system.model.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.`read` 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} order by b.insertTime desc limit #{pageNum}, #{size}
    </select>
</mapper>