123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- <?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.sooka.system.mapper.SysNoticeMapper">
- <resultMap type="SysNotice" id="SysNoticeResult">
- <result property="noticeId" column="notice_id" />
- <result property="noticeTitle" column="notice_title" />
- <result property="noticeType" column="notice_type" />
- <result property="noticeContent" column="notice_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="eventId" column="event_id"/>
- <result property="reserveplanType" column="reserveplan_type"/>
- <result property="isGroupNotice" column="is_group_notice"/>
- </resultMap>
- <sql id="selectNoticeVo">
- select t.dept_id,event_id,reserveplan_type,t.is_group_notice,
- (select dept_name from sys_dept where dept_id=t.dept_id) dept_name,
- t.create_user_id, t.notice_id, ifnull(t.notice_title,"") notice_title, ifnull(t.notice_type,"") notice_type,
- ifnull(t.notice_content,"") notice_content, t.status, t.create_by, t.create_time, t.update_by, t.update_time, t.remark
- from sys_notice t
- </sql>
- <select id="selectNoticeById" parameterType="Long" resultMap="SysNoticeResult">
- <include refid="selectNoticeVo"/>
- where notice_id = #{noticeId}
- </select>
- <select id="selectNoticeList" parameterType="SysNotice" resultMap="SysNoticeResult">
- <include refid="selectNoticeVo"/>
- <where>
- 1=1
- <if test="noticeTitle != null and noticeTitle != ''">
- AND notice_title like concat('%', #{noticeTitle}, '%')
- </if>
- <if test="noticeType != null and noticeType != ''">
- AND notice_type = #{noticeType}
- </if>
- <if test="isGroupNotice != null and isGroupNotice != ''">
- AND is_group_notice = #{isGroupNotice}
- </if>
- <if test="createBy != null and createBy != ''">
- AND create_by like concat('%', #{createBy}, '%')
- </if>
- <if test="userId != null and userId != ''">
- and t.notice_id in (select notice_id from sys_notice_to where user_id = #{userId}) or t.is_group_notice = '1'
- </if>
- </where>
- order by create_time desc
- </select>
- <insert id="insertNotice" parameterType="SysNotice" useGeneratedKeys="true" keyProperty="noticeId">
- insert into sys_notice (
- <if test="noticeTitle != null and noticeTitle != '' ">notice_title, </if>
- <if test="noticeType != null and noticeType != '' ">notice_type, </if>
- <if test="noticeContent != null and noticeContent != '' ">notice_content, </if>
- <if test="status != null and status != '' ">status, </if>
- <if test="remark != null and remark != ''">remark,</if>
- <if test="createBy != null and createBy != ''">create_by,</if>
- <if test="eventId != null and eventId != ''">event_id,</if>
- <if test="reserveplanType != null and reserveplanType != ''">reserveplan_type,</if>
- <if test="isGroupNotice != null and isGroupNotice != ''">is_group_notice,</if>
- create_time
- )values(
- <if test="noticeTitle != null and noticeTitle != ''">#{noticeTitle}, </if>
- <if test="noticeType != null and noticeType != ''">#{noticeType}, </if>
- <if test="noticeContent != null and noticeContent != ''">#{noticeContent}, </if>
- <if test="status != null and status != ''">#{status}, </if>
- <if test="remark != null and remark != ''">#{remark},</if>
- <if test="createBy != null and createBy != ''">#{createBy},</if>
- <if test="eventId != null and eventId != ''">#{eventId},</if>
- <if test="reserveplanType != null and reserveplanType != ''">#{reserveplanType},</if>
- <if test="isGroupNotice != null and isGroupNotice != ''">#{isGroupNotice},</if>
- sysdate()
- )
- </insert>
- <update id="updateNotice" parameterType="SysNotice">
- update sys_notice
- <set>
- <if test="noticeTitle != null and noticeTitle != ''">notice_title = #{noticeTitle}, </if>
- <if test="noticeType != null and noticeType != ''">notice_type = #{noticeType}, </if>
- <if test="noticeContent != null">notice_content = #{noticeContent}, </if>
- <if test="status != null and status != ''">status = #{status}, </if>
- <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
- <if test="isGroupNotice != null and isGroupNotice != ''">is_group_notice = #{isGroupNotice},</if>
- update_time = sysdate()
- </set>
- where notice_id = #{noticeId}
- </update>
- <delete id="deleteNoticeByIds" parameterType="String">
- delete from sys_notice where notice_id in
- <foreach item="noticeId" collection="array" open="(" separator="," close=")">
- #{noticeId}
- </foreach>
- </delete>
- </mapper>
|