86133 | aaa3f5d | 2025-04-20 21:33:29 +0800 | [diff] [blame^] | 1 | <?xml version="1.0" encoding="UTF-8" ?> |
| 2 | <!DOCTYPE mapper |
| 3 | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| 4 | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| 5 | <mapper namespace="com.ruoyi.system.mapper.SysNoticeMapper"> |
| 6 | |
| 7 | <resultMap type="SysNotice" id="SysNoticeResult"> |
| 8 | <result property="noticeId" column="notice_id" /> |
| 9 | <result property="noticeTitle" column="notice_title" /> |
| 10 | <result property="noticeType" column="notice_type" /> |
| 11 | <result property="noticeContent" column="notice_content" /> |
| 12 | <result property="status" column="status" /> |
| 13 | <result property="createBy" column="create_by" /> |
| 14 | <result property="createTime" column="create_time" /> |
| 15 | <result property="updateBy" column="update_by" /> |
| 16 | <result property="updateTime" column="update_time" /> |
| 17 | <result property="remark" column="remark" /> |
| 18 | </resultMap> |
| 19 | |
| 20 | <sql id="selectNoticeVo"> |
| 21 | select notice_id, notice_title, notice_type, cast(notice_content as char) as notice_content, status, create_by, create_time, update_by, update_time, remark |
| 22 | from sys_notice |
| 23 | </sql> |
| 24 | |
| 25 | <select id="selectNoticeById" parameterType="Long" resultMap="SysNoticeResult"> |
| 26 | <include refid="selectNoticeVo"/> |
| 27 | where notice_id = #{noticeId} |
| 28 | </select> |
| 29 | |
| 30 | <select id="selectNoticeList" parameterType="SysNotice" resultMap="SysNoticeResult"> |
| 31 | <include refid="selectNoticeVo"/> |
| 32 | <where> |
| 33 | <if test="noticeTitle != null and noticeTitle != ''"> |
| 34 | AND notice_title like concat('%', #{noticeTitle}, '%') |
| 35 | </if> |
| 36 | <if test="noticeType != null and noticeType != ''"> |
| 37 | AND notice_type = #{noticeType} |
| 38 | </if> |
| 39 | <if test="createBy != null and createBy != ''"> |
| 40 | AND create_by like concat('%', #{createBy}, '%') |
| 41 | </if> |
| 42 | </where> |
| 43 | </select> |
| 44 | |
| 45 | <insert id="insertNotice" parameterType="SysNotice"> |
| 46 | insert into sys_notice ( |
| 47 | <if test="noticeTitle != null and noticeTitle != '' ">notice_title, </if> |
| 48 | <if test="noticeType != null and noticeType != '' ">notice_type, </if> |
| 49 | <if test="noticeContent != null and noticeContent != '' ">notice_content, </if> |
| 50 | <if test="status != null and status != '' ">status, </if> |
| 51 | <if test="remark != null and remark != ''">remark,</if> |
| 52 | <if test="createBy != null and createBy != ''">create_by,</if> |
| 53 | create_time |
| 54 | )values( |
| 55 | <if test="noticeTitle != null and noticeTitle != ''">#{noticeTitle}, </if> |
| 56 | <if test="noticeType != null and noticeType != ''">#{noticeType}, </if> |
| 57 | <if test="noticeContent != null and noticeContent != ''">#{noticeContent}, </if> |
| 58 | <if test="status != null and status != ''">#{status}, </if> |
| 59 | <if test="remark != null and remark != ''">#{remark},</if> |
| 60 | <if test="createBy != null and createBy != ''">#{createBy},</if> |
| 61 | sysdate() |
| 62 | ) |
| 63 | </insert> |
| 64 | |
| 65 | <update id="updateNotice" parameterType="SysNotice"> |
| 66 | update sys_notice |
| 67 | <set> |
| 68 | <if test="noticeTitle != null and noticeTitle != ''">notice_title = #{noticeTitle}, </if> |
| 69 | <if test="noticeType != null and noticeType != ''">notice_type = #{noticeType}, </if> |
| 70 | <if test="noticeContent != null">notice_content = #{noticeContent}, </if> |
| 71 | <if test="status != null and status != ''">status = #{status}, </if> |
| 72 | <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> |
| 73 | update_time = sysdate() |
| 74 | </set> |
| 75 | where notice_id = #{noticeId} |
| 76 | </update> |
| 77 | |
| 78 | <delete id="deleteNoticeById" parameterType="Long"> |
| 79 | delete from sys_notice where notice_id = #{noticeId} |
| 80 | </delete> |
| 81 | |
| 82 | <delete id="deleteNoticeByIds" parameterType="Long"> |
| 83 | delete from sys_notice where notice_id in |
| 84 | <foreach item="noticeId" collection="array" open="(" separator="," close=")"> |
| 85 | #{noticeId} |
| 86 | </foreach> |
| 87 | </delete> |
| 88 | |
| 89 | </mapper> |