RepairApplicationFormMapper.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  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. <if test="dispatchUserId != null">
  113. and application.dispatch_user_id = #{dispatchUserId}
  114. </if>
  115. <if test="checkAllFlag != null and checkAllFlag == 1">
  116. and application.check_user_id is not null
  117. </if>
  118. </where>
  119. </select>
  120. <select id="selectById" parameterType="java.lang.Object"
  121. resultType="com.platform.dao.entity.repair.RepairApplicationForm">
  122. select
  123. <include refid="Base_Column_List"/>
  124. from t_repair_application_form application
  125. left join t_sys_user user on application.user_id = user.user_id
  126. left join t_sys_user user2 on application.repair_user_id = user2.user_id
  127. left join t_sys_user user3 on application.check_user_id = user3.user_id
  128. left join t_sb_info sb on application.sb_id = sb.id
  129. left join t_part_info part on application.part_id = part.id
  130. left join t_error_type error on application.repair_error_type_id = error.id
  131. where application.id = #{id,jdbcType=VARCHAR}
  132. </select>
  133. <select id="selectNoById" parameterType="java.lang.Object" resultType="java.lang.String">
  134. select no
  135. from t_repair_application_form
  136. where id = #{id,jdbcType=VARCHAR}
  137. </select>
  138. <!-- 维修统计数据 -->
  139. <select id="getWorkplaceRepairData" parameterType="com.platform.dao.dto.repair.RepairApplicationFormDTO"
  140. resultType="com.platform.dao.vo.repair.RepairApplicationFormVO">
  141. select count(1) as tempTotalNum,rf.status from t_repair_application_form rf
  142. <where>
  143. <if test="repairUserId != null">
  144. and rf.repair_user_id = #{repairUserId}
  145. </if>
  146. <if test="searchTime != null">
  147. and rf.repair_start_time like concat('',#{searchTime},'%')
  148. </if>
  149. <if test="type != null">
  150. and rf.type = #{type}
  151. </if>
  152. </where>
  153. group by rf.status
  154. </select>
  155. <!-- 维修统计数据 -->
  156. <select id="getCurrentlyList" parameterType="com.platform.dao.dto.repair.RepairApplicationFormDTO"
  157. resultType="com.platform.dao.vo.repair.RepairApplicationFormVO">
  158. select * from t_repair_application_form
  159. <where>
  160. <if test="searchStartTime != null">
  161. and repair_start_time <![CDATA[>]]> #{searchStartTime}
  162. </if>
  163. <if test="searchEndTime != null">
  164. and repair_start_time <![CDATA[<]]> #{searchEndTime}
  165. </if>
  166. <if test="repairUserId != null">
  167. and repair_user_id = #{repairUserId}
  168. </if>
  169. </where>
  170. </select>
  171. <!-- 近月统计单数和费用 -->
  172. <select id="getWorkplaceRepairSumData" parameterType="com.platform.dao.dto.repair.RepairApplicationFormDTO"
  173. resultType="com.platform.dao.vo.repair.RepairApplicationFormVO">
  174. select count(1) as tempTotalNum from t_repair_application_form rf
  175. <where>
  176. <if test="repairUserId != null">
  177. and rf.repair_user_id = #{repairUserId}
  178. </if>
  179. <if test="searchStartTime != null">
  180. and rf.repair_start_time <![CDATA[>]]> #{searchStartTime}
  181. </if>
  182. <if test="searchEndTime != null">
  183. and rf.repair_start_time <![CDATA[<]]> #{searchEndTime}
  184. </if>
  185. <if test="type != null">
  186. and rf.type = #{type}
  187. </if>
  188. </where>
  189. </select>
  190. <!-- 修改派工维修单 -->
  191. <update id="updateForRepairDispatch" parameterType="com.platform.dao.entity.repair.RepairApplicationForm">
  192. update t_repair_application_form
  193. <set>
  194. repair_end_time = null,
  195. <if test="sbId != null">
  196. sb_id = #{sbId},
  197. </if>
  198. <if test="needStop != null">
  199. need_stop = #{needStop},
  200. </if>
  201. <if test="no != null">
  202. no = #{no},
  203. </if>
  204. <if test="source != null">
  205. source = #{source},
  206. </if>
  207. <if test="applyTime != null">
  208. apply_time = #{applyTime},
  209. </if>
  210. <if test="level != null">
  211. level = #{level},
  212. </if>
  213. <if test="content != null">
  214. content = #{content},
  215. </if>
  216. <if test="status != null">
  217. status= #{status},
  218. </if>
  219. <if test="repairStartTime != null">
  220. repair_start_time = #{repairStartTime},
  221. </if>
  222. <if test="repairDispatchList != null">
  223. repair_dispatch_list = #{repairDispatchList},
  224. </if>
  225. <if test="repairDispatchRemark != null">
  226. repair_dispatch_remark = #{repairDispatchRemark},
  227. </if>
  228. <if test="receiveMinutes != null">
  229. receive_minutes = #{receiveMinutes},
  230. </if>
  231. <if test="repairMinutes != null">
  232. repair_minutes = #{repairMinutes},
  233. </if>
  234. <if test="dealMinutes != null">
  235. deal_minutes = #{dealMinutes},
  236. </if>
  237. <if test="repairOvertime != null">
  238. repair_overtime = #{repairOvertime},
  239. </if>
  240. <if test="receiveOvertime != null">
  241. receive_overtime = #{receiveOvertime},
  242. </if>
  243. <if test="userId != null">
  244. user_id = #{userId},
  245. </if>
  246. <if test="repairUserId != null">
  247. repair_user_id = #{repairUserId},
  248. </if>
  249. <if test="checkUserId != null">
  250. check_user_id = #{checkUserId},
  251. </if>
  252. <if test="checkStartTime != null">
  253. check_start_time = #{checkStartTime},
  254. </if>
  255. <if test="checkContent != null">
  256. check_content = #{checkContent},
  257. </if>
  258. <if test="createdTime != null">
  259. created_time = #{createdTime},
  260. </if>
  261. <if test="updateTime != null">
  262. update_time = #{updateTime},
  263. </if>
  264. <if test="actualUser != null">
  265. actual_user = #{actualUser},
  266. </if>
  267. <if test="type != null">
  268. type = #{type},
  269. </if>
  270. <!--<if test="dispatchUserId">
  271. and dispatch_user_id = #{dispatchUserId}
  272. </if>-->
  273. </set>
  274. where id = #{id}
  275. </update>
  276. <select id="getRepairCount" resultType="com.platform.dao.vo.repair.RepairApplicationFormVO"
  277. parameterType="com.platform.dao.dto.repair.RepairApplicationFormDTO"
  278. >
  279. select status,count(1) as count from t_repair_application_form form
  280. <where>
  281. status in (1,2,4)
  282. <if test="repairUserId!=null">
  283. repair_user_id=#{repairUserId}
  284. </if>
  285. </where>
  286. group by status
  287. </select>
  288. </mapper>