heheng
2025-11-14 6b652d0e9269156936a1d6425829e104b7e680b5
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
<?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.gkhy.exam.system.mapper.SysNoticeMapper">
    
    <resultMap type="com.gkhy.exam.system.domain.SysNotice" id="SysNoticeResult">
        <result property="id"       column="id"       />
        <result property="title"    column="title"    />
        <result property="type"     column="type"     />
        <result property="content"  column="content"  />
        <result property="status"         column="status"          />
        <result property="createBy"       column="create_by"       />
        <result property="createTime"     column="create_time"     />
        <result property="updateBy"       column="update_by"       />
        <result property="updateTime"     column="update_time"     />
        <result property="remark"         column="remark"          />
        <result property="filePath"       column="file_path"       />
        <result property="fileName"       column="file_name"       />
        <result property="deptId"         column="dept_id"         />
        <result property="publishDate"   column="publish_date"   />
        <result property="companyId"       column="company_id"       />
    </resultMap>
    <resultMap type="com.gkhy.exam.system.domain.SysNotice" id="SysNoticeVoResult">
        <result property="deptName" column="dept_name" />
    </resultMap>
    
    <sql id="selectNoticeVo">
        select id, title, type, cast(content as char) as content,company_id, status, create_by, create_time, update_by, update_time, remark, file_path, file_name, dept_id, publish_date
        from sys_notice
    </sql>
    
    <select id="selectNoticeById" parameterType="Long" resultMap="SysNoticeResult">
        <include refid="selectNoticeVo"/>
        where id = #{noticeId}
    </select>
    
    <select id="selectNoticeList"  resultMap="SysNoticeVoResult">
        select a.id, a.title, a.type, cast(a.content as char) as content, a.status, a.create_by, a.create_time, a.update_by,
        a.update_time, a.remark, a.file_path, a.file_name, a.dept_id, a.publish_date,b.dept_name,a.company_id
        from sys_notice a
        left join sys_dept b on a.dept_id = b.dept_id
        where a.del_flag = 0
        <if test="companyId != null">
            AND a.company_id = #{companyId}
        </if>
        <if test="title != null and title != ''">
            AND a.title like concat('%', #{title}, '%')
        </if>
        <if test="type != null and type != ''">
            AND a.type = #{type}
        </if>
        <if test="deptId != null">
            AND a.deptId = #{dept_id}
        </if>
        <if test="createBy != null and createBy != ''">
            AND a.create_by like concat('%', #{createBy}, '%')
        </if>
 
        order by a.create_time desc
    </select>
 
 
    <delete id="deleteNoticeByIds" parameterType="Long">
        update sys_notice set del_flag = 1 where id in
        <foreach item="noticeId" collection="array" open="(" separator="," close=")">
            #{noticeId}
        </foreach>
    </delete>
    
</mapper>