RepairServiceDaoImplMapper.xml 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  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="repairServiceDaoImpl">
  6. <!-- 保存报修信息信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveBusinessRepairInfo" parameterType="Map">
  8. insert into business_repair_pool(
  9. operate,repair_name,appointment_time,repair_type,context,repair_id,tel,state,community_id,b_id,room_id
  10. ) values (
  11. #{operate},#{repairName},#{appointmentTime},#{repairType},#{context},#{repairId},#{tel},#{state},#{communityId},#{bId},#{roomId}
  12. )
  13. </insert>
  14. <!-- 查询报修信息信息(Business) add by wuxw 2018-07-03 -->
  15. <select id="getBusinessRepairInfo" parameterType="Map" resultType="Map">
  16. select t.operate,t.repair_name,t.repair_name repairName,t.appointment_time,t.appointment_time
  17. appointmentTime,t.repair_type,t.repair_type repairType,t.context,t.repair_id,t.repair_id
  18. repairId,t.tel,t.state,t.community_id,t.community_id communityId,t.b_id,t.b_id bId,t.room_id,t.room_id roomId
  19. from business_repair_pool t
  20. where 1 =1
  21. <if test="operate !=null and operate != ''">
  22. and t.operate= #{operate}
  23. </if>
  24. <if test="repairName !=null and repairName != ''">
  25. and t.repair_name= #{repairName}
  26. </if>
  27. <if test="appointmentTime !=null">
  28. and t.appointment_time= #{appointmentTime}
  29. </if>
  30. <if test="repairType !=null and repairType != ''">
  31. and t.repair_type= #{repairType}
  32. </if>
  33. <if test="context !=null and context != ''">
  34. and t.context= #{context}
  35. </if>
  36. <if test="repairId !=null and repairId != ''">
  37. and t.repair_id= #{repairId}
  38. </if>
  39. <if test="tel !=null and tel != ''">
  40. and t.tel= #{tel}
  41. </if>
  42. <if test="state !=null and state != ''">
  43. and t.state= #{state}
  44. </if>
  45. <if test="communityId !=null and communityId != ''">
  46. and t.community_id= #{communityId}
  47. </if>
  48. <if test="bId !=null and bId != ''">
  49. and t.b_id= #{bId}
  50. </if>
  51. <if test="roomId !=null and roomId != ''">
  52. and t.room_id= #{roomId}
  53. </if>
  54. </select>
  55. <!-- 保存报修信息信息至 instance表中 add by wuxw 2018-07-03 -->
  56. <insert id="saveRepairInfoInstance" parameterType="Map">
  57. insert into r_repair_pool(
  58. repair_name,appointment_time,repair_type,context,repair_id,tel,status_cd,state,community_id,b_id,room_id
  59. ) select
  60. t.repair_name,t.appointment_time,t.repair_type,t.context,t.repair_id,t.tel,'0',t.state,t.community_id,t.b_id,t.room_id
  61. from business_repair_pool t where 1=1
  62. and t.operate= 'ADD'
  63. <if test="repairName !=null and repairName != ''">
  64. and t.repair_name= #{repairName}
  65. </if>
  66. <if test="appointmentTime !=null ">
  67. and t.appointment_time= #{appointmentTime}
  68. </if>
  69. <if test="repairType !=null and repairType != ''">
  70. and t.repair_type= #{repairType}
  71. </if>
  72. <if test="context !=null and context != ''">
  73. and t.context= #{context}
  74. </if>
  75. <if test="repairId !=null and repairId != ''">
  76. and t.repair_id= #{repairId}
  77. </if>
  78. <if test="tel !=null and tel != ''">
  79. and t.tel= #{tel}
  80. </if>
  81. <if test="state !=null and state != ''">
  82. and t.state= #{state}
  83. </if>
  84. <if test="communityId !=null and communityId != ''">
  85. and t.community_id= #{communityId}
  86. </if>
  87. <if test="bId !=null and bId != ''">
  88. and t.b_id= #{bId}
  89. </if>
  90. <if test="roomId !=null and roomId != ''">
  91. and t.room_id= #{roomId}
  92. </if>
  93. </insert>
  94. <!-- 查询报修信息信息 add by wuxw 2018-07-03 -->
  95. <select id="getRepairInfo" parameterType="Map" resultType="Map">
  96. select t.repair_name,t.repair_name repairName,t.appointment_time,t.appointment_time
  97. appointmentTime,t.repair_type,t.repair_type repairType,t.context,t.repair_id,t.repair_id
  98. repairId,t.tel,t.status_cd,t.status_cd statusCd,t.state,t.community_id,t.community_id communityId,t.b_id,t.b_id
  99. bId,t.room_id,t.room_id roomId,
  100. (CASE
  101. WHEN t.`state` = '1000'
  102. THEN '未派单'
  103. WHEN t.state = '1100'
  104. THEN '处理中'
  105. ELSE
  106. '处理完成'
  107. END) stateName,
  108. (CASE
  109. WHEN t.`repair_type` = '10001'
  110. THEN '卧室报修'
  111. WHEN t.repair_type = '10002'
  112. THEN '管道报修'
  113. ELSE
  114. '客厅报修'
  115. END) repairTypeName
  116. <if test="staffId != null and staffId != ''">
  117. ,rru.state repairDispatchState,rru.context repairDispatchContext,td.name repairDispatchStateName
  118. </if>
  119. from r_repair_pool t
  120. <if test="staffId != null and staffId != ''">
  121. ,r_repair_user rru
  122. ,t_dict td
  123. </if>
  124. where 1 =1
  125. <if test="staffId != null and staffId != ''">
  126. and t.repair_id = rru.repair_id
  127. and rru.user_id = #{staffId}
  128. and rru.status_cd = '0'
  129. and td.`table_name` = 'r_repair_user'
  130. AND td.`table_columns` = 'state'
  131. AND td.`status_cd` = rru.state
  132. </if>
  133. <if test="repairName !=null and repairName != ''">
  134. and t.repair_name= #{repairName}
  135. </if>
  136. <if test="appointmentTime !=null ">
  137. and t.appointment_time= #{appointmentTime}
  138. </if>
  139. <if test="repairType !=null and repairType != ''">
  140. and t.repair_type= #{repairType}
  141. </if>
  142. <if test="context !=null and context != ''">
  143. and t.context= #{context}
  144. </if>
  145. <if test="repairId !=null and repairId != ''">
  146. and t.repair_id= #{repairId}
  147. </if>
  148. <if test="tel !=null and tel != ''">
  149. and t.tel= #{tel}
  150. </if>
  151. <if test="statusCd !=null and statusCd != ''">
  152. and t.status_cd= #{statusCd}
  153. </if>
  154. <if test="state !=null and state != ''">
  155. and t.state= #{state}
  156. </if>
  157. <if test="communityId !=null and communityId != ''">
  158. and t.community_id= #{communityId}
  159. </if>
  160. <if test="bId !=null and bId != ''">
  161. and t.b_id= #{bId}
  162. </if>
  163. <if test="roomId !=null and roomId != ''">
  164. and t.room_id= #{roomId}
  165. </if>
  166. <if test="page != -1 and page != null ">
  167. limit #{page}, #{row}
  168. </if>
  169. </select>
  170. <!-- 修改报修信息信息 add by wuxw 2018-07-03 -->
  171. <update id="updateRepairInfoInstance" parameterType="Map">
  172. update r_repair_pool t set t.status_cd = #{statusCd}
  173. <if test="newBId != null and newBId != ''">
  174. ,t.b_id = #{newBId}
  175. </if>
  176. <if test="repairName !=null and repairName != ''">
  177. , t.repair_name= #{repairName}
  178. </if>
  179. <if test="appointmentTime !=null">
  180. , t.appointment_time= #{appointmentTime}
  181. </if>
  182. <if test="repairType !=null and repairType != ''">
  183. , t.repair_type= #{repairType}
  184. </if>
  185. <if test="context !=null and context != ''">
  186. , t.context= #{context}
  187. </if>
  188. <if test="tel !=null and tel != ''">
  189. , t.tel= #{tel}
  190. </if>
  191. <if test="state !=null and state != ''">
  192. , t.state= #{state}
  193. </if>
  194. <if test="communityId !=null and communityId != ''">
  195. , t.community_id= #{communityId}
  196. </if>
  197. <if test="roomId !=null and roomId != ''">
  198. , t.room_id= #{roomId}
  199. </if>
  200. where 1=1
  201. <if test="repairId !=null and repairId != ''">
  202. and t.repair_id= #{repairId}
  203. </if>
  204. <if test="bId !=null and bId != ''">
  205. and t.b_id= #{bId}
  206. </if>
  207. </update>
  208. <!-- 查询报修信息数量 add by wuxw 2018-07-03 -->
  209. <select id="queryRepairsCount" parameterType="Map" resultType="Map">
  210. select count(1) count
  211. from r_repair_pool t
  212. <if test="staffId != null and staffId != ''">
  213. ,r_repair_user rru
  214. ,t_dict td
  215. </if>
  216. where 1 =1
  217. <if test="staffId != null and staffId != ''">
  218. and t.repair_id = rru.repair_id
  219. and rru.user_id = #{staffId}
  220. and rru.status_cd = '0'
  221. and td.`table_name` = 'r_repair_user'
  222. AND td.`table_columns` = 'state'
  223. AND td.`status_cd` = rru.state
  224. </if>
  225. <if test="repairName !=null and repairName != ''">
  226. and t.repair_name= #{repairName}
  227. </if>
  228. <if test="appointmentTime !=null ">
  229. and t.appointment_time= #{appointmentTime}
  230. </if>
  231. <if test="repairType !=null and repairType != ''">
  232. and t.repair_type= #{repairType}
  233. </if>
  234. <if test="context !=null and context != ''">
  235. and t.context= #{context}
  236. </if>
  237. <if test="repairId !=null and repairId != ''">
  238. and t.repair_id= #{repairId}
  239. </if>
  240. <if test="tel !=null and tel != ''">
  241. and t.tel= #{tel}
  242. </if>
  243. <if test="statusCd !=null and statusCd != ''">
  244. and t.status_cd= #{statusCd}
  245. </if>
  246. <if test="state !=null and state != ''">
  247. and t.state= #{state}
  248. </if>
  249. <if test="communityId !=null and communityId != ''">
  250. and t.community_id= #{communityId}
  251. </if>
  252. <if test="bId !=null and bId != ''">
  253. and t.b_id= #{bId}
  254. </if>
  255. <if test="roomId !=null and roomId != ''">
  256. and t.room_id= #{roomId}
  257. </if>
  258. </select>
  259. </mapper>