GxtRepairOrderMapper.xml 64 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024
  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="com.ygtx.gxt.mapper.GxtRepairOrderMapper">
  6. <resultMap type="GxtRepairOrder" id="GxtRepairOrderResult">
  7. <result property="id" column="id" />
  8. <result property="workOrderProjectNo" column="work_order_project_no" />
  9. <result property="workOrderStatus" column="work_order_status" />
  10. <result property="gxtCenterId" column="gxt_center_id" />
  11. <result property="gxtCenter" column="gxt_center" />
  12. <result property="pcsStationId" column="pcs_station_id" />
  13. <result property="pcsStationName" column="pcs_station_name" />
  14. <result property="pcsDeviceId" column="pcs_device_id" />
  15. <result property="pcsDeviceName" column="pcs_device_name" />
  16. <result property="brand" column="brand" />
  17. <result property="model" column="model" />
  18. <result property="faultCode" column="fault_code" />
  19. <result property="faultDesc" column="fault_desc" />
  20. <result property="assignTime" column="assign_time" />
  21. <result property="assignUserId" column="assign_user_id" />
  22. <result property="assignUserName" column="assign_user_name" />
  23. <result property="acceptTime" column="accept_time" />
  24. <result property="acceptUserId" column="accept_user_id" />
  25. <result property="acceptUserName" column="accept_user_name" />
  26. <result property="realStartTime" column="real_start_time" />
  27. <result property="realEndTime" column="real_end_time" />
  28. <result property="teamLeaderId" column="team_leader_id" />
  29. <result property="teamLeaderName" column="team_leader_name" />
  30. <result property="workGroupMemberId" column="work_group_member_id" />
  31. <result property="workGroupMemberName" column="work_group_member_name" />
  32. <result property="createBy" column="create_by" />
  33. <result property="createTime" column="create_time" />
  34. <result property="updateBy" column="update_by" />
  35. <result property="updateTime" column="update_time" />
  36. <result property="remark" column="remark" />
  37. <result property="content" column="content" />
  38. <result property="planHour" column="plan_hour" />
  39. <result property="priorityType" column="priority_type" />
  40. <result property="score" column="score" />
  41. <result property="reviewContent" column="review_content" />
  42. <result property="maintenanceType" column="maintenance_type" />
  43. <result property="occurTime" column="occur_time" />
  44. <result property="faultBarcode" column="fault_barcode" />
  45. <result property="suspendReason" column="suspend_reason" />
  46. <result property="suspendDescription" column="suspend_description" />
  47. <result property="approvalStatus" column="approval_status" />
  48. <result property="rejectionReason" column="rejection_reason" />
  49. <result property="modifyReason" column="modify_reason" />
  50. <result property="finalizationRemark" column="finalization_remark" />
  51. <result property="relatedOrderCode" column="related_order_code" />
  52. <result property="relatedOrderContent" column="related_order_content" />
  53. <result property="misOrderNo" column="mis_order_no" />
  54. <result property="restartTime" column="restart_time" />
  55. <result property="scoringStatus" column="scoring_status" />
  56. <result property="pcsStationPid" column="pcs_station_pid" />
  57. <result property="attachmentUrls" column="attachment_urls" />
  58. <result property="reviewScoreNum" column="review_score_num" />
  59. <result property="finalCoefficient" column="final_coefficient" />
  60. <result property="orderType" column="order_type" />
  61. <result property="orderEntryType" column="order_entry_type" />
  62. <result property="repairMethod" column="repair_method" />
  63. <result property="resetMethod" column="reset_method" />
  64. <result property="invalidReason" column="invalid_reason" />
  65. <result property="returnType" column="return_type" />
  66. <result property="returnReason" column="return_reason" />
  67. <result property="feedbackReason" column="feedback_reason" />
  68. <result property="confirmStatus" column="confirm_status" />
  69. <result property="wwryNum" column="wwry_num" />
  70. <result property="wlryNum" column="wlry_num" />
  71. <result property="workArea" column="work_area" />
  72. <result property="infoEntry" column="info_entry" />
  73. <result property="realFailureReason" column="real_failure_reason" />
  74. <result property="lostPower" column="lost_power" />
  75. <result property="workPermitNum" column="work_permit_num" />
  76. <result property="finalizeMethod" column="finalize_method" />
  77. <result property="appealUserName" column="appeal_user_name" />
  78. <result property="appealUserId" column="appeal_user_id" />
  79. <result property="appealTime" column="appeal_time" />
  80. <result property="appealReason" column="appeal_reason" />
  81. <result property="suspendExplain" column="suspend_explain" />
  82. <result property="orderAttachment" column="order_attachment" />
  83. <result property="extraWork" column="extra_work" />
  84. <result property="acceptReturnType" column="accept_return_type" />
  85. <result property="acceptReturnReason" column="accept_return_reason" />
  86. <result property="scoreReturnReason" column="score_return_reason" />
  87. <result property="leader" column="leader" />
  88. <result property="userId" column="user_id" />
  89. </resultMap>
  90. <resultMap type="GxtRepairOrder" id="GxtRepairOrderWithPersonResult" extends="GxtRepairOrderResult">
  91. <collection property="repairOrderPersonList" ofType="com.ygtx.gxt.domain.GxtRepairOrderPerson">
  92. <result property="id" column="person_id"/>
  93. <result property="userId" column="person_user_id"/>
  94. <result property="nickName" column="person_nick_name"/>
  95. <result property="orderId" column="person_order_id"/>
  96. <result property="orderCode" column="person_order_code"/>
  97. <result property="status" column="person_status"/>
  98. <result property="selfScore" column="person_self_score"/>
  99. <result property="reviewScore" column="person_review_score"/>
  100. <result property="finalScore" column="person_final_score"/>
  101. <result property="isLeader" column="person_is_leader"/>
  102. <result property="extraScore" column="person_extra_score"/>
  103. <result property="totalScore" column="person_total_score"/>
  104. </collection>
  105. </resultMap>
  106. <resultMap type="GxtOrderData" id="GxtOrderDataResult">
  107. <result property="userId" column="user_id" />
  108. <result property="workOrderNum" column="workOrderNum" />
  109. <result property="workOrderNumLast" column="workOrderNumLast" />
  110. <result property="repairOrderNum" column="repairOrderNum" />
  111. <result property="repairRestartOrderNum" column="repairRestartOrderNum" />
  112. <result property="repairOrderNumLast" column="repairOrderNumLast" />
  113. <result property="wxgs" column="wxgs" />
  114. <result property="wxgsLast" column="wxgs_last" />
  115. <result property="wbgs" column="wbgs" />
  116. <result property="wbgsLast" column="wbgs_last" />
  117. <result property="score" column="score" />
  118. <result property="scoreLast" column="score_last" />
  119. <result property="pcsWorkOrderNum" column="pcsWorkOrderNum" />
  120. <result property="centerWorkOrderNum" column="centerWorkOrderNum" />
  121. <result property="companyWorkOrderNum" column="companyWorkOrderNum" />
  122. <result property="pcsRepairOrderNum" column="pcsRepairOrderNum" />
  123. <result property="pcsRepairRestartOrderNum" column="pcsRepairRestartOrderNum" />
  124. <result property="centerRepairOrderNum" column="centerRepairOrderNum" />
  125. <result property="centerRepairRestartOrderNum" column="centerRepairRestartOrderNum" />
  126. <result property="companyRepairOrderNum" column="companyRepairOrderNum" />
  127. <result property="companyRepairRestartOrderNum" column="companyRepairRestartOrderNum" />
  128. </resultMap>
  129. <resultMap type="GxtUserScore" id="GxtUserScoreResult">
  130. <result property="monthPeriod" column="month_period"/>
  131. <result property="userId" column="user_id"/>
  132. <result property="userName" column="user_name"/>
  133. <result property="nickName" column="nick_name"/>
  134. <result property="deptId" column="dept_id"/>
  135. <result property="deptName" column="dept_name"/>
  136. <result property="finalScore" column="final_score"/>
  137. <result property="centerId" column="center_id"/>
  138. <result property="center" column="center"/>
  139. <result property="companyName" column="companyName"/>
  140. <result property="permission" column="permission"/>
  141. </resultMap>
  142. <sql id="selectGxtRepairOrderVo">
  143. select id, work_order_project_no, work_order_status, gxt_center_id, gxt_center, pcs_station_id, pcs_station_name, pcs_device_id,
  144. pcs_device_name, brand, model, fault_code, fault_desc, assign_time, assign_user_id, assign_user_name, accept_time,
  145. accept_user_id, accept_user_name, real_start_time, real_end_time, team_leader_id, team_leader_name, work_group_member_id,
  146. work_group_member_name, t.create_by, t.create_time, t.update_by, t.update_time, t.remark, content, plan_hour, priority_type, score,
  147. review_content, maintenance_type, occur_time, fault_barcode, suspend_reason, suspend_description, approval_status,
  148. rejection_reason, modify_reason, finalization_remark, related_order_code, related_order_content, mis_order_no, restart_time,
  149. scoring_status, pcs_station_pid, attachment_urls, review_score_num, final_coefficient, order_type, repair_method, reset_method, invalid_reason, return_type, return_reason, feedback_reason, confirm_status,
  150. wwry_num, wlry_num, work_area, info_entry, real_failure_reason, lost_power, work_permit_num, finalize_method, appeal_user_name, appeal_user_id, appeal_time, appeal_reason, suspend_explain, order_entry_type, order_attachment, extra_work, accept_return_type, accept_return_reason, score_return_reason from gxt_repair_order t
  151. left join sys_user u on u.user_name = t.create_by
  152. left join sys_dept d on u.dept_id = d.dept_id
  153. </sql>
  154. <select id="selectGxtRepairOrderList" parameterType="GxtRepairOrder" resultMap="GxtRepairOrderResult">
  155. <include refid="selectGxtRepairOrderVo"/>
  156. <where>
  157. <if test="workOrderProjectNo != null and workOrderProjectNo != ''"> and work_order_project_no = #{workOrderProjectNo}</if>
  158. <if test="workOrderStatus != null and workOrderStatus != ''"> and work_order_status = #{workOrderStatus}</if>
  159. <if test="gxtCenterId != null "> and gxt_center_id = #{gxtCenterId}</if>
  160. <if test="gxtCenter != null and gxtCenter != ''"> and gxt_center = #{gxtCenter}</if>
  161. <if test="pcsStationId != null "> and pcs_station_id = #{pcsStationId}</if>
  162. <if test="pcsStationName != null and pcsStationName != ''"> and pcs_station_name = #{pcsStationName} </if>
  163. <if test="pcsDeviceId != null "> and pcs_device_id = #{pcsDeviceId}</if>
  164. <if test="pcsDeviceName != null and pcsDeviceName != ''"> and pcs_device_name like concat('%', #{pcsDeviceName}, '%')</if>
  165. <if test="brand != null and brand != ''"> and brand = #{brand}</if>
  166. <if test="model != null and model != ''"> and model = #{model}</if>
  167. <if test="faultCode != null and faultCode != ''"> and fault_code like concat('%', #{faultCode}, '%')</if>
  168. <if test="faultDesc != null and faultDesc != ''"> and fault_desc = #{faultDesc}</if>
  169. <if test="assignTime != null "> and assign_time = #{assignTime}</if>
  170. <if test="assignUserId != null "> and assign_user_id = #{assignUserId}</if>
  171. <if test="assignUserName != null and assignUserName != ''"> and assign_user_name like concat('%', #{assignUserName}, '%')</if>
  172. <if test="acceptTime != null "> and accept_time = #{acceptTime}</if>
  173. <if test="acceptUserId != null "> and accept_user_id = #{acceptUserId}</if>
  174. <if test="acceptUserName != null and acceptUserName != ''"> and accept_user_name like concat('%', #{acceptUserName}, '%')</if>
  175. <if test="realStartTime != null "> and real_start_time = #{realStartTime}</if>
  176. <if test="realEndTime != null "> and real_end_time = #{realEndTime}</if>
  177. <if test="teamLeaderId != null "> and team_leader_id = #{teamLeaderId}</if>
  178. <if test="teamLeaderName != null and teamLeaderName != ''"> and team_leader_name like concat('%', #{teamLeaderName}, '%')</if>
  179. <if test="workGroupMemberId != null "> and work_group_member_id = #{workGroupMemberId}</if>
  180. <if test="workGroupMemberName != null and workGroupMemberName != ''"> and work_group_member_name like concat('%', #{workGroupMemberName}, '%')</if>
  181. <if test="content != null and content != ''"> and content = #{content}</if>
  182. <if test="planHour != null "> and plan_hour = #{planHour}</if>
  183. <if test="priorityType != null "> and priority_type = #{priorityType}</if>
  184. <if test="score != null "> and score = #{score}</if>
  185. <if test="reviewContent != null and reviewContent != ''"> and review_content = #{reviewContent}</if>
  186. <if test="maintenanceType != null and maintenanceType != ''"> and maintenance_type = #{maintenanceType}</if>
  187. <if test="occurTime != null "> and occur_time = #{occurTime}</if>
  188. <if test="faultBarcode != null and faultBarcode != ''"> and fault_barcode = #{faultBarcode}</if>
  189. <if test="suspendReason != null and suspendReason != ''"> and suspend_reason = #{suspendReason}</if>
  190. <if test="suspendDescription != null and suspendDescription != ''"> and suspend_description = #{suspendDescription}</if>
  191. <if test="approvalStatus != null and approvalStatus != ''"> and approval_status = #{approvalStatus}</if>
  192. <if test="rejectionReason != null and rejectionReason != ''"> and rejection_reason = #{rejectionReason}</if>
  193. <if test="modifyReason != null and modifyReason != ''"> and modify_reason = #{modifyReason}</if>
  194. <if test="finalizationRemark != null and finalizationRemark != ''"> and finalization_remark = #{finalizationRemark}</if>
  195. <if test="relatedOrderCode != null and relatedOrderCode != ''"> and related_order_code = #{relatedOrderCode}</if>
  196. <if test="relatedOrderContent != null and relatedOrderContent != ''"> and related_order_content = #{relatedOrderContent}</if>
  197. <if test="misOrderNo != null and misOrderNo != ''"> and mis_order_no = #{misOrderNo}</if>
  198. <if test="restartTime != null "> and restart_time = #{restartTime}</if>
  199. <if test="scoringStatus != null "> and scoring_status = #{scoringStatus}</if>
  200. <if test="pcsStationPid != null "> and pcs_station_pid = #{pcsStationPid}</if>
  201. <if test="attachmentUrls != null and attachmentUrls != ''"> and attachment_urls = #{attachmentUrls}</if>
  202. <if test="reviewScoreNum != null "> and review_score_num = #{reviewScoreNum}</if>
  203. <if test="finalCoefficient != null "> and final_coefficient = #{finalCoefficient}</if>
  204. <if test="orderType != null "> and order_type = #{orderType}</if>
  205. <if test="repairMethod != null and repairMethod != ''"> and repair_method = #{repairMethod}</if>
  206. <if test="resetMethod != null and resetMethod != ''"> and reset_method = #{resetMethod}</if>
  207. <if test="returnType != null and returnType != ''"> and return_type = #{returnType}</if>
  208. <if test="returnReason != null and returnReason != ''"> and return_reason = #{returnReason}</if>
  209. <if test="outTimeParam != null"> and DATE_SUB(NOW(), INTERVAL #{outTimeParam} MINUTE) > t.update_time </if>
  210. <if test="wwryNum != null"> and wwry_num = #{wwryNum}</if>
  211. <if test="wlryNum != null"> and wlry_num = #{wlryNum}</if>
  212. <if test="workArea != null and workArea != ''"> and work_area = #{workArea}</if>
  213. <if test="infoEntry != null and infoEntry != ''"> and info_entry = #{infoEntry}</if>
  214. <if test="realFailureReason != null and realFailureReason != ''"> and real_failure_reason = #{realFailureReason}</if>
  215. <if test="lostPower != null"> and lost_power = #{lostPower}</if>
  216. <if test="workPermitNum != null and workPermitNum != ''"> and work_permit_num = #{workPermitNum}</if>
  217. <if test="beginOccurTime != null and beginOccurTime != ''"> and date_format(occur_time,'%y%m%d') &gt;= date_format(#{beginOccurTime},'%y%m%d')</if>
  218. <if test="endOccurTime != null and endOccurTime != ''"> and date_format(occur_time,'%y%m%d') &lt;= date_format(#{endOccurTime},'%y%m%d')</if>
  219. <!-- 业务特定数据权限过滤条件 -->
  220. <if test="params.businessDataScope != null and params.businessDataScope != ''">
  221. ${params.businessDataScope}
  222. </if>
  223. <!-- 限制待下发工单只能创建人本部门查看 -->
  224. <if test="params.currentUser != null and params.currentUser != ''">
  225. and ((t.work_order_status != 'to_issue' and t.work_order_status != 'accept_return') or t.create_by in
  226. (select user_name from sys_user t1
  227. left join sys_dept t2 on t1.dept_id = t2.dept_id
  228. where t2.dept_id = (select dept_id from sys_user where user_name = #{params.currentUser,jdbcType=VARCHAR} and del_flag='0')))
  229. </if>
  230. </where>
  231. order by create_time desc
  232. </select>
  233. <select id="selectGxtRepairOrderListByMonth" parameterType="GxtRepairOrder" resultMap="GxtRepairOrderResult">
  234. SELECT
  235. t.*
  236. FROM
  237. gxt_repair_order t
  238. <if test="userId != null">LEFT JOIN gxt_repair_order_person p ON p.order_id = t.id</if>
  239. <where>
  240. <if test="userId != null"> and p.user_id=#{userId}</if>
  241. <if test="workOrderStatus != null and workOrderStatus != ''"> and work_order_status IN ('completed','archived')</if>
  242. <if test="pcsStationPid != null "> and pcs_station_pid = #{pcsStationPid}</if>
  243. <if test="maintenanceType != null and maintenanceType != ''"> and maintenance_type = #{maintenanceType}</if>
  244. <if test="monthPeriod != null"> and DATE_FORMAT(occur_time, '%Y-%m') = #{monthPeriod}</if>
  245. <if test="params.businessDataScope != null and params.businessDataScope != ''">
  246. ${params.businessDataScope}
  247. </if>
  248. </where>
  249. order by t.occur_time desc
  250. </select>
  251. <select id="selectGxtRepairOrderById" parameterType="Long" resultMap="GxtRepairOrderResult">
  252. <include refid="selectGxtRepairOrderVo"/>
  253. where id = #{id}
  254. </select>
  255. <insert id="insertGxtRepairOrder" parameterType="GxtRepairOrder" useGeneratedKeys="true" keyProperty="id">
  256. insert into gxt_repair_order
  257. <trim prefix="(" suffix=")" suffixOverrides=",">
  258. <if test="workOrderProjectNo != null and workOrderProjectNo != ''">work_order_project_no,</if>
  259. <if test="workOrderStatus != null">work_order_status,</if>
  260. <if test="gxtCenterId != null">gxt_center_id,</if>
  261. <if test="gxtCenter != null">gxt_center,</if>
  262. <if test="pcsStationId != null">pcs_station_id,</if>
  263. <if test="pcsStationName != null">pcs_station_name,</if>
  264. <if test="pcsDeviceId != null">pcs_device_id,</if>
  265. <if test="pcsDeviceName != null">pcs_device_name,</if>
  266. <if test="brand != null">brand,</if>
  267. <if test="model != null">model,</if>
  268. <if test="faultCode != null">fault_code,</if>
  269. <if test="faultDesc != null">fault_desc,</if>
  270. <if test="assignTime != null">assign_time,</if>
  271. <if test="assignUserId != null">assign_user_id,</if>
  272. <if test="assignUserName != null">assign_user_name,</if>
  273. <if test="acceptTime != null">accept_time,</if>
  274. <if test="acceptUserId != null">accept_user_id,</if>
  275. <if test="acceptUserName != null">accept_user_name,</if>
  276. <if test="realStartTime != null">real_start_time,</if>
  277. <if test="realEndTime != null">real_end_time,</if>
  278. <if test="teamLeaderId != null">team_leader_id,</if>
  279. <if test="teamLeaderName != null">team_leader_name,</if>
  280. <if test="workGroupMemberId != null">work_group_member_id,</if>
  281. <if test="workGroupMemberName != null">work_group_member_name,</if>
  282. <if test="createBy != null">create_by,</if>
  283. <if test="createTime != null">create_time,</if>
  284. <if test="updateBy != null">update_by,</if>
  285. <if test="updateTime != null">update_time,</if>
  286. <if test="remark != null">remark,</if>
  287. <if test="content != null">content,</if>
  288. <if test="planHour != null">plan_hour,</if>
  289. <if test="priorityType != null">priority_type,</if>
  290. <if test="score != null">score,</if>
  291. <if test="reviewContent != null">review_content,</if>
  292. <if test="maintenanceType != null and maintenanceType != ''">maintenance_type,</if>
  293. <if test="occurTime != null">occur_time,</if>
  294. <if test="faultBarcode != null">fault_barcode,</if>
  295. <if test="suspendReason != null">suspend_reason,</if>
  296. <if test="suspendDescription != null">suspend_description,</if>
  297. <if test="approvalStatus != null">approval_status,</if>
  298. <if test="rejectionReason != null">rejection_reason,</if>
  299. <if test="modifyReason != null">modify_reason,</if>
  300. <if test="finalizationRemark != null">finalization_remark,</if>
  301. <if test="relatedOrderCode != null">related_order_code,</if>
  302. <if test="relatedOrderContent != null">related_order_content,</if>
  303. <if test="misOrderNo != null">mis_order_no,</if>
  304. <if test="restartTime != null">restart_time,</if>
  305. <if test="scoringStatus != null">scoring_status,</if>
  306. <if test="pcsStationPid != null">pcs_station_pid,</if>
  307. <if test="attachmentUrls != null and attachmentUrls != ''">attachment_urls,</if>
  308. <if test="reviewScoreNum != null">review_score_num,</if>
  309. <if test="finalCoefficient != null">final_coefficient,</if>
  310. <if test="orderType != null">order_type,</if>
  311. <if test="repairMethod != null and repairMethod != ''">repair_method,</if>
  312. <if test="resetMethod != null and resetMethod != ''">reset_method,</if>
  313. <if test="invalidReason != null and invalidReason != ''">invalid_reason,</if>
  314. <if test="returnType != null and returnType != ''">return_type,</if>
  315. <if test="returnReason != null and returnReason != ''">return_reason,</if>
  316. <if test="feedbackReason != null and feedbackReason != ''">feedback_reason,</if>
  317. <if test="confirmStatus != null">confirm_status,</if>
  318. <if test="wwryNum != null">wwry_num,</if>
  319. <if test="wlryNum != null">wlry_num,</if>
  320. <if test="workArea != null and workArea != ''">work_area,</if>
  321. <if test="infoEntry != null and infoEntry != ''">info_entry,</if>
  322. <if test="realFailureReason != null and realFailureReason != ''">real_failure_reason,</if>
  323. <if test="lostPower != null">lost_power,</if>
  324. <if test="workPermitNum != null and workPermitNum != ''">work_permit_num,</if>
  325. <if test="appealUserName != null and appealUserName != ''">appeal_user_name,</if>
  326. <if test="appealUserId != null">appeal_user_id,</if>
  327. <if test="appealTime != null">appeal_time,</if>
  328. <if test="appealReason != null and appealReason != ''">appeal_reason,</if>
  329. <if test="suspendExplain != null and suspendExplain != ''">suspend_explain,</if>
  330. <if test="orderEntryType != null and orderEntryType != ''">order_entry_type,</if>
  331. <if test="orderAttachment != null and orderAttachment != ''">order_attachment,</if>
  332. <if test="extraWork != null and extraWork != ''">extra_work,</if>
  333. <if test="acceptReturnType != null and acceptReturnType != ''">accept_return_type,</if>
  334. <if test="acceptReturnReason != null and acceptReturnReason != ''">accept_return_reason,</if>
  335. <if test="scoreReturnReason != null and scoreReturnReason != ''">score_return_reason,</if>
  336. <if test="finalizeMethod != null and finalizeMethod != ''">finalize_method,</if>
  337. </trim>
  338. <trim prefix="values (" suffix=")" suffixOverrides=",">
  339. <if test="workOrderProjectNo != null and workOrderProjectNo != ''">#{workOrderProjectNo},</if>
  340. <if test="workOrderStatus != null">#{workOrderStatus},</if>
  341. <if test="gxtCenterId != null">#{gxtCenterId},</if>
  342. <if test="gxtCenter != null">#{gxtCenter},</if>
  343. <if test="pcsStationId != null">#{pcsStationId},</if>
  344. <if test="pcsStationName != null">#{pcsStationName},</if>
  345. <if test="pcsDeviceId != null">#{pcsDeviceId},</if>
  346. <if test="pcsDeviceName != null">#{pcsDeviceName},</if>
  347. <if test="brand != null">#{brand},</if>
  348. <if test="model != null">#{model},</if>
  349. <if test="faultCode != null">#{faultCode},</if>
  350. <if test="faultDesc != null">#{faultDesc},</if>
  351. <if test="assignTime != null">#{assignTime},</if>
  352. <if test="assignUserId != null">#{assignUserId},</if>
  353. <if test="assignUserName != null">#{assignUserName},</if>
  354. <if test="acceptTime != null">#{acceptTime},</if>
  355. <if test="acceptUserId != null">#{acceptUserId},</if>
  356. <if test="acceptUserName != null">#{acceptUserName},</if>
  357. <if test="realStartTime != null">#{realStartTime},</if>
  358. <if test="realEndTime != null">#{realEndTime},</if>
  359. <if test="teamLeaderId != null">#{teamLeaderId},</if>
  360. <if test="teamLeaderName != null">#{teamLeaderName},</if>
  361. <if test="workGroupMemberId != null">#{workGroupMemberId},</if>
  362. <if test="workGroupMemberName != null">#{workGroupMemberName},</if>
  363. <if test="createBy != null">#{createBy},</if>
  364. <if test="createTime != null">#{createTime},</if>
  365. <if test="updateBy != null">#{updateBy},</if>
  366. <if test="updateTime != null">#{updateTime},</if>
  367. <if test="remark != null">#{remark},</if>
  368. <if test="content != null">#{content},</if>
  369. <if test="planHour != null">#{planHour},</if>
  370. <if test="priorityType != null">#{priorityType},</if>
  371. <if test="score != null">#{score},</if>
  372. <if test="reviewContent != null">#{reviewContent},</if>
  373. <if test="maintenanceType != null and maintenanceType != ''">#{maintenanceType},</if>
  374. <if test="occurTime != null">#{occurTime},</if>
  375. <if test="faultBarcode != null">#{faultBarcode},</if>
  376. <if test="suspendReason != null">#{suspendReason},</if>
  377. <if test="suspendDescription != null">#{suspendDescription},</if>
  378. <if test="approvalStatus != null">#{approvalStatus},</if>
  379. <if test="rejectionReason != null">#{rejectionReason},</if>
  380. <if test="modifyReason != null">#{modifyReason},</if>
  381. <if test="finalizationRemark != null">#{finalizationRemark},</if>
  382. <if test="relatedOrderCode != null">#{relatedOrderCode},</if>
  383. <if test="relatedOrderContent != null">#{relatedOrderContent},</if>
  384. <if test="misOrderNo != null">#{misOrderNo},</if>
  385. <if test="restartTime != null">#{restartTime},</if>
  386. <if test="scoringStatus != null">#{scoringStatus},</if>
  387. <if test="pcsStationPid != null">#{pcsStationPid},</if>
  388. <if test="attachmentUrls != null and attachmentUrls != ''">#{attachmentUrls},</if>
  389. <if test="reviewScoreNum != null">#{reviewScoreNum},</if>
  390. <if test="finalCoefficient != null">#{finalCoefficient},</if>
  391. <if test="orderType != null">#{orderType},</if>
  392. <if test="repairMethod != null and repairMethod != ''">#{repairMethod},</if>
  393. <if test="resetMethod != null and resetMethod != ''">#{resetMethod},</if>
  394. <if test="invalidReason != null and invalidReason != ''">#{invalidReason},</if>
  395. <if test="returnType != null and returnType != ''">#{returnType},</if>
  396. <if test="returnReason != null and returnReason != ''">#{returnReason},</if>
  397. <if test="feedbackReason != null and feedbackReason != ''">#{feedbackReason},</if>
  398. <if test="confirmStatus != null">#{confirmStatus},</if>
  399. <if test="wwryNum != null">#{wwryNum},</if>
  400. <if test="wlryNum != null">#{wlryNum},</if>
  401. <if test="workArea != null and workArea != ''">#{workArea},</if>
  402. <if test="infoEntry != null and infoEntry != ''">#{infoEntry},</if>
  403. <if test="realFailureReason != null and realFailureReason != ''">#{realFailureReason},</if>
  404. <if test="lostPower != null">#{lostPower},</if>
  405. <if test="workPermitNum != null and workPermitNum != ''">#{workPermitNum},</if>
  406. <if test="appealUserName != null and appealUserName != ''">#{appealUserName},</if>
  407. <if test="appealUserId != null">#{appealUserId},</if>
  408. <if test="appealTime != null">#{appealTime},</if>
  409. <if test="appealReason != null and appealReason != ''">#{appealReason},</if>
  410. <if test="suspendExplain != null and suspendExplain != ''">#{suspendExplain},</if>
  411. <if test="orderEntryType != null and orderEntryType != ''">#{orderEntryType},</if>
  412. <if test="orderAttachment != null and orderAttachment != ''">#{orderAttachment},</if>
  413. <if test="extraWork != null and extraWork != ''">#{extraWork},</if>
  414. <if test="acceptReturnType != null and acceptReturnType != ''">#{acceptReturnType},</if>
  415. <if test="acceptReturnReason != null and acceptReturnReason != ''">#{acceptReturnReason},</if>
  416. <if test="scoreReturnReason != null and scoreReturnReason != ''">#{scoreReturnReason},</if>
  417. <if test="finalizeMethod != null and finalizeMethod != ''">#{finalizeMethod},</if>
  418. </trim>
  419. </insert>
  420. <update id="updateGxtRepairOrder" parameterType="GxtRepairOrder">
  421. update gxt_repair_order
  422. <trim prefix="SET" suffixOverrides=",">
  423. <if test="workOrderProjectNo != null and workOrderProjectNo != ''">work_order_project_no = #{workOrderProjectNo},</if>
  424. <if test="workOrderStatus != null">work_order_status = #{workOrderStatus},</if>
  425. <if test="gxtCenterId != null">gxt_center_id = #{gxtCenterId},</if>
  426. <if test="gxtCenter != null">gxt_center = #{gxtCenter},</if>
  427. <if test="pcsStationId != null">pcs_station_id = #{pcsStationId},</if>
  428. <if test="pcsStationName != null">pcs_station_name = #{pcsStationName},</if>
  429. <if test="pcsDeviceId != null">pcs_device_id = #{pcsDeviceId},</if>
  430. <if test="pcsDeviceName != null">pcs_device_name = #{pcsDeviceName},</if>
  431. <if test="brand != null">brand = #{brand},</if>
  432. <if test="model != null">model = #{model},</if>
  433. <if test="faultCode != null">fault_code = #{faultCode},</if>
  434. <if test="faultDesc != null">fault_desc = #{faultDesc},</if>
  435. <if test="assignTime != null">assign_time = #{assignTime},</if>
  436. <if test="assignUserId != null">assign_user_id = #{assignUserId},</if>
  437. <if test="assignUserName != null">assign_user_name = #{assignUserName},</if>
  438. <if test="acceptTime != null">accept_time = #{acceptTime},</if>
  439. <if test="acceptUserId != null">accept_user_id = #{acceptUserId},</if>
  440. <if test="acceptUserName != null">accept_user_name = #{acceptUserName},</if>
  441. <if test="realStartTime != null">real_start_time = #{realStartTime},</if>
  442. <if test="realEndTime != null">real_end_time = #{realEndTime},</if>
  443. <if test="teamLeaderId != null">team_leader_id = #{teamLeaderId},</if>
  444. <if test="teamLeaderName != null">team_leader_name = #{teamLeaderName},</if>
  445. <if test="workGroupMemberId != null">work_group_member_id = #{workGroupMemberId},</if>
  446. <if test="workGroupMemberName != null">work_group_member_name = #{workGroupMemberName},</if>
  447. <if test="createBy != null">create_by = #{createBy},</if>
  448. <if test="createTime != null">create_time = #{createTime},</if>
  449. <if test="updateBy != null">update_by = #{updateBy},</if>
  450. <if test="updateTime != null">update_time = #{updateTime},</if>
  451. <if test="remark != null">remark = #{remark},</if>
  452. <if test="content != null">content = #{content},</if>
  453. <if test="planHour != null">plan_hour = #{planHour},</if>
  454. <if test="priorityType != null">priority_type = #{priorityType},</if>
  455. <if test="score != null">score = #{score},</if>
  456. <if test="reviewContent != null">review_content = #{reviewContent},</if>
  457. <if test="maintenanceType != null and maintenanceType != ''">maintenance_type = #{maintenanceType},</if>
  458. <if test="occurTime != null">occur_time = #{occurTime},</if>
  459. <if test="faultBarcode != null">fault_barcode = #{faultBarcode},</if>
  460. <if test="suspendReason != null">suspend_reason = #{suspendReason},</if>
  461. <if test="suspendDescription != null">suspend_description = #{suspendDescription},</if>
  462. <if test="approvalStatus != null">approval_status = #{approvalStatus},</if>
  463. <if test="rejectionReason != null">rejection_reason = #{rejectionReason},</if>
  464. <if test="modifyReason != null">modify_reason = #{modifyReason},</if>
  465. <if test="finalizationRemark != null">finalization_remark = #{finalizationRemark},</if>
  466. <if test="relatedOrderCode != null">related_order_code = #{relatedOrderCode},</if>
  467. <if test="relatedOrderContent != null">related_order_content = #{relatedOrderContent},</if>
  468. <if test="misOrderNo != null">mis_order_no = #{misOrderNo},</if>
  469. <if test="restartTime != null">restart_time = #{restartTime},</if>
  470. <if test="scoringStatus != null">scoring_status = #{scoringStatus},</if>
  471. <if test="pcsStationPid != null">pcs_station_pid = #{pcsStationPid},</if>
  472. <if test="attachmentUrls != null and attachmentUrls != ''">attachment_urls = #{attachmentUrls},</if>
  473. <if test="reviewScoreNum != null">review_score_num = #{reviewScoreNum},</if>
  474. <if test="finalCoefficient != null">final_coefficient = #{finalCoefficient},</if>
  475. <if test="orderType != null">order_type = #{orderType},</if>
  476. <if test="repairMethod != null and repairMethod != ''">repair_method = #{repairMethod},</if>
  477. <if test="resetMethod != null and resetMethod != ''">reset_method = #{resetMethod},</if>
  478. <if test="invalidReason != null and invalidReason != ''">invalid_reason = #{invalidReason},</if>
  479. <if test="returnType != null and returnType != ''">return_type = #{returnType},</if>
  480. <if test="workOrderStatus != null and workOrderStatus == 'return'">
  481. return_reason = #{returnReason},
  482. </if>
  483. <if test="feedbackReason != null and feedbackReason != ''">feedback_reason = #{feedbackReason},</if>
  484. <if test="confirmStatus != null">confirm_status = #{confirmStatus},</if>
  485. <if test="wwryNum != null">wwry_num = #{wwryNum},</if>
  486. <if test="wlryNum != null">wlry_num = #{wlryNum},</if>
  487. <if test="workArea != null and workArea != ''">work_area = #{workArea},</if>
  488. <if test="infoEntry != null and infoEntry != ''">info_entry = #{infoEntry},</if>
  489. <if test="realFailureReason != null and realFailureReason != ''">real_failure_reason = #{realFailureReason},</if>
  490. <if test="lostPower != null">lost_power = #{lostPower},</if>
  491. <if test="workPermitNum != null and workPermitNum != ''">work_permit_num = #{workPermitNum},</if>
  492. <if test="appealUserName != null and appealUserName != ''">appeal_user_name = #{appealUserName},</if>
  493. <if test="appealUserId != null">appeal_user_id = #{appealUserId},</if>
  494. <if test="appealTime != null">appeal_time = #{appealTime},</if>
  495. <if test="appealReason != null and appealReason != ''">appeal_reason = #{appealReason},</if>
  496. <if test="suspendExplain != null and suspendExplain != ''">suspend_explain = #{suspendExplain},</if>
  497. <if test="orderEntryType != null and orderEntryType != ''">order_entry_type = #{orderEntryType},</if>
  498. <if test="orderAttachment != null and orderAttachment != ''">order_attachment = #{orderAttachment},</if>
  499. <if test="extraWork != null and extraWork != ''">extra_work = #{extraWork},</if>
  500. <if test="acceptReturnType != null and acceptReturnType != ''">accept_return_type = #{acceptReturnType},</if>
  501. <if test="workOrderStatus != null and workOrderStatus == 'accept_return'">
  502. accept_return_reason = #{acceptReturnReason},
  503. </if>
  504. <if test="scoreReturnReason != null and scoreReturnReason != ''">score_return_reason = #{scoreReturnReason},</if>
  505. <if test="finalizeMethod != null and finalizeMethod != ''">finalize_method = #{finalizeMethod},</if>
  506. </trim>
  507. where id = #{id}
  508. </update>
  509. <delete id="deleteGxtRepairOrderById" parameterType="Long">
  510. delete from gxt_repair_order where id = #{id}
  511. </delete>
  512. <delete id="deleteGxtRepairOrderByIds" parameterType="String">
  513. delete from gxt_repair_order where id in
  514. <foreach item="id" collection="array" open="(" separator="," close=")">
  515. #{id}
  516. </foreach>
  517. </delete>
  518. <select id="selectGxtRepairOrderListForAutoFinalize" parameterType="GxtRepairOrder" resultMap="GxtRepairOrderResult">
  519. <include refid="selectGxtRepairOrderVo"/>
  520. <where>
  521. <if test="workOrderStatus != null and workOrderStatus != ''"> and work_order_status in
  522. <foreach collection="workOrderStatus.split(',')" item="status" open="(" close=")" separator=",">
  523. #{status}
  524. </foreach>
  525. </if>
  526. and accept_time is not null
  527. and occur_time is not null
  528. and restart_time is not null
  529. </where>
  530. order by create_time desc
  531. </select>
  532. <select id="selectGxtRepairOrderByWorkOrderProjectNo" parameterType="String" resultMap="GxtRepairOrderResult">
  533. <include refid="selectGxtRepairOrderVo"/>
  534. where work_order_project_no = #{workOrderProjectNo}
  535. </select>
  536. <select id="selectGxtRepairOrderListNoPermi" parameterType="GxtRepairOrder" resultMap="GxtRepairOrderResult">
  537. <include refid="selectGxtRepairOrderVo"/>
  538. <where>
  539. <if test="workOrderProjectNo != null and workOrderProjectNo != ''"> and work_order_project_no = #{workOrderProjectNo}</if>
  540. <if test="workOrderStatus != null and workOrderStatus != ''"> and work_order_status = #{workOrderStatus}</if>
  541. <if test="gxtCenterId != null "> and gxt_center_id = #{gxtCenterId}</if>
  542. <if test="gxtCenter != null and gxtCenter != ''"> and gxt_center = #{gxtCenter}</if>
  543. <if test="pcsStationId != null "> and pcs_station_id = #{pcsStationId}</if>
  544. <if test="pcsStationName != null and pcsStationName != ''"> and pcs_station_name = #{pcsStationName} </if>
  545. <if test="pcsDeviceId != null "> and pcs_device_id = #{pcsDeviceId}</if>
  546. <if test="pcsDeviceName != null and pcsDeviceName != ''"> and pcs_device_name like concat('%', #{pcsDeviceName}, '%')</if>
  547. <if test="brand != null and brand != ''"> and brand = #{brand}</if>
  548. <if test="model != null and model != ''"> and model = #{model}</if>
  549. <if test="faultCode != null and faultCode != ''"> and fault_code like concat('%', #{faultCode}, '%')</if>
  550. <if test="faultDesc != null and faultDesc != ''"> and fault_desc = #{faultDesc}</if>
  551. <if test="assignTime != null "> and assign_time = #{assignTime}</if>
  552. <if test="assignUserId != null "> and assign_user_id = #{assignUserId}</if>
  553. <if test="assignUserName != null and assignUserName != ''"> and assign_user_name like concat('%', #{assignUserName}, '%')</if>
  554. <if test="acceptTime != null "> and accept_time = #{acceptTime}</if>
  555. <if test="acceptUserId != null "> and accept_user_id = #{acceptUserId}</if>
  556. <if test="acceptUserName != null and acceptUserName != ''"> and accept_user_name like concat('%', #{acceptUserName}, '%')</if>
  557. <if test="realStartTime != null "> and real_start_time = #{realStartTime}</if>
  558. <if test="realEndTime != null "> and real_end_time = #{realEndTime}</if>
  559. <if test="teamLeaderId != null "> and team_leader_id = #{teamLeaderId}</if>
  560. <if test="teamLeaderName != null and teamLeaderName != ''"> and team_leader_name like concat('%', #{teamLeaderName}, '%')</if>
  561. <if test="workGroupMemberId != null "> and work_group_member_id = #{workGroupMemberId}</if>
  562. <if test="workGroupMemberName != null and workGroupMemberName != ''"> and work_group_member_name like concat('%', #{workGroupMemberName}, '%')</if>
  563. <if test="content != null and content != ''"> and content = #{content}</if>
  564. <if test="planHour != null "> and plan_hour = #{planHour}</if>
  565. <if test="priorityType != null "> and priority_type = #{priorityType}</if>
  566. <if test="score != null "> and score = #{score}</if>
  567. <if test="reviewContent != null and reviewContent != ''"> and review_content = #{reviewContent}</if>
  568. <if test="maintenanceType != null and maintenanceType != ''"> and maintenance_type = #{maintenanceType}</if>
  569. <if test="occurTime != null "> and occur_time = #{occurTime}</if>
  570. <if test="faultBarcode != null and faultBarcode != ''"> and fault_barcode = #{faultBarcode}</if>
  571. <if test="suspendReason != null and suspendReason != ''"> and suspend_reason = #{suspendReason}</if>
  572. <if test="suspendDescription != null and suspendDescription != ''"> and suspend_description = #{suspendDescription}</if>
  573. <if test="approvalStatus != null and approvalStatus != ''"> and approval_status = #{approvalStatus}</if>
  574. <if test="rejectionReason != null and rejectionReason != ''"> and rejection_reason = #{rejectionReason}</if>
  575. <if test="modifyReason != null and modifyReason != ''"> and modify_reason = #{modifyReason}</if>
  576. <if test="finalizationRemark != null and finalizationRemark != ''"> and finalization_remark = #{finalizationRemark}</if>
  577. <if test="relatedOrderCode != null and relatedOrderCode != ''"> and related_order_code = #{relatedOrderCode}</if>
  578. <if test="relatedOrderContent != null and relatedOrderContent != ''"> and related_order_content = #{relatedOrderContent}</if>
  579. <if test="misOrderNo != null and misOrderNo != ''"> and mis_order_no = #{misOrderNo}</if>
  580. <if test="restartTime != null "> and restart_time = #{restartTime}</if>
  581. <if test="scoringStatus != null "> and scoring_status = #{scoringStatus}</if>
  582. <if test="pcsStationPid != null "> and pcs_station_pid = #{pcsStationPid}</if>
  583. <if test="attachmentUrls != null and attachmentUrls != ''"> and attachment_urls = #{attachmentUrls}</if>
  584. <if test="reviewScoreNum != null "> and review_score_num = #{reviewScoreNum}</if>
  585. <if test="repairMethod != null and repairMethod != ''"> and repair_method = #{repairMethod}</if>
  586. <if test="resetMethod != null and resetMethod != ''"> and reset_method = #{resetMethod}</if>
  587. <if test="returnType != null and returnType != ''"> and return_type = #{returnType}</if>
  588. <if test="returnReason != null and returnReason != ''"> and return_reason = #{returnReason}</if>
  589. <if test="wwryNum != null"> and wwry_num = #{wwryNum}</if>
  590. <if test="wlryNum != null"> and wlry_num = #{wlryNum}</if>
  591. <if test="workArea != null and workArea != ''"> and work_area = #{workArea}</if>
  592. <if test="infoEntry != null and infoEntry != ''"> and info_entry = #{infoEntry}</if>
  593. <if test="realFailureReason != null and realFailureReason != ''"> and real_failure_reason = #{realFailureReason}</if>
  594. <if test="lostPower != null"> and lost_power = #{lostPower}</if>
  595. <if test="workPermitNum != null and workPermitNum != ''"> and work_permit_num = #{workPermitNum}</if>
  596. </where>
  597. order by id desc
  598. </select>
  599. <select id="selectRepairOrderWithPersonById" parameterType="Long" resultMap="GxtRepairOrderWithPersonResult">
  600. SELECT
  601. t1.id,
  602. t1.work_order_project_no,
  603. t1.work_order_status,
  604. t1.gxt_center_id,
  605. t1.gxt_center,
  606. t1.pcs_station_id,
  607. t1.pcs_station_name,
  608. t1.pcs_device_id,
  609. t1.pcs_device_name,
  610. t1.brand,
  611. t1.model,
  612. t1.fault_code,
  613. t1.fault_desc,
  614. t1.assign_time,
  615. t1.assign_user_id,
  616. t1.assign_user_name,
  617. t1.accept_time,
  618. t1.accept_user_id,
  619. t1.accept_user_name,
  620. t1.real_start_time,
  621. t1.real_end_time,
  622. t1.team_leader_id,
  623. t1.team_leader_name,
  624. t1.work_group_member_id,
  625. t1.work_group_member_name,
  626. t1.content,
  627. t1.plan_hour,
  628. t1.priority_type,
  629. t1.score,
  630. t1.review_content,
  631. t1.maintenance_type,
  632. t1.occur_time,
  633. t1.fault_barcode,
  634. t1.suspend_reason,
  635. t1.suspend_description,
  636. t1.approval_status,
  637. t1.rejection_reason,
  638. t1.modify_reason,
  639. t1.finalization_remark,
  640. t1.related_order_code,
  641. t1.related_order_content,
  642. t1.mis_order_no,
  643. t1.restart_time,
  644. t1.scoring_status,
  645. t1.pcs_station_pid,
  646. t1.attachment_urls,
  647. t1.review_score_num,
  648. t1.final_coefficient,
  649. t1.create_by,
  650. t1.create_time,
  651. t1.update_by,
  652. t1.update_time,
  653. t1.remark,
  654. t1.return_type,
  655. t1.return_reason,
  656. t1.order_attachment,
  657. t1.extra_work,
  658. t1.accept_return_type,
  659. t1.accept_return_reason,
  660. t1.score_return_reason,
  661. t2.id as person_id,
  662. t2.user_id as person_user_id,
  663. t2.nick_name as person_nick_name,
  664. t2.order_id as person_order_id,
  665. t2.order_code as person_order_code,
  666. t2.status as person_status,
  667. t2.self_score as person_self_score,
  668. t2.review_score as person_review_score,
  669. t2.final_score as person_final_score,
  670. t2.is_leader as person_is_leader,
  671. t2.extra_score as person_extra_score,
  672. t2.total_score as person_total_score
  673. FROM gxt_repair_order t1
  674. LEFT JOIN gxt_repair_order_person t2 ON t1.id = t2.order_id
  675. WHERE t1.id = #{id}
  676. </select>
  677. <select id="selectGSTJ" resultMap="GxtOrderDataResult">
  678. SELECT
  679. u.user_id,a.wxgs,b.wbgs
  680. FROM sys_user u
  681. LEFT JOIN (
  682. SELECT
  683. rop.user_id,
  684. SUM((TIMESTAMPDIFF( SECOND, ro.real_start_time, ro.real_end_time ) - IFNULL(gq.total_in_work_suspend_seconds, 0))) / 3600 AS wxgs
  685. FROM
  686. gxt_repair_order_person rop
  687. LEFT JOIN gxt_repair_order ro ON rop.order_id = ro.id
  688. LEFT JOIN gxt_repair_order_flow_records_next gq ON gq.order_id = rop.order_id
  689. LEFT JOIN (SELECT order_id,MAX(action_time) AS finish_time FROM gxt_repair_order_flow WHERE action_type IN ('complete','auto_finalize') GROUP BY order_id) flow ON flow.order_id=rop.order_id
  690. WHERE
  691. ro.repair_method!='2' AND ro.work_order_status IN ('completed','archived') AND flow.finish_time IS NOT NULL
  692. AND flow.finish_time >= STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
  693. AND flow.finish_time <![CDATA[<]]> DATE_ADD( STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' ), INTERVAL 1 MONTH )
  694. GROUP BY
  695. rop.user_id) a ON a.user_id=u.user_id
  696. LEFT JOIN (
  697. SELECT
  698. wop.user_id,
  699. SUM((TIMESTAMPDIFF( SECOND, wo.real_start_time, wo.real_end_time ) - IFNULL(gq.total_in_work_suspend_seconds, 0))) / 3600 AS wbgs
  700. FROM
  701. gxt_work_order_person wop
  702. LEFT JOIN gxt_work_order wo ON wop.order_id = wo.id
  703. LEFT JOIN gxt_work_order_flow_records_next gq ON gq.order_id = wop.order_id
  704. LEFT JOIN (SELECT order_id,MAX(action_time) AS finish_time FROM gxt_work_order_flow WHERE action_type IN ('complete','auto_finalize') GROUP BY order_id) flow ON flow.order_id=wop.order_id
  705. WHERE
  706. wo.work_order_status IN ('completed','archived') AND flow.finish_time IS NOT NULL
  707. AND flow.finish_time >= STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
  708. AND flow.finish_time <![CDATA[<]]> DATE_ADD( STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' ), INTERVAL 1 MONTH )
  709. GROUP BY
  710. wop.user_id) b ON u.user_id=b.user_id
  711. <where>
  712. <if test="userId != null"> and u.user_id=#{userId}</if>
  713. </where>
  714. </select>
  715. <select id="selectHomePageData" resultMap="GxtOrderDataResult">
  716. SELECT
  717. u.user_id,
  718. IFNULL( a.order_num, 0 ) AS workOrderNum,
  719. IFNULL( b.order_num_last, 0 ) AS workOrderNumLast,
  720. IFNULL( c.repair_num, 0 ) AS repairOrderNum,
  721. IFNULL( cc.repair_num, 0 ) AS repairRestartOrderNum,
  722. IFNULL( d.repair_num_last, 0 ) AS repairOrderNumLast,
  723. IFNULL( n.score, 0 ) AS score,
  724. IFNULL( o.score, 0 ) AS score_last,
  725. IFNULL( p.pcsWorkOrderNum, 0 ) AS pcsWorkOrderNum,
  726. IFNULL( q.pcsRepairOrderNum, 0 ) AS pcsRepairOrderNum,
  727. IFNULL( qq.pcsRepairOrderNum, 0 ) AS pcsRepairRestartOrderNum,
  728. IFNULL( r.centerWorkOrderNum, 0 ) AS centerWorkOrderNum,
  729. IFNULL( s.centerRepairOrderNum, 0 ) AS centerRepairOrderNum,
  730. IFNULL( ss.centerRepairOrderNum, 0 ) AS centerRepairRestartOrderNum,
  731. IFNULL( t.companyWorkOrderNum, 0 ) AS companyWorkOrderNum,
  732. IFNULL( tt.companyRepairOrderNum, 0 ) AS companyRepairOrderNum,
  733. IFNULL( ttt.companyRepairOrderNum, 0 ) AS companyRepairRestartOrderNum
  734. FROM
  735. sys_user u
  736. LEFT JOIN (
  737. SELECT
  738. COUNT(*) AS order_num,
  739. wop.user_id
  740. FROM
  741. gxt_work_order wo
  742. LEFT JOIN gxt_work_order_person wop ON wo.id = wop.order_id
  743. WHERE wo.work_order_status IN ('completed','archived') AND
  744. wo.create_time >= STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
  745. AND wo.create_time <![CDATA[<]]> DATE_ADD( STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' ), INTERVAL 1 MONTH )
  746. GROUP BY
  747. wop.user_id
  748. ) a ON a.user_id = u.user_id
  749. LEFT JOIN (
  750. SELECT
  751. COUNT(*) AS order_num_last,
  752. wop.user_id
  753. FROM
  754. gxt_work_order wo
  755. LEFT JOIN gxt_work_order_person wop ON wo.id = wop.order_id
  756. WHERE wo.work_order_status IN ('completed','archived') AND
  757. wo.create_time >= DATE_ADD( STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' ), INTERVAL - 1 MONTH )
  758. AND wo.create_time <![CDATA[<]]> STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
  759. GROUP BY
  760. wop.user_id
  761. ) b ON u.user_id = b.user_id
  762. LEFT JOIN (
  763. SELECT
  764. COUNT(*) AS repair_num,
  765. rop.user_id
  766. FROM
  767. gxt_repair_order ro
  768. LEFT JOIN gxt_repair_order_person rop ON ro.id = rop.order_id
  769. WHERE ro.work_order_status IN ('completed','archived') AND ro.repair_method != '2'
  770. AND ro.occur_time >= STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
  771. AND ro.occur_time <![CDATA[<]]> DATE_ADD( STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' ), INTERVAL 1 MONTH )
  772. GROUP BY
  773. rop.user_id
  774. ) c ON u.user_id = c.user_id
  775. LEFT JOIN (
  776. SELECT
  777. COUNT(*) AS repair_num,
  778. rop.user_id
  779. FROM
  780. gxt_repair_order ro
  781. LEFT JOIN gxt_repair_order_person rop ON ro.id = rop.order_id
  782. WHERE ro.work_order_status IN ('completed','archived') AND ro.repair_method = '2'
  783. AND ro.occur_time >= STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
  784. AND ro.occur_time <![CDATA[<]]> DATE_ADD( STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' ), INTERVAL 1 MONTH )
  785. GROUP BY
  786. rop.user_id
  787. ) cc ON u.user_id = cc.user_id
  788. LEFT JOIN (
  789. SELECT
  790. COUNT(*) AS repair_num_last,
  791. rop.user_id
  792. FROM
  793. gxt_repair_order ro
  794. LEFT JOIN gxt_repair_order_person rop ON ro.id = rop.order_id
  795. WHERE ro.work_order_status IN ('completed','archived') AND
  796. ro.occur_time >= DATE_ADD( STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' ), INTERVAL - 1 MONTH )
  797. AND ro.occur_time <![CDATA[<]]> STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
  798. GROUP BY
  799. rop.user_id
  800. ) d ON u.user_id = d.user_id
  801. LEFT JOIN (
  802. SELECT
  803. SUM( us.final_score ) AS score,
  804. su.user_id
  805. FROM
  806. gxt_user_score us
  807. LEFT JOIN sys_user su ON us.user_name = su.user_name
  808. WHERE
  809. us.month_period = #{monthPeriod}
  810. GROUP BY
  811. su.user_id
  812. ) n ON u.user_id = n.user_id
  813. LEFT JOIN (
  814. SELECT
  815. SUM( us.final_score ) AS score,
  816. su.user_id
  817. FROM
  818. gxt_user_score us
  819. LEFT JOIN sys_user su ON us.user_name = su.user_name
  820. WHERE
  821. us.month_period = DATE_FORMAT( DATE_SUB( STR_TO_DATE( CONCAT( #{monthPeriod}, '-01' ), '%Y-%m-%d' ), INTERVAL 1 MONTH ), '%Y-%m' )
  822. GROUP BY
  823. su.user_id
  824. ) o ON u.user_id = o.user_id
  825. LEFT JOIN (
  826. SELECT
  827. COUNT(*) AS pcsWorkOrderNum,
  828. su.dept_id,su.user_id
  829. FROM
  830. gxt_work_order wo
  831. LEFT JOIN sys_user su ON wo.pcs_station_pid = su.dept_id
  832. WHERE wo.work_order_status IN ('completed','archived') AND
  833. su.user_id = #{userId}
  834. AND wo.create_time >= STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
  835. AND wo.create_time <![CDATA[<]]> DATE_ADD( STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' ), INTERVAL 1 MONTH )
  836. ) p ON u.user_id = p.user_id
  837. LEFT JOIN (
  838. SELECT
  839. COUNT(*) AS pcsRepairOrderNum,
  840. su.dept_id,su.user_id
  841. FROM
  842. gxt_repair_order wo
  843. LEFT JOIN sys_user su ON wo.pcs_station_pid = su.dept_id
  844. WHERE wo.work_order_status IN ('completed','archived') AND wo.repair_method != '2'
  845. AND su.user_id = #{userId}
  846. AND wo.create_time >= STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
  847. AND wo.create_time <![CDATA[<]]> DATE_ADD( STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' ), INTERVAL 1 MONTH )
  848. ) q ON u.user_id = q.user_id
  849. LEFT JOIN (
  850. SELECT
  851. COUNT(*) AS pcsRepairOrderNum,
  852. su.dept_id,su.user_id
  853. FROM
  854. gxt_repair_order wo
  855. LEFT JOIN sys_user su ON wo.pcs_station_pid = su.dept_id
  856. WHERE wo.work_order_status IN ('completed','archived') AND wo.repair_method = '2'
  857. AND su.user_id = #{userId}
  858. AND wo.create_time >= STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
  859. AND wo.create_time <![CDATA[<]]> DATE_ADD( STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' ), INTERVAL 1 MONTH )
  860. ) qq ON u.user_id = qq.user_id
  861. LEFT JOIN (
  862. SELECT
  863. COUNT(*) AS centerWorkOrderNum,
  864. su.dept_id,su.user_id
  865. FROM
  866. gxt_work_order wo
  867. LEFT JOIN sys_user su ON wo.gxt_center_id = su.dept_id
  868. WHERE wo.work_order_status IN ('completed','archived') AND
  869. su.user_id = #{userId}
  870. AND wo.create_time >= STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
  871. AND wo.create_time <![CDATA[<]]> DATE_ADD( STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' ), INTERVAL 1 MONTH )
  872. ) r ON u.user_id = r.user_id
  873. LEFT JOIN (
  874. SELECT
  875. COUNT(*) AS centerRepairOrderNum,
  876. su.dept_id,su.user_id
  877. FROM
  878. gxt_repair_order wo
  879. LEFT JOIN sys_user su ON wo.gxt_center_id = su.dept_id
  880. WHERE wo.work_order_status IN ('completed','archived') AND wo.repair_method != '2'
  881. AND su.user_id = #{userId}
  882. AND wo.create_time >= STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
  883. AND wo.create_time <![CDATA[<]]> DATE_ADD( STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' ), INTERVAL 1 MONTH )
  884. ) s ON u.user_id = s.user_id
  885. LEFT JOIN (
  886. SELECT
  887. COUNT(*) AS centerRepairOrderNum,
  888. su.dept_id,su.user_id
  889. FROM
  890. gxt_repair_order wo
  891. LEFT JOIN sys_user su ON wo.gxt_center_id = su.dept_id
  892. WHERE wo.work_order_status IN ('completed','archived') AND wo.repair_method = '2'
  893. AND su.user_id = #{userId}
  894. AND wo.create_time >= STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
  895. AND wo.create_time <![CDATA[<]]> DATE_ADD( STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' ), INTERVAL 1 MONTH )
  896. ) ss ON u.user_id = ss.user_id
  897. LEFT JOIN (
  898. SELECT
  899. COUNT(*) AS companyWorkOrderNum,#{userId} AS user_id
  900. FROM
  901. gxt_work_order wo
  902. WHERE wo.work_order_status IN ('completed','archived') AND
  903. wo.create_time >= STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
  904. AND wo.create_time <![CDATA[<]]> DATE_ADD( STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' ), INTERVAL 1 MONTH )
  905. ) t ON u.user_id = t.user_id
  906. LEFT JOIN (
  907. SELECT
  908. COUNT(*) AS companyRepairOrderNum,#{userId} AS user_id
  909. FROM
  910. gxt_repair_order wo
  911. WHERE wo.work_order_status IN ('completed','archived') AND wo.repair_method != '2'
  912. AND wo.occur_time >= STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
  913. AND wo.occur_time <![CDATA[<]]> DATE_ADD( STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' ), INTERVAL 1 MONTH )
  914. ) tt ON u.user_id = tt.user_id
  915. LEFT JOIN (
  916. SELECT
  917. COUNT(*) AS companyRepairOrderNum,#{userId} AS user_id
  918. FROM
  919. gxt_repair_order wo
  920. WHERE wo.work_order_status IN ('completed','archived') AND wo.repair_method = '2'
  921. AND wo.occur_time >= STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
  922. AND wo.occur_time <![CDATA[<]]> DATE_ADD( STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' ), INTERVAL 1 MONTH )
  923. ) ttt ON u.user_id = ttt.user_id
  924. WHERE
  925. u.user_id = #{userId}
  926. </select>
  927. <select id="selectHomePageRank" parameterType="GxtUserScore" resultMap="GxtUserScoreResult">
  928. SELECT
  929. u.user_id,
  930. u.user_name,
  931. u.nick_name,
  932. d.dept_id,
  933. d.dept_name,
  934. p.dept_id AS center_id,
  935. p.dept_name AS center,
  936. (SELECT dept_name FROM sys_dept WHERE parent_id=0) AS companyName,
  937. IFNULL(us.final_score,0) AS final_score
  938. FROM
  939. sys_user u
  940. LEFT JOIN sys_dept d ON u.dept_id = d.dept_id
  941. LEFT JOIN sys_dept p ON d.parent_id = p.dept_id
  942. LEFT JOIN gxt_user_score us ON u.user_name = us.user_name AND us.month_period = DATE_FORMAT(CURDATE(), '%Y-%m')
  943. WHERE 1=1
  944. <if test="deptId != null">
  945. AND d.dept_id=#{deptId}
  946. </if>
  947. <if test="centerId != null">
  948. AND p.dept_id=#{centerId}
  949. </if>
  950. <if test="permission != null and permission != ''">
  951. AND u.user_id IN
  952. <foreach item="item" collection="permission.split(',')" open="(" separator="," close=")">
  953. #{item}
  954. </foreach>
  955. </if>
  956. ORDER BY
  957. IFNULL(us.final_score,0) DESC
  958. </select>
  959. <select id="selectLatestGxtRepairOrderByDeviceId" parameterType="map" resultMap="GxtRepairOrderResult">
  960. <include refid="selectGxtRepairOrderVo"/>
  961. <where>
  962. <if test="pcsDeviceId != null"> and pcs_device_id = #{pcsDeviceId}</if>
  963. <if test="limit != null and limit > 0">
  964. ORDER BY create_time DESC LIMIT #{limit}
  965. </if>
  966. </where>
  967. </select>
  968. <select id="selectGxtRepairOrderByDeviceIdWithCondition" parameterType="map" resultMap="GxtRepairOrderResult">
  969. <include refid="selectGxtRepairOrderVo"/>
  970. <where>
  971. <if test="pcsDeviceId != null"> and pcs_device_id = #{pcsDeviceId}</if>
  972. <if test="workOrderStatus != null and workOrderStatus != ''">
  973. <if test="excludeStatus">
  974. and work_order_status != #{workOrderStatus}
  975. </if>
  976. <if test="!excludeStatus">
  977. and work_order_status = #{workOrderStatus}
  978. </if>
  979. </if>
  980. <if test="excludeRepairMethod2 != null and excludeRepairMethod2">
  981. and repair_method != '2'
  982. </if>
  983. <if test="orderByField != null and orderByField == 'restartTime'">
  984. and work_order_status IN ('completed','archived')
  985. </if>
  986. </where>
  987. <choose>
  988. <when test="orderByField != null and orderByField == 'occurTime'">
  989. ORDER BY occur_time DESC
  990. </when>
  991. <when test="orderByField != null and orderByField == 'restartTime'">
  992. ORDER BY restart_time DESC
  993. </when>
  994. <otherwise>
  995. ORDER BY create_time DESC
  996. </otherwise>
  997. </choose>
  998. <if test="limit != null and limit > 0">
  999. LIMIT #{limit}
  1000. </if>
  1001. </select>
  1002. </mapper>