ComplaintServiceDaoImplMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  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="complaintServiceDaoImpl">
  5. <!-- 保存投诉建议信息 add by wuxw 2018-07-03 -->
  6. <insert id="saveBusinessComplaintInfo" parameterType="Map">
  7. insert into business_complaint(operate, complaint_id, type_cd, context, complaint_name, tel, state, store_id,
  8. b_id, room_id, community_id, start_user_id)
  9. values (#{operate}, #{complaintId}, #{typeCd}, #{context}, #{complaintName}, #{tel}, #{state}, #{storeId},
  10. #{bId}, #{roomId}, #{communityId},
  11. #{startUserId})
  12. </insert>
  13. <!-- 查询投诉建议信息(Business) add by wuxw 2018-07-03 -->
  14. <select id="getBusinessComplaintInfo" parameterType="Map" resultType="Map">
  15. select t.operate,t.complaint_id,t.complaint_id complaintId,t.type_cd,t.type_cd
  16. typeCd,t.context,t.complaint_name,t.complaint_name complaintName,t.tel,t.state,t.store_id,t.store_id
  17. storeId,t.b_id,t.b_id bId,t.room_id,t.room_id roomId,t.community_id,t.community_id communityId,
  18. t.start_user_id,t.start_user_id startUserId
  19. from business_complaint t
  20. where 1 =1
  21. <if test="operate !=null and operate != ''">
  22. and t.operate= #{operate}
  23. </if>
  24. <if test="complaintId !=null and complaintId != ''">
  25. and t.complaint_id= #{complaintId}
  26. </if>
  27. <if test="typeCd !=null and typeCd != ''">
  28. and t.type_cd= #{typeCd}
  29. </if>
  30. <if test="context !=null and context != ''">
  31. and t.context= #{context}
  32. </if>
  33. <if test="complaintName !=null and complaintName != ''">
  34. and t.complaint_name= #{complaintName}
  35. </if>
  36. <if test="tel !=null and tel != ''">
  37. and t.tel= #{tel}
  38. </if>
  39. <if test="state !=null and state != ''">
  40. and t.state= #{state}
  41. </if>
  42. <if test="storeId !=null and storeId != ''">
  43. and t.store_id= #{storeId}
  44. </if>
  45. <if test="bId !=null and bId != ''">
  46. and t.b_id= #{bId}
  47. </if>
  48. <if test="roomId !=null and roomId != ''">
  49. and t.room_id= #{roomId}
  50. </if>
  51. <if test="communityId !=null and communityId != ''">
  52. and t.community_id= #{communityId}
  53. </if>
  54. </select>
  55. <!-- 保存投诉建议信息至 instance表中 add by wuxw 2018-07-03 -->
  56. <insert id="saveComplaintInfoInstance" parameterType="Map">
  57. insert into complaint(
  58. complaint_id,type_cd,context,complaint_name,tel,status_cd,state,store_id,b_id,room_id,community_id,
  59. start_user_id
  60. ) select t.complaint_id,t.type_cd,t.context,t.complaint_name,t.tel,'0',t.state,t.store_id,t.b_id,t.room_id,
  61. t.community_id,t.start_user_id
  62. from
  63. business_complaint t where 1=1
  64. and t.operate= 'ADD'
  65. <if test="complaintId !=null and complaintId != ''">
  66. and t.complaint_id= #{complaintId}
  67. </if>
  68. <if test="typeCd !=null and typeCd != ''">
  69. and t.type_cd= #{typeCd}
  70. </if>
  71. <if test="context !=null and context != ''">
  72. and t.context= #{context}
  73. </if>
  74. <if test="complaintName !=null and complaintName != ''">
  75. and t.complaint_name= #{complaintName}
  76. </if>
  77. <if test="tel !=null and tel != ''">
  78. and t.tel= #{tel}
  79. </if>
  80. <if test="state !=null and state != ''">
  81. and t.state= #{state}
  82. </if>
  83. <if test="storeId !=null and storeId != ''">
  84. and t.store_id= #{storeId}
  85. </if>
  86. <if test="bId !=null and bId != ''">
  87. and t.b_id= #{bId}
  88. </if>
  89. <if test="roomId !=null and roomId != ''">
  90. and t.room_id= #{roomId}
  91. </if>
  92. </insert>
  93. <!-- 查询投诉建议信息 add by wuxw 2018-07-03 -->
  94. <select id="getComplaintInfo" parameterType="Map" resultType="Map">
  95. select t.complaint_id,t.complaint_id complaintId,t.type_cd,t.type_cd
  96. typeCd,td2.name typeCdName,t.context,t.complaint_name,t.complaint_name
  97. complaintName,t.tel,t.status_cd,t.status_cd
  98. statusCd,t.state,td.name stateName,t.store_id,t.store_id storeId,t.b_id,t.b_id bId,t.room_id,t.room_id
  99. roomId,t.create_time createTime,t.community_id,t.community_id communityId,
  100. t.start_user_id,t.start_user_id startUserId
  101. from complaint t,t_dict td,t_dict td2
  102. where 1 =1
  103. and t.state = td.status_cd
  104. and td.table_name = 'complaint'
  105. and td.table_columns = 'state'
  106. and t.type_cd = td2.status_cd
  107. and td2.table_name = 'complaint'
  108. and td2.table_columns = 'type_cd'
  109. <if test="complaintId !=null and complaintId != ''">
  110. and t.complaint_id= #{complaintId}
  111. </if>
  112. <if test="complaintIds != null ">
  113. and t.complaint_id in
  114. <foreach collection="complaintIds" item="item" open="(" close=")" separator=",">
  115. #{item}
  116. </foreach>
  117. </if>
  118. <if test="typeCd !=null and typeCd != ''">
  119. and t.type_cd= #{typeCd}
  120. </if>
  121. <if test="context !=null and context != ''">
  122. and t.context= #{context}
  123. </if>
  124. <if test="complaintName !=null and complaintName != ''">
  125. and t.complaint_name= #{complaintName}
  126. </if>
  127. <if test="tel !=null and tel != ''">
  128. and t.tel= #{tel}
  129. </if>
  130. <if test="statusCd !=null and statusCd != ''">
  131. and t.status_cd= #{statusCd}
  132. </if>
  133. <if test="state !=null and state != ''">
  134. and t.state= #{state}
  135. </if>
  136. <if test="storeId !=null and storeId != ''">
  137. and t.store_id= #{storeId}
  138. </if>
  139. <if test="bId !=null and bId != ''">
  140. and t.b_id= #{bId}
  141. </if>
  142. <if test="roomId !=null and roomId != ''">
  143. and t.room_id= #{roomId}
  144. </if>
  145. <if test="roomIds != null ">
  146. and t.room_id in
  147. <foreach collection="roomIds" item="item" open="(" close=")" separator=",">
  148. #{item}
  149. </foreach>
  150. </if>
  151. <if test="communityId !=null and communityId != ''">
  152. and t.community_id= #{communityId}
  153. </if>
  154. <if test="startUserId !=null and startUserId != ''">
  155. and t.start_user_id= #{startUserId}
  156. </if>
  157. <if test="startTime !=null and startTime != ''">
  158. and t.create_time &gt;= #{startTime}
  159. </if>
  160. <if test="endTime !=null and endTime != ''">
  161. and t.create_time &lt;= #{endTime}
  162. </if>
  163. order by t.create_time desc
  164. <if test="page != -1 and page != null ">
  165. limit #{page}, #{row}
  166. </if>
  167. </select>
  168. <!-- 修改投诉建议信息 add by wuxw 2018-07-03 -->
  169. <update id="updateComplaintInfoInstance" parameterType="Map">
  170. update complaint t set t.status_cd = #{statusCd}
  171. <if test="newBId != null and newBId != ''">
  172. ,t.b_id = #{newBId}
  173. </if>
  174. <if test="typeCd !=null and typeCd != ''">
  175. , t.type_cd= #{typeCd}
  176. </if>
  177. <if test="context !=null and context != ''">
  178. , t.context= #{context}
  179. </if>
  180. <if test="complaintName !=null and complaintName != ''">
  181. , t.complaint_name= #{complaintName}
  182. </if>
  183. <if test="tel !=null and tel != ''">
  184. , t.tel= #{tel}
  185. </if>
  186. <if test="state !=null and state != ''">
  187. , t.state= #{state}
  188. </if>
  189. <if test="storeId !=null and storeId != ''">
  190. , t.store_id= #{storeId}
  191. </if>
  192. <if test="roomId !=null and roomId != ''">
  193. , t.room_id= #{roomId}
  194. </if>
  195. where 1=1
  196. <if test="complaintId !=null and complaintId != ''">
  197. and t.complaint_id= #{complaintId}
  198. </if>
  199. <if test="communityId !=null and communityId != ''">
  200. and t.community_id= #{communityId}
  201. </if>
  202. <if test="bId !=null and bId != ''">
  203. and t.b_id= #{bId}
  204. </if>
  205. </update>
  206. <!-- 查询投诉建议数量 add by wuxw 2018-07-03 -->
  207. <select id="queryComplaintsCount" parameterType="Map" resultType="Map">
  208. select count(1) count
  209. from complaint t,t_dict td,t_dict td2
  210. where 1 =1
  211. and t.state = td.status_cd
  212. and td.table_name = 'complaint'
  213. and td.table_columns = 'state'
  214. and t.type_cd = td2.status_cd
  215. and td2.table_name = 'complaint'
  216. and td2.table_columns = 'type_cd'
  217. <if test="complaintId !=null and complaintId != ''">
  218. and t.complaint_id= #{complaintId}
  219. </if>
  220. <if test="complaintIds != null ">
  221. and t.complaint_id in
  222. <foreach collection="complaintIds" item="item" open="(" close=")" separator=",">
  223. #{item}
  224. </foreach>
  225. </if>
  226. <if test="typeCd !=null and typeCd != ''">
  227. and t.type_cd= #{typeCd}
  228. </if>
  229. <if test="context !=null and context != ''">
  230. and t.context= #{context}
  231. </if>
  232. <if test="complaintName !=null and complaintName != ''">
  233. and t.complaint_name= #{complaintName}
  234. </if>
  235. <if test="tel !=null and tel != ''">
  236. and t.tel= #{tel}
  237. </if>
  238. <if test="statusCd !=null and statusCd != ''">
  239. and t.status_cd= #{statusCd}
  240. </if>
  241. <if test="state !=null and state != ''">
  242. and t.state= #{state}
  243. </if>
  244. <if test="storeId !=null and storeId != ''">
  245. and t.store_id= #{storeId}
  246. </if>
  247. <if test="bId !=null and bId != ''">
  248. and t.b_id= #{bId}
  249. </if>
  250. <if test="roomId !=null and roomId != ''">
  251. and t.room_id= #{roomId}
  252. </if>
  253. <if test="roomIds != null ">
  254. and t.room_id in
  255. <foreach collection="roomIds" item="item" open="(" close=")" separator=",">
  256. #{item}
  257. </foreach>
  258. </if>
  259. <if test="communityId !=null and communityId != ''">
  260. and t.community_id= #{communityId}
  261. </if>
  262. <if test="startUserId !=null and startUserId != ''">
  263. and t.start_user_id= #{startUserId}
  264. </if>
  265. <if test="startTime !=null and startTime != ''">
  266. and t.create_time &gt;= #{startTime}
  267. </if>
  268. <if test="endTime !=null and endTime != ''">
  269. and t.create_time &lt;= #{endTime}
  270. </if>
  271. </select>
  272. </mapper>