RepairApplicationFormMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.platform.dao.mapper.repair.RepairApplicationFormMapper">
  4. <sql id="Base_Column_List">
  5. application.*,
  6. user.real_name as userName,
  7. user2.real_name as repairUserName,
  8. user3.real_name as checkUserName,
  9. sb.model as model,
  10. sb.name as sbName,part.name as partName,
  11. sb.no as sbNo, sb.cph as sbCph, sb.model_id as modelId,
  12. error.name as repairErrorTypeName
  13. </sql>
  14. <select id="selectPageList" parameterType="com.platform.dao.dto.repair.RepairApplicationFormDTO"
  15. resultType="com.platform.dao.vo.repair.RepairApplicationFormVO">
  16. select
  17. <include refid="Base_Column_List"/>
  18. from t_repair_application_form application
  19. left join t_sys_user user on application.user_id = user.user_id
  20. left join t_sys_user user2 on application.repair_user_id = user2.user_id
  21. left join t_sys_user user3 on application.check_user_id = user3.user_id
  22. left join t_sb_info sb on application.sb_id = sb.id
  23. left join t_error_type error on application.repair_error_type_id = error.id
  24. left join t_part_info part on application.part_id = part.id
  25. <where>
  26. <if test="keyword != null and keyword != ''">
  27. and ( sb.name like concat('%',#{keyword},'%') or
  28. sb.no like concat('%',#{keyword},'%') or
  29. application.content like concat('%',#{keyword},'%') )
  30. </if>
  31. <if test="content != null and content != ''">
  32. and application.content like concat('%',#{content},'%')
  33. </if>
  34. <if test="sbId != null and sbId != ''">
  35. and application.sb_id = #{sbId}
  36. </if>
  37. <if test="category != null and category != ''">
  38. and application.category = #{category}
  39. </if>
  40. <if test="categoryList != null and categoryList.size > 0">
  41. AND application.category in
  42. <foreach item="item" index="index" collection="categoryList" open="(" close=")" separator=",">
  43. #{item}
  44. </foreach>
  45. </if>
  46. <if test="zbh != null and zbh != ''">
  47. and sb.zbh = #{zbh}
  48. </if>
  49. <if test="no != null and no != ''">
  50. and application.no = #{no}
  51. </if>
  52. <if test="planFlag != null and planFlag != ''">
  53. and application.plan_flag = #{planFlag}
  54. </if>
  55. <if test="status != null and status != ''">
  56. and application.status = #{status}
  57. </if>
  58. <if test="actualUser != null and actualUser != ''">
  59. and application.actual_user = #{actualUser}
  60. </if>
  61. <if test="mainRepairId != null and mainRepairId != ''">
  62. and application.main_repair_id = #{mainRepairId}
  63. </if>
  64. <if test="outType != null and outType != ''">
  65. and application.out_type = #{outType}
  66. </if>
  67. <if test="type != null and type != ''">
  68. and application.type = #{type}
  69. </if>
  70. <if test="status != null and status != ''">
  71. and application.status = #{status}
  72. </if>
  73. <if test="userId != null and userId != ''">
  74. and application.user_id = #{userId}
  75. </if>
  76. <!--<if test="repairUserId != null and repairUserId != ''">
  77. <if test="repairUserIdOrNoAssignFlag != null and repairUserIdOrNoAssignFlag == true">
  78. and (application.repair_user_id = #{repairUserId} or application.repair_user_id is null)
  79. </if>
  80. <if test="repairUserIdOrNoAssignFlag == null || repairUserIdOrNoAssignFlag == false">
  81. and (application.repair_user_id = #{repairUserId} or sb.repair_user_second = #{repairUserId} )
  82. </if>
  83. </if>-->
  84. <if test="repairUserId != null and repairUserId != ''">
  85. and application.repair_user_id = #{repairUserId}
  86. </if>
  87. <if test="checkUserId != null and checkUserId != ''">
  88. and application.check_user_id = #{checkUserId}
  89. </if>
  90. <if test="repairUserName != null and repairUserName != ''">
  91. and user2.real_name like concat('%',#{repairUserName},'%')
  92. </if>
  93. <if test="searchStartTime != null">
  94. and application.apply_time <![CDATA[ >= ]]> #{searchStartTime}
  95. </if>
  96. <if test="searchEndTime != null">
  97. and application.apply_time <![CDATA[ <= ]]> #{searchEndTime}
  98. </if>
  99. <!-- 新增查询参数 -->
  100. <if test="statusList != null and statusList.size > 0">
  101. AND application.status in
  102. <foreach item="item" index="index" collection="statusList" open="(" close=")" separator=",">
  103. #{item}
  104. </foreach>
  105. </if>
  106. <if test="repairStartTimeStart != null">
  107. and application.repair_start_time <![CDATA[ > ]]> #{repairStartTimeStart}
  108. </if>
  109. <if test="repairStartTimeEnd != null">
  110. and application.repair_start_time <![CDATA[ < ]]> #{repairStartTimeEnd}
  111. </if>
  112. </where>
  113. </select>
  114. <select id="selectById" parameterType="java.lang.Object"
  115. resultType="com.platform.dao.entity.repair.RepairApplicationForm">
  116. select
  117. <include refid="Base_Column_List"/>
  118. from t_repair_application_form application
  119. left join t_sys_user user on application.user_id = user.user_id
  120. left join t_sys_user user2 on application.repair_user_id = user2.user_id
  121. left join t_sys_user user3 on application.check_user_id = user3.user_id
  122. left join t_sb_info sb on application.sb_id = sb.id
  123. left join t_part_info part on application.part_id = part.id
  124. left join t_error_type error on application.repair_error_type_id = error.id
  125. where application.id = #{id,jdbcType=VARCHAR}
  126. </select>
  127. <select id="selectNoById" parameterType="java.lang.Object" resultType="java.lang.String">
  128. select no
  129. from t_repair_application_form
  130. where id = #{id,jdbcType=VARCHAR}
  131. </select>
  132. <!-- 维修统计数据 -->
  133. <select id="getWorkplaceRepairData" parameterType="com.platform.dao.dto.repair.RepairApplicationFormDTO"
  134. resultType="com.platform.dao.vo.repair.RepairApplicationFormVO">
  135. select count(1) as tempTotalNum,rf.status from t_repair_application_form rf
  136. <where>
  137. <if test="repairUserId != null">
  138. and rf.repair_user_id = #{repairUserId}
  139. </if>
  140. <if test="searchTime != null">
  141. and rf.repair_start_time like concat('',#{searchTime},'%')
  142. </if>
  143. <if test="type != null">
  144. and rf.type = #{type}
  145. </if>
  146. </where>
  147. group by rf.status
  148. </select>
  149. <!-- 维修统计数据 -->
  150. <select id="getCurrentlyList" parameterType="com.platform.dao.dto.repair.RepairApplicationFormDTO"
  151. resultType="com.platform.dao.vo.repair.RepairApplicationFormVO">
  152. select * from t_repair_application_form
  153. <where>
  154. <if test="searchStartTime != null">
  155. and repair_start_time <![CDATA[>]]> #{searchStartTime}
  156. </if>
  157. <if test="searchEndTime != null">
  158. and repair_start_time <![CDATA[<]]> #{searchEndTime}
  159. </if>
  160. <if test="repairUserId != null">
  161. and repair_user_id = #{repairUserId}
  162. </if>
  163. </where>
  164. </select>
  165. <!-- 近月统计单数和费用 -->
  166. <select id="getWorkplaceRepairSumData" parameterType="com.platform.dao.dto.repair.RepairApplicationFormDTO"
  167. resultType="com.platform.dao.vo.repair.RepairApplicationFormVO">
  168. select count(1) as tempTotalNum from t_repair_application_form rf
  169. <where>
  170. <if test="repairUserId != null">
  171. and rf.repair_user_id = #{repairUserId}
  172. </if>
  173. <if test="searchStartTime != null">
  174. and rf.repair_start_time <![CDATA[>]]> #{searchStartTime}
  175. </if>
  176. <if test="searchEndTime != null">
  177. and rf.repair_start_time <![CDATA[<]]> #{searchEndTime}
  178. </if>
  179. <if test="type != null">
  180. and rf.type = #{type}
  181. </if>
  182. </where>
  183. </select>
  184. <!-- 修改派工维修单 -->
  185. <update id="updateForRepairDispatch" parameterType="com.platform.dao.entity.repair.RepairApplicationForm">
  186. update t_repair_application_form
  187. <set>
  188. repair_end_time = null,
  189. <if test="sbId != null">
  190. sb_id = #{sbId},
  191. </if>
  192. <if test="needStop != null">
  193. need_stop = #{needStop},
  194. </if>
  195. <if test="no != null">
  196. no = #{no},
  197. </if>
  198. <if test="source != null">
  199. source = #{source},
  200. </if>
  201. <if test="applyTime != null">
  202. apply_time = #{applyTime},
  203. </if>
  204. <if test="level != null">
  205. level = #{level},
  206. </if>
  207. <if test="content != null">
  208. content = #{content},
  209. </if>
  210. <if test="status != null">
  211. status= #{status},
  212. </if>
  213. <if test="repairStartTime != null">
  214. repair_start_time = #{repairStartTime},
  215. </if>
  216. <if test="repairDispatchList != null">
  217. repair_dispatch_list = #{repairDispatchList},
  218. </if>
  219. <if test="repairDispatchRemark != null">
  220. repair_dispatch_remark = #{repairDispatchRemark},
  221. </if>
  222. <if test="receiveMinutes != null">
  223. receive_minutes = #{receiveMinutes},
  224. </if>
  225. <if test="repairMinutes != null">
  226. repair_minutes = #{repairMinutes},
  227. </if>
  228. <if test="dealMinutes != null">
  229. deal_minutes = #{dealMinutes},
  230. </if>
  231. <if test="repairOvertime != null">
  232. repair_overtime = #{repairOvertime},
  233. </if>
  234. <if test="receiveOvertime != null">
  235. receive_overtime = #{receiveOvertime},
  236. </if>
  237. <if test="userId != null">
  238. user_id = #{userId},
  239. </if>
  240. <if test="repairUserId != null">
  241. repair_user_id = #{repairUserId},
  242. </if>
  243. <if test="checkUserId != null">
  244. check_user_id = #{checkUserId},
  245. </if>
  246. <if test="checkStartTime != null">
  247. check_start_time = #{checkStartTime},
  248. </if>
  249. <if test="checkContent != null">
  250. check_content = #{checkContent},
  251. </if>
  252. <if test="createdTime != null">
  253. created_time = #{createdTime},
  254. </if>
  255. <if test="updateTime != null">
  256. update_time = #{updateTime},
  257. </if>
  258. <if test="actualUser != null">
  259. actual_user = #{actualUser},
  260. </if>
  261. <if test="type != null">
  262. type = #{type},
  263. </if>
  264. </set>
  265. where id = #{id}
  266. </update>
  267. </mapper>