RepairUserServiceDaoImplMapper.xml 8.3 KB

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