SysNoticeMapper.xml 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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.slibra.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, cast(notice_content as char) as 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('%', #{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('%', #{createBy}, '%')
  37. </if>
  38. </where>
  39. </select>
  40. <insert id="insertNotice" parameterType="SysNotice">
  41. insert into sys_notice (
  42. <if test="noticeTitle != null and noticeTitle != '' ">notice_title, </if>
  43. <if test="noticeType != null and noticeType != '' ">notice_type, </if>
  44. <if test="noticeContent != null and noticeContent != '' ">notice_content, </if>
  45. <if test="status != null and status != '' ">status, </if>
  46. <if test="remark != null and remark != ''">remark,</if>
  47. <if test="createBy != null and createBy != ''">create_by,</if>
  48. create_time
  49. )values(
  50. <if test="noticeTitle != null and noticeTitle != ''">#{noticeTitle}, </if>
  51. <if test="noticeType != null and noticeType != ''">#{noticeType}, </if>
  52. <if test="noticeContent != null and noticeContent != ''">#{noticeContent}, </if>
  53. <if test="status != null and status != ''">#{status}, </if>
  54. <if test="remark != null and remark != ''">#{remark},</if>
  55. <if test="createBy != null and createBy != ''">#{createBy},</if>
  56. sysdate()
  57. )
  58. </insert>
  59. <update id="updateNotice" parameterType="SysNotice">
  60. update sys_notice
  61. <set>
  62. <if test="noticeTitle != null and noticeTitle != ''">notice_title = #{noticeTitle}, </if>
  63. <if test="noticeType != null and noticeType != ''">notice_type = #{noticeType}, </if>
  64. <if test="noticeContent != null">notice_content = #{noticeContent}, </if>
  65. <if test="status != null and status != ''">status = #{status}, </if>
  66. <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
  67. update_time = sysdate()
  68. </set>
  69. where notice_id = #{noticeId}
  70. </update>
  71. <delete id="deleteNoticeById" parameterType="Long">
  72. delete from sys_notice where notice_id = #{noticeId}
  73. </delete>
  74. <delete id="deleteNoticeByIds" parameterType="Long">
  75. delete from sys_notice where notice_id in
  76. <foreach item="noticeId" collection="array" open="(" separator="," close=")">
  77. #{noticeId}
  78. </foreach>
  79. </delete>
  80. </mapper>