智慧保安后台管理-外网-验收版本
zengh
2021-07-16 1a8fdd1e29e2e69a452eedbd65cca97c01ee3e84
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
<?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="org.springblade.modules.exam.mapper.ExamPaperMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="noticeResultMap" type="org.springblade.modules.exam.entity.ExamPaper">
        <result column="id" property="id"/>
        <result column="create_user" property="createUser"/>
        <result column="create_time" property="createTime"/>
        <result column="update_user" property="updateUser"/>
        <result column="update_time" property="updateTime"/>
        <result column="status" property="status"/>
        <result column="is_deleted" property="isDeleted"/>
        <result column="release_time" property="releaseTime"/>
        <result column="title" property="title"/>
        <result column="content" property="content"/>
    </resultMap>
 
    <!-- 通用查询映射结果 -->
    <resultMap id="noticeVOResultMap" type="org.springblade.modules.exam.vo.ExamPaperVO">
        <result column="id" property="id"/>
        <result column="create_user" property="createUser"/>
        <result column="create_time" property="createTime"/>
        <result column="update_user" property="updateUser"/>
        <result column="update_time" property="updateTime"/>
        <result column="status" property="status"/>
        <result column="is_deleted" property="isDeleted"/>
        <result column="release_time" property="releaseTime"/>
        <result column="title" property="title"/>
        <result column="content" property="content"/>
    </resultMap>
 
    <select id="topList" resultMap="noticeResultMap">
        select * from blade_notice limit #{number}
    </select>
 
    <select id="selectNoticePage" resultMap="noticeVOResultMap">
        SELECT
        n.*,
        d.dict_value AS categoryName
        FROM
        blade_notice n
        LEFT JOIN
        ( SELECT * FROM blade_dict WHERE code = 'notice' ) d
        ON
        n.category = d.dict_key
        <if test="notice.deptId!=null and notice.jurisdiction!=null">
            left join
            blade_user bu
            on
            bu.dept_id = n.dept_id
        </if>
        WHERE
        n.is_deleted = 0
        <if test="notice.title!=null">
            and n.title like concat(concat('%', #{notice.title}), '%')
        </if>
        <if test="notice.category!=null">
            and n.category = #{notice.category}
        </if>
        <if test="notice.deptId!=null and notice.jurisdiction!=null">
            and (n.dept_id = #{notice.deptId} or bu.jurisdiction = #{notice.jurisdiction}
            or n.dept_id = 1123598813738675201
            )
        </if>
        <if test="notice.deptId!=null and notice.jurisdiction==null">
            and (n.dept_id = #{notice.deptId} and n.category=2
            or n.dept_id = 1123598813738675201
            )
        </if>
        <if test="notice.startTime!=null and notice.startTime!=''">
            and n.release_time &gt;= #{notice.startTime}
        </if>
        <if test="notice.endTime!=null and notice.endTime!=''">
            and n.release_time &lt;= #{notice.endTime}
        </if>
    </select>
</mapper>