SysNoticeMapper.xml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. <resultMap type="SysNotice" id="SysNoticeResult">
  7. <result property="noticeId" column="notice_id" />
  8. <result property="noticeTitle" column="notice_title" />
  9. <result property="noticeType" column="notice_type" />
  10. <result property="noticeContent" column="notice_content" />
  11. <result property="readUserId" column="read_user_id" />
  12. <result property="isRead" column="is_read" />
  13. <result property="status" column="status" />
  14. <result property="createBy" column="create_by" />
  15. <result property="createTime" column="create_time" />
  16. <result property="updateBy" column="update_by" />
  17. <result property="updateTime" column="update_time" />
  18. <result property="remark" column="remark" />
  19. </resultMap>
  20. <sql id="selectNoticeVo">
  21. select notice_id, notice_title, notice_type, cast(notice_content as char) as notice_content,read_user_id,is_read status, create_by, create_time, update_by, update_time, remark
  22. from sys_notice
  23. </sql>
  24. <select id="selectNoticeById" parameterType="Long" resultMap="SysNoticeResult">
  25. <include refid="selectNoticeVo"/>
  26. where notice_id = #{noticeId}
  27. </select>
  28. <select id="selectNoticeList" parameterType="SysNotice" resultMap="SysNoticeResult">
  29. <include refid="selectNoticeVo"/>
  30. <where>
  31. <if test="noticeTitle != null and noticeTitle != ''">
  32. AND notice_title like concat('%', #{noticeTitle}, '%')
  33. </if>
  34. <if test="noticeType != null and noticeType != ''">
  35. AND notice_type = #{noticeType}
  36. </if>
  37. <if test="isRead != null and isRead == 'Y'">
  38. AND find_in_set(#{isRead}, read_user_id)
  39. </if>
  40. <if test="isRead != null and isRead == 'N'">
  41. AND find_in_set(#{isRead}, read_user_id) = 0
  42. </if>
  43. <if test="createBy != null and createBy != ''">
  44. AND create_by like concat('%', #{createBy}, '%')
  45. </if>
  46. </where>
  47. </select>
  48. <insert id="insertNotice" parameterType="SysNotice">
  49. insert into sys_notice (
  50. <if test="noticeTitle != null and noticeTitle != '' ">notice_title, </if>
  51. <if test="noticeType != null and noticeType != '' ">notice_type, </if>
  52. <if test="noticeContent != null and noticeContent != '' ">notice_content, </if>
  53. <if test="readUserId != null and readUserId != '' ">read_user_id, </if>
  54. <if test="isRead != null and isRead != '' ">is_read, </if>
  55. <if test="status != null and status != '' ">status, </if>
  56. <if test="remark != null and remark != ''">remark,</if>
  57. <if test="createBy != null and createBy != ''">create_by,</if>
  58. create_time
  59. )values(
  60. <if test="noticeTitle != null and noticeTitle != ''">#{noticeTitle}, </if>
  61. <if test="noticeType != null and noticeType != ''">#{noticeType}, </if>
  62. <if test="noticeContent != null and noticeContent != ''">#{noticeContent}, </if>
  63. <if test="readUserId != null and readUserId != ''">#{readUserId}, </if>
  64. <if test="isRead != null and isRead != ''">#{isRead}, </if>
  65. <if test="status != null and status != ''">#{status}, </if>
  66. <if test="remark != null and remark != ''">#{remark},</if>
  67. <if test="createBy != null and createBy != ''">#{createBy},</if>
  68. sysdate()
  69. )
  70. </insert>
  71. <update id="updateNotice" parameterType="SysNotice">
  72. update sys_notice
  73. <set>
  74. <if test="noticeTitle != null and noticeTitle != ''">notice_title = #{noticeTitle}, </if>
  75. <if test="noticeType != null and noticeType != ''">notice_type = #{noticeType}, </if>
  76. <if test="noticeContent != null">notice_content = #{noticeContent}, </if>
  77. <if test="readUserId != null and readUserId != ''">read_user_id = #{readUserId}, </if>
  78. <if test="isRead != null and isRead != ''">notice_content = #{isRead}, </if>
  79. <if test="status != null and status != ''">status = #{status}, </if>
  80. <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
  81. update_time = sysdate()
  82. </set>
  83. where notice_id = #{noticeId}
  84. </update>
  85. <delete id="deleteNoticeById" parameterType="Long">
  86. delete from sys_notice where notice_id = #{noticeId}
  87. </delete>
  88. <delete id="deleteNoticeByIds" parameterType="Long">
  89. delete from sys_notice where notice_id in
  90. <foreach item="noticeId" collection="array" open="(" separator="," close=")">
  91. #{noticeId}
  92. </foreach>
  93. </delete>
  94. </mapper>