SysNoticeMapper.xml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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="status" column="status" />
  12. <result property="createBy" column="create_by" />
  13. <result property="createTime" column="create_time" />
  14. <result property="updateBy" column="update_by" />
  15. <result property="updateTime" column="update_time" />
  16. <result property="remark" column="remark" />
  17. </resultMap>
  18. <sql id="selectNoticeVo">
  19. select notice_id, notice_title, notice_type, notice_content, status, create_by, create_time, update_by, update_time, remark
  20. from sys_notice
  21. </sql>
  22. <select id="selectNoticeById" parameterType="Long" resultMap="SysNoticeResult">
  23. <include refid="selectNoticeVo"/>
  24. where notice_id = #{noticeId}
  25. </select>
  26. <select id="selectNoticeList" parameterType="SysNotice" resultMap="SysNoticeResult">
  27. <include refid="selectNoticeVo"/>
  28. <where>
  29. <if test="noticeTitle != null and noticeTitle != ''">
  30. AND notice_title like concat(concat('%',#{noticeTitle}),'%')
  31. </if>
  32. <if test="noticeType != null and noticeType != ''">
  33. AND notice_type = #{noticeType}
  34. </if>
  35. <if test="createBy != null and createBy != ''">
  36. AND create_by like concat(concat('%',#{createBy}),'%')
  37. </if>
  38. </where>
  39. </select>
  40. <insert id="insertNotice" parameterType="SysNotice">
  41. <selectKey keyProperty="noticeId" order="BEFORE" resultType="long">
  42. select seq_sys_notice.nextval as noticeId from DUAL
  43. </selectKey>
  44. insert into sys_notice (
  45. <if test="noticeId != null and noticeId != '' ">notice_id, </if>
  46. <if test="noticeTitle != null and noticeTitle != '' ">notice_title, </if>
  47. <if test="noticeType != null and noticeType != '' ">notice_type, </if>
  48. <if test="noticeContent != null and noticeContent != '' ">notice_content, </if>
  49. <if test="status != null and status != '' ">status, </if>
  50. <if test="remark != null and remark != ''">remark,</if>
  51. <if test="createBy != null and createBy != ''">create_by,</if>
  52. create_time
  53. )values(
  54. <if test="noticeId != null and noticeId != '' ">#{noticeId}, </if>
  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. <update id="updateNotice" parameterType="SysNotice">
  65. update sys_notice
  66. <set>
  67. <if test="noticeTitle != null and noticeTitle != ''">notice_title = #{noticeTitle}, </if>
  68. <if test="noticeType != null and noticeType != ''">notice_type = #{noticeType}, </if>
  69. <if test="noticeContent != null">notice_content = #{noticeContent}, </if>
  70. <if test="status != null and status != ''">status = #{status}, </if>
  71. <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
  72. update_time = sysdate
  73. </set>
  74. where notice_id = #{noticeId}
  75. </update>
  76. <delete id="deleteNoticeByIds" parameterType="String">
  77. delete from sys_notice where notice_id in
  78. <foreach item="noticeId" collection="array" open="(" separator="," close=")">
  79. #{noticeId}
  80. </foreach>
  81. </delete>
  82. </mapper>