ComplaintServiceDaoImplMapper.xml 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  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="complaintServiceDaoImpl">
  6. <!-- 保存投诉建议信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveBusinessComplaintInfo" parameterType="Map">
  8. insert into business_complaint(
  9. operate,complaint_id,type_cd,context,complaint_name,tel,state,store_id,b_id,room_id
  10. ) values (
  11. #{operate},#{complaintId},#{typeCd},#{context},#{complaintName},#{tel},#{state},#{storeId},#{bId},#{roomId}
  12. )
  13. </insert>
  14. <!-- 查询投诉建议信息(Business) add by wuxw 2018-07-03 -->
  15. <select id="getBusinessComplaintInfo" parameterType="Map" resultType="Map">
  16. select t.operate,t.complaint_id,t.complaint_id complaintId,t.type_cd,t.type_cd
  17. typeCd,t.context,t.complaint_name,t.complaint_name complaintName,t.tel,t.state,t.store_id,t.store_id
  18. storeId,t.b_id,t.b_id bId,t.room_id,t.room_id roomId
  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. </select>
  52. <!-- 保存投诉建议信息至 instance表中 add by wuxw 2018-07-03 -->
  53. <insert id="saveComplaintInfoInstance" parameterType="Map">
  54. insert into complaint(
  55. complaint_id,type_cd,context,complaint_name,tel,status_cd,state,store_id,b_id,room_id
  56. ) 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 from
  57. business_complaint t where 1=1
  58. and t.operate= 'ADD'
  59. <if test="complaintId !=null and complaintId != ''">
  60. and t.complaint_id= #{complaintId}
  61. </if>
  62. <if test="typeCd !=null and typeCd != ''">
  63. and t.type_cd= #{typeCd}
  64. </if>
  65. <if test="context !=null and context != ''">
  66. and t.context= #{context}
  67. </if>
  68. <if test="complaintName !=null and complaintName != ''">
  69. and t.complaint_name= #{complaintName}
  70. </if>
  71. <if test="tel !=null and tel != ''">
  72. and t.tel= #{tel}
  73. </if>
  74. <if test="state !=null and state != ''">
  75. and t.state= #{state}
  76. </if>
  77. <if test="storeId !=null and storeId != ''">
  78. and t.store_id= #{storeId}
  79. </if>
  80. <if test="bId !=null and bId != ''">
  81. and t.b_id= #{bId}
  82. </if>
  83. <if test="roomId !=null and roomId != ''">
  84. and t.room_id= #{roomId}
  85. </if>
  86. </insert>
  87. <!-- 查询投诉建议信息 add by wuxw 2018-07-03 -->
  88. <select id="getComplaintInfo" parameterType="Map" resultType="Map">
  89. select t.complaint_id,t.complaint_id complaintId,t.type_cd,t.type_cd
  90. typeCd,td2.name typeCdName,t.context,t.complaint_name,t.complaint_name complaintName,t.tel,t.status_cd,t.status_cd
  91. 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 roomId
  92. from complaint t,t_dict td,t_dict td2
  93. where 1 =1
  94. and t.state = td.status_cd
  95. and td.table_name = 'complaint'
  96. and td.table_columns = 'state'
  97. and t.type_cd = td2.status_cd
  98. and td2.table_name = 'complaint'
  99. and td2.table_columns = 'type_cd'
  100. <if test="complaintId !=null and complaintId != ''">
  101. and t.complaint_id= #{complaintId}
  102. </if>
  103. <if test="complaintIds != null ">
  104. and t.complaint_id in
  105. <foreach collection="complaintIds" item="item" open="(" close=")" separator=",">
  106. #{item}
  107. </foreach>
  108. </if>
  109. <if test="typeCd !=null and typeCd != ''">
  110. and t.type_cd= #{typeCd}
  111. </if>
  112. <if test="context !=null and context != ''">
  113. and t.context= #{context}
  114. </if>
  115. <if test="complaintName !=null and complaintName != ''">
  116. and t.complaint_name= #{complaintName}
  117. </if>
  118. <if test="tel !=null and tel != ''">
  119. and t.tel= #{tel}
  120. </if>
  121. <if test="statusCd !=null and statusCd != ''">
  122. and t.status_cd= #{statusCd}
  123. </if>
  124. <if test="state !=null and state != ''">
  125. and t.state= #{state}
  126. </if>
  127. <if test="storeId !=null and storeId != ''">
  128. and t.store_id= #{storeId}
  129. </if>
  130. <if test="bId !=null and bId != ''">
  131. and t.b_id= #{bId}
  132. </if>
  133. <if test="roomId !=null and roomId != ''">
  134. and t.room_id= #{roomId}
  135. </if>
  136. order by t.create_time desc
  137. <if test="page != -1 and page != null ">
  138. limit #{page}, #{row}
  139. </if>
  140. </select>
  141. <!-- 修改投诉建议信息 add by wuxw 2018-07-03 -->
  142. <update id="updateComplaintInfoInstance" parameterType="Map">
  143. update complaint t set t.status_cd = #{statusCd}
  144. <if test="newBId != null and newBId != ''">
  145. ,t.b_id = #{newBId}
  146. </if>
  147. <if test="typeCd !=null and typeCd != ''">
  148. , t.type_cd= #{typeCd}
  149. </if>
  150. <if test="context !=null and context != ''">
  151. , t.context= #{context}
  152. </if>
  153. <if test="complaintName !=null and complaintName != ''">
  154. , t.complaint_name= #{complaintName}
  155. </if>
  156. <if test="tel !=null and tel != ''">
  157. , t.tel= #{tel}
  158. </if>
  159. <if test="state !=null and state != ''">
  160. , t.state= #{state}
  161. </if>
  162. <if test="storeId !=null and storeId != ''">
  163. , t.store_id= #{storeId}
  164. </if>
  165. <if test="roomId !=null and roomId != ''">
  166. , t.room_id= #{roomId}
  167. </if>
  168. where 1=1
  169. <if test="complaintId !=null and complaintId != ''">
  170. and t.complaint_id= #{complaintId}
  171. </if>
  172. <if test="bId !=null and bId != ''">
  173. and t.b_id= #{bId}
  174. </if>
  175. </update>
  176. <!-- 查询投诉建议数量 add by wuxw 2018-07-03 -->
  177. <select id="queryComplaintsCount" parameterType="Map" resultType="Map">
  178. select count(1) count
  179. from complaint t
  180. where 1 =1
  181. <if test="complaintId !=null and complaintId != ''">
  182. and t.complaint_id= #{complaintId}
  183. </if>
  184. <if test="complaintIds != null ">
  185. and t.complaint_id in
  186. <foreach collection="complaintIds" item="item" open="(" close=")" separator=",">
  187. #{item}
  188. </foreach>
  189. </if>
  190. <if test="typeCd !=null and typeCd != ''">
  191. and t.type_cd= #{typeCd}
  192. </if>
  193. <if test="context !=null and context != ''">
  194. and t.context= #{context}
  195. </if>
  196. <if test="complaintName !=null and complaintName != ''">
  197. and t.complaint_name= #{complaintName}
  198. </if>
  199. <if test="tel !=null and tel != ''">
  200. and t.tel= #{tel}
  201. </if>
  202. <if test="statusCd !=null and statusCd != ''">
  203. and t.status_cd= #{statusCd}
  204. </if>
  205. <if test="state !=null and state != ''">
  206. and t.state= #{state}
  207. </if>
  208. <if test="storeId !=null and storeId != ''">
  209. and t.store_id= #{storeId}
  210. </if>
  211. <if test="bId !=null and bId != ''">
  212. and t.b_id= #{bId}
  213. </if>
  214. <if test="roomId !=null and roomId != ''">
  215. and t.room_id= #{roomId}
  216. </if>
  217. </select>
  218. </mapper>