|
@@ -0,0 +1,87 @@
|
|
|
+<?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.ruoyi.project.system.mapper.SysUserNoticeMapper">
|
|
|
+
|
|
|
+ <resultMap type="SysUserNotice" id="SysUserNoticeResult">
|
|
|
+ <result property="id" column="id" />
|
|
|
+ <result property="userId" column="user_id" />
|
|
|
+ <result property="noticeId" column="notice_id" />
|
|
|
+ <result property="read" column="read" />
|
|
|
+ <result property="createtime" column="createtime" />
|
|
|
+ <result property="deptName" column="dept_name" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="selectSysUserNoticeVo">
|
|
|
+ select d.id, d.user_id, d.notice_id, d.read, d.createtime ,s.dept_name from sys_user_notice d
|
|
|
+ left join sys_dept s on s.dept_id = d.dept_id
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectSysUserNoticeList" parameterType="SysUserNotice" resultMap="SysUserNoticeResult">
|
|
|
+ <include refid="selectSysUserNoticeVo"/>
|
|
|
+ <where>
|
|
|
+ <if test="userId != null "> and user_id = #{userId}</if>
|
|
|
+ <if test="noticeId != null "> and notice_id = #{noticeId}</if>
|
|
|
+ <if test="read != null "> and read = #{read}</if>
|
|
|
+ <if test="createtime != null "> and createtime = #{createtime}</if>
|
|
|
+ and d.del_flag = 0
|
|
|
+ </where>
|
|
|
+ <!-- 数据范围过滤 -->
|
|
|
+ ${params.dataScope}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectSysUserNoticeById" parameterType="Long" resultMap="SysUserNoticeResult">
|
|
|
+ <include refid="selectSysUserNoticeVo"/>
|
|
|
+ where id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectSysUserNoticeByUserId" parameterType="Long" resultMap="SysUserNoticeResult">
|
|
|
+ <include refid="selectSysUserNoticeVo"/>
|
|
|
+ where USER_ID = #{userId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertSysUserNotice" parameterType="SysUserNotice">
|
|
|
+ <selectKey keyProperty="id" resultType="long" order="BEFORE">
|
|
|
+ SELECT seq_sys_user_notice.NEXTVAL as id FROM DUAL
|
|
|
+ </selectKey>
|
|
|
+ insert into sys_user_notice
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="id != null">id,</if>
|
|
|
+ <if test="userId != null">user_id,</if>
|
|
|
+ <if test="noticeId != null">notice_id,</if>
|
|
|
+ <if test="read != null">read,</if>
|
|
|
+ <if test="createtime != null">createtime,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="id != null">#{id},</if>
|
|
|
+ <if test="userId != null">#{userId},</if>
|
|
|
+ <if test="noticeId != null">#{noticeId},</if>
|
|
|
+ <if test="read != null">#{read},</if>
|
|
|
+ <if test="createtime != null">#{createtime},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateSysUserNotice" parameterType="SysUserNotice">
|
|
|
+ update sys_user_notice
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="userId != null">user_id = #{userId},</if>
|
|
|
+ <if test="noticeId != null">notice_id = #{noticeId},</if>
|
|
|
+ <if test="read != null">read = #{read},</if>
|
|
|
+ <if test="createtime != null">createtime = #{createtime},</if>
|
|
|
+ </trim>
|
|
|
+ where id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <update id="deleteSysUserNoticeById" parameterType="Long">
|
|
|
+ update sys_user_notice set del_flag = 2 where id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <update id="deleteSysUserNoticeByIds" parameterType="String">
|
|
|
+ update sys_user_notice set del_flag = 2 where id in
|
|
|
+ <foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </update>
|
|
|
+
|
|
|
+</mapper>
|