NoticeServiceDaoImplMapper.xml 8.3 KB

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