SysNoticeMapper.xml 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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.dgtly.system.mapper.SysNoticeMapper">
  6. <resultMap type="SysNotice" id="SysNoticeResult">
  7. <result property="noticeId" column="notice_id" />
  8. <result property="companyId" column="company_id" />
  9. <result property="noticeTitle" column="notice_title" />
  10. <result property="noticeType" column="notice_type" />
  11. <result property="noticeContent" column="notice_content" />
  12. <result property="status" column="status" />
  13. <result property="createBy" column="create_by" />
  14. <result property="createTime" column="create_time" />
  15. <result property="updateBy" column="update_by" />
  16. <result property="updateTime" column="update_time" />
  17. <result property="remark" column="remark" />
  18. <result property="fmzFileUrl" column="fmz_file_url" />
  19. </resultMap>
  20. <sql id="selectNoticeVo">
  21. select notice_id,company_id,notice_title, notice_type, notice_content, status, create_by, fmz_file_url, create_time, update_by, update_time, remark
  22. from sys_notice
  23. </sql>
  24. <sql id="selectNotice">
  25. select sn.notice_id,
  26. su.company_id,
  27. sn.notice_title,
  28. sn.notice_type,
  29. sn.notice_content,
  30. sn.status,
  31. su.user_name create_by,
  32. sn.create_time,
  33. sn.update_by,
  34. sn.update_time,
  35. sn.remark,
  36. sn.fmz_file_url,
  37. sn.create_time
  38. from sys_notice sn
  39. left join sys_user su on su.user_id = sn.create_by
  40. left join sys_dept sd on sd.dept_id = su.dept_id
  41. </sql>
  42. <select id="selectNoticeById" parameterType="Long" resultMap="SysNoticeResult">
  43. <include refid="selectNoticeVo"/>
  44. where notice_id = #{noticeId}
  45. </select>
  46. <select id="selectNoticeList" parameterType="SysNotice" resultMap="SysNoticeResult">
  47. <include refid="selectNoticeVo"/>
  48. <where>
  49. <if test="noticeTitle != null and noticeTitle != ''">
  50. AND notice_title like concat('%', #{noticeTitle}, '%')
  51. </if>
  52. <if test="companyId != null and companyId != 0">
  53. AND company_id = #{companyId}
  54. </if>
  55. <if test="noticeType != null and noticeType != ''">
  56. AND notice_type = #{noticeType}
  57. </if>
  58. <if test="createBy != null and createBy != ''">
  59. AND create_by like concat('%', #{createBy}, '%')
  60. </if>
  61. </where>
  62. </select>
  63. <select id="selectNoticeListByRole" parameterType="SysNotice" resultMap="SysNoticeResult">
  64. <include refid="selectNotice"/>
  65. <where>
  66. <if test="noticeTitle != null and noticeTitle != ''">
  67. AND sn.notice_title like concat('%', #{noticeTitle}, '%')
  68. </if>
  69. <if test="companyId != null and companyId != 0">
  70. AND company_id = #{companyId}
  71. </if>
  72. <if test="noticeType != null and noticeType != ''">
  73. AND sn.notice_type = #{noticeType}
  74. </if>
  75. <if test="createBy != null and createBy != ''">
  76. AND su.user_name like concat('%', #{createBy}, '%')
  77. </if>
  78. ${params.dataScope}
  79. </where>
  80. </select>
  81. <select id="selectNoticeTop3ByRole" parameterType="SysNotice" resultMap="SysNoticeResult">
  82. <include refid="selectNoticeVo"/>
  83. <where>
  84. <if test="noticeTitle != null and noticeTitle != ''">
  85. AND notice_title like concat('%', #{noticeTitle}, '%')
  86. </if>
  87. <if test="companyId != null and companyId != 0">
  88. AND company_id = #{companyId}
  89. </if>
  90. <if test="noticeType != null and noticeType != ''">
  91. AND notice_type = #{noticeType}
  92. </if>
  93. <if test="createBy != null and createBy != ''">
  94. AND create_by like concat('%', #{createBy}, '%')
  95. </if>
  96. ORDER BY create_time desc
  97. <if test="limitFlag != null and limitFlag != ''">
  98. LIMIT 0,5
  99. </if>
  100. </where>
  101. </select>
  102. <insert id="insertNotice" parameterType="SysNotice">
  103. insert into sys_notice (
  104. <if test="companyId != null and companyId != 0">company_id,</if>
  105. <if test="noticeTitle != null and noticeTitle != '' ">notice_title, </if>
  106. <if test="noticeType != null and noticeType != '' ">notice_type, </if>
  107. <if test="noticeContent != null and noticeContent != '' ">notice_content, </if>
  108. <if test="status != null and status != '' ">status, </if>
  109. <if test="remark != null and remark != ''">remark,</if>
  110. <if test="createBy != null and createBy != ''">create_by,</if>
  111. <if test="fmzFileUrl != null and fmzFileUrl != ''">fmz_file_url,</if>
  112. create_time
  113. )values(
  114. <if test="companyId != null and companyId != 0">#{companyId},</if>
  115. <if test="noticeTitle != null and noticeTitle != ''">#{noticeTitle}, </if>
  116. <if test="noticeType != null and noticeType != ''">#{noticeType}, </if>
  117. <if test="noticeContent != null and noticeContent != ''">#{noticeContent}, </if>
  118. <if test="status != null and status != ''">#{status}, </if>
  119. <if test="remark != null and remark != ''">#{remark},</if>
  120. <if test="createBy != null and createBy != ''">#{createBy},</if>
  121. <if test="fmzFileUrl != null and fmzFileUrl != ''">#{fmzFileUrl},</if>
  122. sysdate()
  123. )
  124. </insert>
  125. <update id="updateNotice" parameterType="SysNotice">
  126. update sys_notice
  127. <set>
  128. <if test="noticeTitle != null and noticeTitle != ''">notice_title = #{noticeTitle}, </if>
  129. <if test="noticeType != null and noticeType != ''">notice_type = #{noticeType}, </if>
  130. <if test="noticeContent != null">notice_content = #{noticeContent}, </if>
  131. <if test="status != null and status != ''">status = #{status}, </if>
  132. <if test="fmzFileUrl != null and fmzFileUrl != ''">fmz_file_url = #{fmzFileUrl}, </if>
  133. <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
  134. update_time = sysdate()
  135. </set>
  136. where notice_id = #{noticeId}
  137. </update>
  138. <delete id="deleteNoticeByIds" parameterType="String">
  139. delete from sys_notice where notice_id in
  140. <foreach item="noticeId" collection="array" open="(" separator="," close=")">
  141. #{noticeId}
  142. </foreach>
  143. </delete>
  144. </mapper>