SysNoticeMapper.xml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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.sooka.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. <result property="eventId" column="event_id"/>
  18. <result property="reserveplanType" column="reserveplan_type"/>
  19. <result property="isGroupNotice" column="is_group_notice"/>
  20. </resultMap>
  21. <sql id="selectNoticeVo">
  22. select t.dept_id,event_id,reserveplan_type,t.is_group_notice,
  23. (select dept_name from sys_dept where dept_id=t.dept_id) dept_name,
  24. t.create_user_id, t.notice_id, ifnull(t.notice_title,"") notice_title, ifnull(t.notice_type,"") notice_type,
  25. ifnull(t.notice_content,"") notice_content, t.status, t.create_by, t.create_time, t.update_by, t.update_time, t.remark
  26. from sys_notice t
  27. </sql>
  28. <select id="selectNoticeById" parameterType="Long" resultMap="SysNoticeResult">
  29. <include refid="selectNoticeVo"/>
  30. where notice_id = #{noticeId}
  31. </select>
  32. <select id="selectNoticeList" parameterType="SysNotice" resultMap="SysNoticeResult">
  33. <include refid="selectNoticeVo"/>
  34. <where>
  35. 1=1
  36. <if test="noticeTitle != null and noticeTitle != ''">
  37. AND notice_title like concat('%', #{noticeTitle}, '%')
  38. </if>
  39. <if test="noticeType != null and noticeType != ''">
  40. AND notice_type = #{noticeType}
  41. </if>
  42. <if test="isGroupNotice != null and isGroupNotice != ''">
  43. AND is_group_notice = #{isGroupNotice}
  44. </if>
  45. <if test="createBy != null and createBy != ''">
  46. AND create_by like concat('%', #{createBy}, '%')
  47. </if>
  48. <if test="userId != null and userId != ''">
  49. and t.notice_id in (select notice_id from sys_notice_to where user_id = #{userId}) or t.is_group_notice = '1'
  50. </if>
  51. </where>
  52. order by create_time desc
  53. </select>
  54. <insert id="insertNotice" parameterType="SysNotice" useGeneratedKeys="true" keyProperty="noticeId">
  55. insert into sys_notice (
  56. <if test="noticeTitle != null and noticeTitle != '' ">notice_title, </if>
  57. <if test="noticeType != null and noticeType != '' ">notice_type, </if>
  58. <if test="noticeContent != null and noticeContent != '' ">notice_content, </if>
  59. <if test="status != null and status != '' ">status, </if>
  60. <if test="remark != null and remark != ''">remark,</if>
  61. <if test="createBy != null and createBy != ''">create_by,</if>
  62. <if test="eventId != null and eventId != ''">event_id,</if>
  63. <if test="reserveplanType != null and reserveplanType != ''">reserveplan_type,</if>
  64. <if test="isGroupNotice != null and isGroupNotice != ''">is_group_notice,</if>
  65. create_time
  66. )values(
  67. <if test="noticeTitle != null and noticeTitle != ''">#{noticeTitle}, </if>
  68. <if test="noticeType != null and noticeType != ''">#{noticeType}, </if>
  69. <if test="noticeContent != null and noticeContent != ''">#{noticeContent}, </if>
  70. <if test="status != null and status != ''">#{status}, </if>
  71. <if test="remark != null and remark != ''">#{remark},</if>
  72. <if test="createBy != null and createBy != ''">#{createBy},</if>
  73. <if test="eventId != null and eventId != ''">#{eventId},</if>
  74. <if test="reserveplanType != null and reserveplanType != ''">#{reserveplanType},</if>
  75. <if test="isGroupNotice != null and isGroupNotice != ''">#{isGroupNotice},</if>
  76. sysdate()
  77. )
  78. </insert>
  79. <update id="updateNotice" parameterType="SysNotice">
  80. update sys_notice
  81. <set>
  82. <if test="noticeTitle != null and noticeTitle != ''">notice_title = #{noticeTitle}, </if>
  83. <if test="noticeType != null and noticeType != ''">notice_type = #{noticeType}, </if>
  84. <if test="noticeContent != null">notice_content = #{noticeContent}, </if>
  85. <if test="status != null and status != ''">status = #{status}, </if>
  86. <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
  87. <if test="isGroupNotice != null and isGroupNotice != ''">is_group_notice = #{isGroupNotice},</if>
  88. update_time = sysdate()
  89. </set>
  90. where notice_id = #{noticeId}
  91. </update>
  92. <delete id="deleteNoticeByIds" parameterType="String">
  93. delete from sys_notice where notice_id in
  94. <foreach item="noticeId" collection="array" open="(" separator="," close=")">
  95. #{noticeId}
  96. </foreach>
  97. </delete>
  98. </mapper>