SysNoticeMapper.xml 6.9 KB

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