NoticeServiceDaoImplMapper.xml 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  4. <mapper namespace="noticeServiceDaoImpl">
  5. <!-- 保存通知信息 add by wuxw 2018-07-03 -->
  6. <insert id="saveBusinessNoticeInfo" parameterType="Map">
  7. insert into business_notice(
  8. operate,notice_type_cd,context,start_time,end_time,community_id,title,b_id,user_id,notice_id,obj_type,obj_id,state
  9. ) values (
  10. #{operate},#{noticeTypeCd},#{context},#{startTime},#{endTime},#{communityId},#{title},#{bId},#{userId},#{noticeId},
  11. #{objType},#{objId},#{state}
  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,t.obj_type,t.obj_id,t.obj_type objType,t.obj_id objId,t.state
  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 &lt;= #{startTime}
  32. </if>
  33. <if test="endTime !=null">
  34. and t.end_time &gt;= #{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,obj_type,obj_id,state
  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,
  57. t.obj_type,t.obj_id,t.state
  58. from
  59. business_notice t where 1=1
  60. and t.operate= 'ADD'
  61. <if test="noticeTypeCd !=null and noticeTypeCd != ''">
  62. and t.notice_type_cd= #{noticeTypeCd}
  63. </if>
  64. <if test="context !=null and context != ''">
  65. and t.context= #{context}
  66. </if>
  67. <if test="startTime !=null">
  68. and t.start_time= #{startTime}
  69. </if>
  70. <if test="endTime !=null">
  71. and t.end_time= #{endTime}
  72. </if>
  73. <if test="communityId !=null and communityId != ''">
  74. and t.community_id= #{communityId}
  75. </if>
  76. <if test="title !=null and title != ''">
  77. and t.title= #{title}
  78. </if>
  79. <if test="bId !=null and bId != ''">
  80. and t.b_id= #{bId}
  81. </if>
  82. <if test="userId !=null and userId != ''">
  83. and t.user_id= #{userId}
  84. </if>
  85. <if test="noticeId !=null and noticeId != ''">
  86. and t.notice_id= #{noticeId}
  87. </if>
  88. </insert>
  89. <!-- 查询通知信息 add by wuxw 2018-07-03 -->
  90. <select id="getNoticeInfo" parameterType="Map" resultType="Map">
  91. select t.notice_type_cd,t.notice_type_cd noticeTypeCd,t.context,t.start_time,t.start_time
  92. 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
  93. bId,t.user_id,t.user_id userId,t.notice_id,t.notice_id noticeId,t.create_time,t.create_time createTime,
  94. d.`name` noticeTypeCdName,
  95. t.obj_type,t.obj_id,t.obj_type objType,t.obj_id objId,t.state,d1.name stateName
  96. from n_notice t
  97. left join t_dict d on d.table_name = 'n_notice' and d.table_columns = 'notice_type_cd' and t.notice_type_cd = d.status_cd
  98. left join t_dict d1 on d1.table_name = 'n_notice' and d1.table_columns = 'state' and t.state = d1.status_cd
  99. where 1 =1
  100. <if test="noticeTypeCd !=null and noticeTypeCd != ''">
  101. and t.notice_type_cd= #{noticeTypeCd}
  102. </if>
  103. <if test="context !=null and context != ''">
  104. and t.context= #{context}
  105. </if>
  106. <if test="startTime !=null">
  107. and t.start_time &lt;= #{startTime}
  108. </if>
  109. <if test="endTime !=null">
  110. and t.end_time &gt;= #{endTime}
  111. </if>
  112. <if test="statusCd !=null and statusCd != ''">
  113. and t.status_cd= #{statusCd}
  114. </if>
  115. <if test="communityId !=null and communityId != ''">
  116. and t.community_id= #{communityId}
  117. </if>
  118. <if test="title !=null and title != ''">
  119. and t.title like concat('%',#{title},'%')
  120. </if>
  121. <if test="bId !=null and bId != ''">
  122. and t.b_id= #{bId}
  123. </if>
  124. <if test="state !=null and state != ''">
  125. and t.state= #{state}
  126. </if>
  127. <if test="noticeId !=null and noticeId != ''">
  128. and t.notice_id= #{noticeId}
  129. </if>
  130. order by t.create_time desc
  131. <if test="page != -1 and page != null ">
  132. limit #{page}, #{row}
  133. </if>
  134. </select>
  135. <!-- 修改通知信息 add by wuxw 2018-07-03 -->
  136. <update id="updateNoticeInfoInstance" parameterType="Map">
  137. update n_notice t set t.status_cd = #{statusCd}
  138. <if test="newBId != null and newBId != ''">
  139. ,t.b_id = #{newBId}
  140. </if>
  141. <if test="noticeTypeCd !=null and noticeTypeCd != ''">
  142. , t.notice_type_cd= #{noticeTypeCd}
  143. </if>
  144. <if test="context !=null and context != ''">
  145. , t.context= #{context}
  146. </if>
  147. <if test="startTime !=null">
  148. , t.start_time= #{startTime}
  149. </if>
  150. <if test="endTime !=null">
  151. , t.end_time= #{endTime}
  152. </if>
  153. <if test="communityId !=null and communityId != ''">
  154. , t.community_id= #{communityId}
  155. </if>
  156. <if test="title !=null and title != ''">
  157. , t.title= #{title}
  158. </if>
  159. <if test="state !=null and state != ''">
  160. , t.state= #{state}
  161. </if>
  162. where 1=1
  163. <if test="bId !=null and bId != ''">
  164. and t.b_id= #{bId}
  165. </if>
  166. <if test="noticeId !=null and noticeId != ''">
  167. and t.notice_id= #{noticeId}
  168. </if>
  169. </update>
  170. <!-- 查询通知数量 add by wuxw 2018-07-03 -->
  171. <select id="queryNoticesCount" parameterType="Map" resultType="Map">
  172. select count(1) count
  173. from n_notice t
  174. where 1 =1
  175. <if test="noticeTypeCd !=null and noticeTypeCd != ''">
  176. and t.notice_type_cd= #{noticeTypeCd}
  177. </if>
  178. <if test="context !=null and context != ''">
  179. and t.context= #{context}
  180. </if>
  181. <if test="startTime !=null">
  182. and t.start_time &lt;= #{startTime}
  183. </if>
  184. <if test="endTime !=null">
  185. and t.end_time &gt;= #{endTime}
  186. </if>
  187. <if test="statusCd !=null and statusCd != ''">
  188. and t.status_cd= #{statusCd}
  189. </if>
  190. <if test="communityId !=null and communityId != ''">
  191. and t.community_id= #{communityId}
  192. </if>
  193. <if test="title !=null and title != ''">
  194. and t.title like concat('%',#{title},'%')
  195. </if>
  196. <if test="bId !=null and bId != ''">
  197. and t.b_id= #{bId}
  198. </if>
  199. <if test="noticeId !=null and noticeId != ''">
  200. and t.notice_id= #{noticeId}
  201. </if>
  202. </select>
  203. </mapper>