NoticeServiceDaoImplMapper.xml 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  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="noticeServiceDaoImpl">
  6. <!-- 保存通知信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveBusinessNoticeInfo" parameterType="Map">
  8. insert into business_notice(
  9. operate,notice_type_cd,context,start_time,end_time,community_id,title,b_id,user_id,notice_id
  10. ) values (
  11. #{operate},#{noticeTypeCd},#{context},#{startTime},#{endTime},#{communityId},#{title},#{bId},#{userId},#{noticeId}
  12. )
  13. </insert>
  14. <!-- 查询通知信息(Business) add by wuxw 2018-07-03 -->
  15. <select id="getBusinessNoticeInfo" parameterType="Map" resultType="Map">
  16. select t.operate,t.notice_type_cd,t.notice_type_cd noticeTypeCd,t.context,t.start_time,t.end_time,t.start_time
  17. startTime,t.end_time endTime,t.community_id,t.community_id communityId,t.title,t.b_id,t.b_id bId,t.user_id,t.user_id
  18. userId,t.notice_id,t.notice_id noticeId
  19. from business_notice t
  20. where 1 =1
  21. <if test="operate !=null and operate != ''">
  22. and t.operate= #{operate}
  23. </if>
  24. <if test="noticeTypeCd !=null and noticeTypeCd != ''">
  25. and t.notice_type_cd= #{noticeTypeCd}
  26. </if>
  27. <if test="context !=null and context != ''">
  28. and t.context= #{context}
  29. </if>
  30. <if test="startTime !=null">
  31. and t.start_time= #{startTime}
  32. </if>
  33. <if test="endTime !=null">
  34. and t.end_time= #{endTime}
  35. </if>
  36. <if test="communityId !=null and communityId != ''">
  37. and t.community_id= #{communityId}
  38. </if>
  39. <if test="title !=null and title != ''">
  40. and t.title= #{title}
  41. </if>
  42. <if test="bId !=null and bId != ''">
  43. and t.b_id= #{bId}
  44. </if>
  45. <if test="userId !=null and userId != ''">
  46. and t.user_id= #{userId}
  47. </if>
  48. <if test="noticeId !=null and noticeId != ''">
  49. and t.notice_id= #{noticeId}
  50. </if>
  51. </select>
  52. <!-- 保存通知信息至 instance表中 add by wuxw 2018-07-03 -->
  53. <insert id="saveNoticeInfoInstance" parameterType="Map">
  54. insert into n_notice(
  55. notice_type_cd,context,start_time,end_time,status_cd,community_id,title,b_id,user_id,notice_id
  56. ) select t.notice_type_cd,t.context,t.start_time,t.end_time,'0',t.community_id,t.title,t.b_id,t.user_id,t.notice_id from
  57. business_notice t where 1=1
  58. and t.operate= 'ADD'
  59. <if test="noticeTypeCd !=null and noticeTypeCd != ''">
  60. and t.notice_type_cd= #{noticeTypeCd}
  61. </if>
  62. <if test="context !=null and context != ''">
  63. and t.context= #{context}
  64. </if>
  65. <if test="startTime !=null">
  66. and t.start_time= #{startTime}
  67. </if>
  68. <if test="endTime !=null">
  69. and t.end_time= #{endTime}
  70. </if>
  71. <if test="communityId !=null and communityId != ''">
  72. and t.community_id= #{communityId}
  73. </if>
  74. <if test="title !=null and title != ''">
  75. and t.title= #{title}
  76. </if>
  77. <if test="bId !=null and bId != ''">
  78. and t.b_id= #{bId}
  79. </if>
  80. <if test="userId !=null and userId != ''">
  81. and t.user_id= #{userId}
  82. </if>
  83. <if test="noticeId !=null and noticeId != ''">
  84. and t.notice_id= #{noticeId}
  85. </if>
  86. </insert>
  87. <!-- 查询通知信息 add by wuxw 2018-07-03 -->
  88. <select id="getNoticeInfo" parameterType="Map" resultType="Map">
  89. select t.notice_type_cd,t.notice_type_cd noticeTypeCd,t.context,t.start_time,t.start_time
  90. startTime,t.end_time,t.end_time endTime,t.status_cd,t.status_cd statusCd,t.community_id,t.community_id communityId,t.title,t.b_id,t.b_id
  91. bId,t.user_id,t.user_id userId,t.notice_id,t.notice_id noticeId,t.create_time,t.create_time createTime,
  92. (CASE
  93. WHEN t.`notice_type_cd` = '1000'
  94. THEN '业主通知'
  95. WHEN t.notice_type_cd = '1001'
  96. THEN '员工通知'
  97. ELSE
  98. '小区通知'
  99. END) noticeTypeCdName
  100. from n_notice t
  101. where 1 =1
  102. <if test="noticeTypeCd !=null and noticeTypeCd != ''">
  103. and t.notice_type_cd= #{noticeTypeCd}
  104. </if>
  105. <if test="context !=null and context != ''">
  106. and t.context= #{context}
  107. </if>
  108. <if test="startTime !=null">
  109. and t.start_time= #{startTime}
  110. </if>
  111. <if test="endTime !=null">
  112. and t.end_time= #{endTime}
  113. </if>
  114. <if test="statusCd !=null and statusCd != ''">
  115. and t.status_cd= #{statusCd}
  116. </if>
  117. <if test="communityId !=null and communityId != ''">
  118. and t.community_id= #{communityId}
  119. </if>
  120. <if test="title !=null and title != ''">
  121. and t.title like concat('%',#{title},'%')
  122. </if>
  123. <if test="bId !=null and bId != ''">
  124. and t.b_id= #{bId}
  125. </if>
  126. <if test="userId !=null and userId != ''">
  127. and t.user_id= #{userId}
  128. </if>
  129. <if test="noticeId !=null and noticeId != ''">
  130. and t.notice_id= #{noticeId}
  131. </if>
  132. order by t.create_time desc
  133. <if test="page != -1 and page != null ">
  134. limit #{page}, #{row}
  135. </if>
  136. </select>
  137. <!-- 修改通知信息 add by wuxw 2018-07-03 -->
  138. <update id="updateNoticeInfoInstance" parameterType="Map">
  139. update n_notice t set t.status_cd = #{statusCd}
  140. <if test="newBId != null and newBId != ''">
  141. ,t.b_id = #{newBId}
  142. </if>
  143. <if test="noticeTypeCd !=null and noticeTypeCd != ''">
  144. , t.notice_type_cd= #{noticeTypeCd}
  145. </if>
  146. <if test="context !=null and context != ''">
  147. , t.context= #{context}
  148. </if>
  149. <if test="startTime !=null">
  150. , t.start_time= #{startTime}
  151. </if>
  152. <if test="endTime !=null">
  153. , t.end_time= #{endTime}
  154. </if>
  155. <if test="communityId !=null and communityId != ''">
  156. , t.community_id= #{communityId}
  157. </if>
  158. <if test="title !=null and title != ''">
  159. , t.title= #{title}
  160. </if>
  161. <if test="userId !=null and userId != ''">
  162. , t.user_id= #{userId}
  163. </if>
  164. where 1=1
  165. <if test="bId !=null and bId != ''">
  166. and t.b_id= #{bId}
  167. </if>
  168. <if test="noticeId !=null and noticeId != ''">
  169. and t.notice_id= #{noticeId}
  170. </if>
  171. </update>
  172. <!-- 查询通知数量 add by wuxw 2018-07-03 -->
  173. <select id="queryNoticesCount" parameterType="Map" resultType="Map">
  174. select count(1) count
  175. from n_notice t
  176. where 1 =1
  177. <if test="noticeTypeCd !=null and noticeTypeCd != ''">
  178. and t.notice_type_cd= #{noticeTypeCd}
  179. </if>
  180. <if test="context !=null and context != ''">
  181. and t.context= #{context}
  182. </if>
  183. <if test="startTime !=null">
  184. and t.start_time= #{startTime}
  185. </if>
  186. <if test="endTime !=null">
  187. and t.end_time= #{endTime}
  188. </if>
  189. <if test="statusCd !=null and statusCd != ''">
  190. and t.status_cd= #{statusCd}
  191. </if>
  192. <if test="communityId !=null and communityId != ''">
  193. and t.community_id= #{communityId}
  194. </if>
  195. <if test="title !=null and title != ''">
  196. and t.title like concat('%',#{title},'%')
  197. </if>
  198. <if test="bId !=null and bId != ''">
  199. and t.b_id= #{bId}
  200. </if>
  201. <if test="userId !=null and userId != ''">
  202. and t.user_id= #{userId}
  203. </if>
  204. <if test="noticeId !=null and noticeId != ''">
  205. and t.notice_id= #{noticeId}
  206. </if>
  207. </select>
  208. </mapper>