RepairUserServiceDaoImplMapper.xml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  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="repairUserServiceDaoImpl">
  6. <!-- 保存报修派单信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveBusinessRepairUserInfo" parameterType="Map">
  8. insert into business_repair_user(
  9. operate,context,repair_id,ru_id,state,community_id,b_id,staff_id,staff_name,pre_staff_id,
  10. pre_staff_name,repair_event,end_time,start_time,pre_ru_id
  11. ) values (
  12. #{operate},#{context},#{repairId},#{ruId},#{state},#{communityId},#{bId},#{staffId},
  13. #{staffName},#{preStaffId},#{preStaffName},#{repairEvent},#{endTime},#{startTime},#{preRuId}
  14. )
  15. </insert>
  16. <!-- 保存报修派单信息 add by fqz 2021-04-02 -->
  17. <insert id="saveRepairUser" parameterType="Map">
  18. insert into r_repair_user(
  19. context,repair_id,ru_id,state,community_id,b_id,staff_id,staff_name,pre_staff_id,
  20. pre_staff_name,repair_event,end_time,start_time,pre_ru_id,create_time
  21. ) values (
  22. #{context},#{repairId},#{ruId},#{state},#{communityId},#{bId},#{staffId},
  23. #{staffName},#{preStaffId},#{preStaffName},#{repairEvent},#{endTime},#{startTime},#{preRuId},#{createTime}
  24. )
  25. </insert>
  26. <!-- 查询报修派单信息(Business) add by wuxw 2018-07-03 -->
  27. <select id="getBusinessRepairUserInfo" parameterType="Map" resultType="Map">
  28. select t.operate,t.context,t.repair_id,t.repair_id repairId,t.ru_id,t.ru_id
  29. ruId,t.state,t.community_id,t.community_id communityId,t.b_id,t.b_id bId,
  30. t.staff_id,t.staff_id staffId,t.staff_name,t.staff_name staffName,
  31. t.pre_staff_id,t.pre_staff_id preStaffId,t.pre_staff_name,t.pre_staff_name preStaffName,
  32. t.start_time,t.start_time startTime,t.end_time,t.end_time endTime,t.repair_event,
  33. t.repair_event repairEvent, t.pre_ru_id,t.pre_ru_id preRuId
  34. from business_repair_user t
  35. where 1 =1
  36. <if test="operate !=null and operate != ''">
  37. and t.operate= #{operate}
  38. </if>
  39. <if test="context !=null and context != ''">
  40. and t.context= #{context}
  41. </if>
  42. <if test="repairId !=null and repairId != ''">
  43. and t.repair_id= #{repairId}
  44. </if>
  45. <if test="ruId !=null and ruId != ''">
  46. and t.ru_id= #{ruId}
  47. </if>
  48. <if test="state !=null and state != ''">
  49. and t.state= #{state}
  50. </if>
  51. <if test="communityId !=null and communityId != ''">
  52. and t.community_id= #{communityId}
  53. </if>
  54. <if test="bId !=null and bId != ''">
  55. and t.b_id= #{bId}
  56. </if>
  57. </select>
  58. <!-- 保存报修派单信息至 instance表中 add by wuxw 2018-07-03 -->
  59. <insert id="saveRepairUserInfoInstance" parameterType="Map">
  60. insert into r_repair_user(
  61. context,repair_id,status_cd,ru_id,state,community_id,b_id,staff_id,staff_name,pre_staff_id,
  62. pre_staff_name,repair_event,start_time,end_time,pre_ru_id
  63. ) select t.context,t.repair_id,'0',t.ru_id,t.state,t.community_id,t.b_id,t.staff_id,t.staff_name,
  64. t.pre_staff_id,t.pre_staff_name,t.repair_event,t.start_time,t.end_time,t.pre_ru_id
  65. from business_repair_user t
  66. where 1=1
  67. and t.operate= 'ADD'
  68. <if test="context !=null and context != ''">
  69. and t.context= #{context}
  70. </if>
  71. <if test="repairId !=null and repairId != ''">
  72. and t.repair_id= #{repairId}
  73. </if>
  74. <if test="ruId !=null and ruId != ''">
  75. and t.ru_id= #{ruId}
  76. </if>
  77. <if test="state !=null and state != ''">
  78. and t.state= #{state}
  79. </if>
  80. <if test="communityId !=null and communityId != ''">
  81. and t.community_id= #{communityId}
  82. </if>
  83. <if test="bId !=null and bId != ''">
  84. and t.b_id= #{bId}
  85. </if>
  86. <if test="userId !=null and userId != ''">
  87. and t.user_id= #{userId}
  88. </if>
  89. </insert>
  90. <!-- 查询报修派单信息 add by wuxw 2018-07-03 -->
  91. <select id="getRepairUserInfo" parameterType="Map" resultType="Map">
  92. select t.context,t.repair_id,t.repair_id repairId,t.status_cd,t.status_cd statusCd,
  93. t.ru_id,t.ru_id ruId,t.state,t.community_id,t.community_id communityId,t.b_id,
  94. t.b_id bId,t.staff_id,t.staff_id staffId,t.staff_name,t.staff_name staffName,
  95. t.pre_staff_id,t.pre_staff_id preStaffId,t.pre_staff_name,t.pre_staff_name preStaffName,
  96. t.start_time,t.start_time startTime,t.end_time,t.end_time endTime,d.name stateName,
  97. t.repair_event,t.repair_event repairEvent, t.pre_ru_id,t.pre_ru_id preRuId,t.create_time createTime,
  98. rp.pay_type payType,d2.name payTypeName,rp.repair_name repairName
  99. from r_repair_user t
  100. left join r_repair_pool rp on t.repair_id = rp.repair_id and t.state in ('10009','12000')
  101. left join t_dict d on t.state = d.status_cd and d.table_name = 'r_repair_user' and d.table_columns = 'state'
  102. left join t_dict d2 on rp.pay_type = d2.status_cd and d2.table_name = 'r_repair_pool' and d2.table_columns = 'pay_type'
  103. where 1 = 1
  104. <if test="context !=null and context != ''">
  105. and t.context= #{context}
  106. </if>
  107. <if test="repairId !=null and repairId != ''">
  108. and t.repair_id= #{repairId}
  109. </if>
  110. <if test="repairIds !=null">
  111. and t.repair_id in
  112. <foreach collection="repairIds" item="item" open="(" close=")" separator=",">
  113. #{item}
  114. </foreach>
  115. </if>
  116. <if test="statusCd !=null and statusCd != ''">
  117. and t.status_cd= #{statusCd}
  118. </if>
  119. <if test="ruId !=null and ruId != ''">
  120. and t.ru_id= #{ruId}
  121. </if>
  122. <if test="state !=null and state != ''">
  123. and t.state= #{state}
  124. </if>
  125. <if test="states !=null ">
  126. and t.state in
  127. <foreach collection="states" item="item" open="(" close=")" separator=",">
  128. #{item}
  129. </foreach>
  130. </if>
  131. <if test="communityId !=null and communityId != ''">
  132. and t.community_id= #{communityId}
  133. </if>
  134. <if test="bId !=null and bId != ''">
  135. and t.b_id= #{bId}
  136. </if>
  137. <if test="staffId !=null and staffId != ''">
  138. and t.staff_id= #{staffId}
  139. </if>
  140. <if test="repairEvent !=null and repairEvent != ''">
  141. and t.repair_event= #{repairEvent}
  142. </if>
  143. <if test="preStaffId !=null and preStaffId != ''">
  144. and t.pre_staff_id= #{preStaffId}
  145. </if>
  146. <if test="preRuId !=null and preRuId != ''">
  147. and t.pre_ru_id= #{preRuId}
  148. </if>
  149. order by t.start_time
  150. <if test="page != -1 and page != null ">
  151. limit #{page}, #{row}
  152. </if>
  153. </select>
  154. <!-- 修改报修派单信息 add by wuxw 2018-07-03 -->
  155. <update id="updateRepairUserInfoInstance" parameterType="Map">
  156. update r_repair_user t set t.status_cd = #{statusCd}
  157. <if test="newBId != null and newBId != ''">
  158. ,t.b_id = #{newBId}
  159. </if>
  160. <if test="context !=null and context != ''">
  161. , t.context= #{context}
  162. </if>
  163. <if test="state !=null and state != ''">
  164. , t.state= #{state}
  165. </if>
  166. <if test="communityId !=null and communityId != ''">
  167. , t.community_id= #{communityId}
  168. </if>
  169. <if test="endTime !=null ">
  170. , t.end_time= #{endTime}
  171. </if>
  172. <if test="startTime !=null ">
  173. , t.start_time= #{startTime}
  174. </if>
  175. <if test="staffName !=null and staffName != ''">
  176. , t.staff_name= #{staffName}
  177. </if>
  178. where 1=1
  179. <if test="ruId !=null and ruId != ''">
  180. and t.ru_id= #{ruId}
  181. </if>
  182. <if test="bId !=null and bId != ''">
  183. and t.b_id= #{bId}
  184. </if>
  185. <!--<if test="state !=null and state != ''">
  186. and t.state= #{state}
  187. </if>-->
  188. <if test="staffId !=null and staffId != ''">
  189. and t.staff_id= #{staffId}
  190. </if>
  191. <if test="repairId !=null and repairId != ''">
  192. and t.repair_id= #{repairId}
  193. </if>
  194. </update>
  195. <!-- 查询报修派单数量 add by wuxw 2018-07-03 -->
  196. <select id="queryRepairUsersCount" parameterType="Map" resultType="Map">
  197. select count(1) count
  198. from r_repair_user t
  199. left join r_repair_pool rp on t.repair_id = rp.repair_id and t.state in ('10009','12000')
  200. left join t_dict d on t.state = d.status_cd and d.table_name = 'r_repair_user' and d.table_columns = 'state'
  201. left join t_dict d2 on rp.pay_type = d2.status_cd and d2.table_name = 'r_repair_pool' and d2.table_columns = 'pay_type'
  202. where 1 = 1
  203. <if test="context !=null and context != ''">
  204. and t.context= #{context}
  205. </if>
  206. <if test="repairId !=null and repairId != ''">
  207. and t.repair_id= #{repairId}
  208. </if>
  209. <if test="repairIds !=null">
  210. and t.repair_id in
  211. <foreach collection="repairIds" item="item" open="(" close=")" separator=",">
  212. #{item}
  213. </foreach>
  214. </if>
  215. <if test="statusCd !=null and statusCd != ''">
  216. and t.status_cd= #{statusCd}
  217. </if>
  218. <if test="ruId !=null and ruId != ''">
  219. and t.ru_id= #{ruId}
  220. </if>
  221. <if test="state !=null and state != ''">
  222. and t.state= #{state}
  223. </if>
  224. <if test="states !=null ">
  225. and t.state in
  226. <foreach collection="states" item="item" open="(" close=")" separator=",">
  227. #{item}
  228. </foreach>
  229. </if>
  230. <if test="communityId !=null and communityId != ''">
  231. and t.community_id= #{communityId}
  232. </if>
  233. <if test="bId !=null and bId != ''">
  234. and t.b_id= #{bId}
  235. </if>
  236. <if test="staffId !=null and staffId != ''">
  237. and t.staff_id= #{staffId}
  238. </if>
  239. <if test="repairEvent !=null and repairEvent != ''">
  240. and t.repair_event= #{repairEvent}
  241. </if>
  242. <if test="preStaffId !=null and preStaffId != ''">
  243. and t.pre_staff_id= #{preStaffId}
  244. </if>
  245. <if test="preRuId !=null and preRuId != ''">
  246. and t.pre_ru_id= #{preRuId}
  247. </if>
  248. </select>
  249. </mapper>