|
|
@@ -0,0 +1,1109 @@
|
|
|
+<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
+<!DOCTYPE mapper
|
|
|
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
+<mapper namespace="com.ygtx.gxt.mapper.slave.GxtOrderMapper">
|
|
|
+
|
|
|
+ <resultMap type="GxtRepairOrder" id="GxtRepairOrderResult">
|
|
|
+ <result property="id" column="id" />
|
|
|
+ <result property="workOrderProjectNo" column="work_order_project_no" />
|
|
|
+ <result property="workOrderStatus" column="work_order_status" />
|
|
|
+ <result property="gxtCenterId" column="gxt_center_id" />
|
|
|
+ <result property="gxtCenter" column="gxt_center" />
|
|
|
+ <result property="pcsStationId" column="pcs_station_id" />
|
|
|
+ <result property="pcsStationName" column="pcs_station_name" />
|
|
|
+ <result property="pcsDeviceId" column="pcs_device_id" />
|
|
|
+ <result property="pcsDeviceName" column="pcs_device_name" />
|
|
|
+ <result property="brand" column="brand" />
|
|
|
+ <result property="model" column="model" />
|
|
|
+ <result property="faultCode" column="fault_code" />
|
|
|
+ <result property="faultDesc" column="fault_desc" />
|
|
|
+ <result property="assignTime" column="assign_time" />
|
|
|
+ <result property="assignUserId" column="assign_user_id" />
|
|
|
+ <result property="assignUserName" column="assign_user_name" />
|
|
|
+ <result property="acceptTime" column="accept_time" />
|
|
|
+ <result property="acceptUserId" column="accept_user_id" />
|
|
|
+ <result property="acceptUserName" column="accept_user_name" />
|
|
|
+ <result property="realStartTime" column="real_start_time" />
|
|
|
+ <result property="realEndTime" column="real_end_time" />
|
|
|
+ <result property="teamLeaderId" column="team_leader_id" />
|
|
|
+ <result property="teamLeaderName" column="team_leader_name" />
|
|
|
+ <result property="workGroupMemberId" column="work_group_member_id" />
|
|
|
+ <result property="workGroupMemberName" column="work_group_member_name" />
|
|
|
+ <result property="createBy" column="create_by" />
|
|
|
+ <result property="createTime" column="create_time" />
|
|
|
+ <result property="updateBy" column="update_by" />
|
|
|
+ <result property="updateTime" column="update_time" />
|
|
|
+ <result property="remark" column="remark" />
|
|
|
+ <result property="content" column="content" />
|
|
|
+ <result property="planHour" column="plan_hour" />
|
|
|
+ <result property="priorityType" column="priority_type" />
|
|
|
+ <result property="score" column="score" />
|
|
|
+ <result property="reviewContent" column="review_content" />
|
|
|
+ <result property="maintenanceType" column="maintenance_type" />
|
|
|
+ <result property="occurTime" column="occur_time" />
|
|
|
+ <result property="faultBarcode" column="fault_barcode" />
|
|
|
+ <result property="suspendReason" column="suspend_reason" />
|
|
|
+ <result property="suspendDescription" column="suspend_description" />
|
|
|
+ <result property="approvalStatus" column="approval_status" />
|
|
|
+ <result property="rejectionReason" column="rejection_reason" />
|
|
|
+ <result property="modifyReason" column="modify_reason" />
|
|
|
+ <result property="finalizationRemark" column="finalization_remark" />
|
|
|
+ <result property="relatedOrderCode" column="related_order_code" />
|
|
|
+ <result property="relatedOrderContent" column="related_order_content" />
|
|
|
+ <result property="misOrderNo" column="mis_order_no" />
|
|
|
+ <result property="restartTime" column="restart_time" />
|
|
|
+ <result property="scoringStatus" column="scoring_status" />
|
|
|
+ <result property="pcsStationPid" column="pcs_station_pid" />
|
|
|
+ <result property="attachmentUrls" column="attachment_urls" />
|
|
|
+ <result property="reviewScoreNum" column="review_score_num" />
|
|
|
+ <result property="finalCoefficient" column="final_coefficient" />
|
|
|
+ <result property="orderType" column="order_type" />
|
|
|
+ <result property="orderEntryType" column="order_entry_type" />
|
|
|
+ <result property="repairMethod" column="repair_method" />
|
|
|
+ <result property="resetMethod" column="reset_method" />
|
|
|
+ <result property="invalidReason" column="invalid_reason" />
|
|
|
+ <result property="returnType" column="return_type" />
|
|
|
+ <result property="returnReason" column="return_reason" />
|
|
|
+ <result property="feedbackReason" column="feedback_reason" />
|
|
|
+ <result property="confirmStatus" column="confirm_status" />
|
|
|
+ <result property="wwryNum" column="wwry_num" />
|
|
|
+ <result property="wlryNum" column="wlry_num" />
|
|
|
+ <result property="workArea" column="work_area" />
|
|
|
+ <result property="infoEntry" column="info_entry" />
|
|
|
+ <result property="realFailureReason" column="real_failure_reason" />
|
|
|
+ <result property="lostPower" column="lost_power" />
|
|
|
+ <result property="workPermitNum" column="work_permit_num" />
|
|
|
+ <result property="finalizeMethod" column="finalize_method" />
|
|
|
+ <result property="appealUserName" column="appeal_user_name" />
|
|
|
+ <result property="appealUserId" column="appeal_user_id" />
|
|
|
+ <result property="appealTime" column="appeal_time" />
|
|
|
+ <result property="appealReason" column="appeal_reason" />
|
|
|
+ <result property="suspendExplain" column="suspend_explain" />
|
|
|
+ <result property="orderAttachment" column="order_attachment" />
|
|
|
+ <result property="extraWork" column="extra_work" />
|
|
|
+ <result property="acceptReturnType" column="accept_return_type" />
|
|
|
+ <result property="acceptReturnReason" column="accept_return_reason" />
|
|
|
+ <result property="scoreReturnReason" column="score_return_reason" />
|
|
|
+ <result property="overStopStatus" column="over_stop_status" />
|
|
|
+ <result property="leader" column="leader" />
|
|
|
+ <result property="userId" column="user_id" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <resultMap type="GxtRepairOrder" id="GxtRepairOrderWithPersonResult" extends="GxtRepairOrderResult">
|
|
|
+ <collection property="repairOrderPersonList" ofType="com.ygtx.gxt.domain.GxtRepairOrderPerson">
|
|
|
+ <result property="id" column="person_id"/>
|
|
|
+ <result property="userId" column="person_user_id"/>
|
|
|
+ <result property="nickName" column="person_nick_name"/>
|
|
|
+ <result property="orderId" column="person_order_id"/>
|
|
|
+ <result property="orderCode" column="person_order_code"/>
|
|
|
+ <result property="status" column="person_status"/>
|
|
|
+ <result property="selfScore" column="person_self_score"/>
|
|
|
+ <result property="reviewScore" column="person_review_score"/>
|
|
|
+ <result property="finalScore" column="person_final_score"/>
|
|
|
+ <result property="isLeader" column="person_is_leader"/>
|
|
|
+ <result property="extraScore" column="person_extra_score"/>
|
|
|
+ <result property="totalScore" column="person_total_score"/>
|
|
|
+ </collection>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <resultMap type="GxtOrderData" id="GxtOrderDataResult">
|
|
|
+ <result property="userId" column="user_id" />
|
|
|
+ <result property="workOrderNum" column="workOrderNum" />
|
|
|
+ <result property="workOrderNumLast" column="workOrderNumLast" />
|
|
|
+ <result property="repairOrderNum" column="repairOrderNum" />
|
|
|
+ <result property="repairRestartOrderNum" column="repairRestartOrderNum" />
|
|
|
+ <result property="repairOrderNumLast" column="repairOrderNumLast" />
|
|
|
+ <result property="wxgs" column="wxgs" />
|
|
|
+ <result property="wxgsLast" column="wxgs_last" />
|
|
|
+ <result property="wbgs" column="wbgs" />
|
|
|
+ <result property="wbgsLast" column="wbgs_last" />
|
|
|
+ <result property="score" column="score" />
|
|
|
+ <result property="scoreLast" column="score_last" />
|
|
|
+ <result property="pcsWorkOrderNum" column="pcsWorkOrderNum" />
|
|
|
+ <result property="centerWorkOrderNum" column="centerWorkOrderNum" />
|
|
|
+ <result property="companyWorkOrderNum" column="companyWorkOrderNum" />
|
|
|
+ <result property="pcsRepairOrderNum" column="pcsRepairOrderNum" />
|
|
|
+ <result property="pcsRepairRestartOrderNum" column="pcsRepairRestartOrderNum" />
|
|
|
+ <result property="centerRepairOrderNum" column="centerRepairOrderNum" />
|
|
|
+ <result property="centerRepairRestartOrderNum" column="centerRepairRestartOrderNum" />
|
|
|
+ <result property="companyRepairOrderNum" column="companyRepairOrderNum" />
|
|
|
+ <result property="companyRepairRestartOrderNum" column="companyRepairRestartOrderNum" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <resultMap type="GxtUserScore" id="GxtUserScoreResult">
|
|
|
+ <result property="monthPeriod" column="month_period"/>
|
|
|
+ <result property="userId" column="user_id"/>
|
|
|
+ <result property="userName" column="user_name"/>
|
|
|
+ <result property="nickName" column="nick_name"/>
|
|
|
+ <result property="deptId" column="dept_id"/>
|
|
|
+ <result property="deptName" column="dept_name"/>
|
|
|
+ <result property="finalScore" column="final_score"/>
|
|
|
+ <result property="centerId" column="center_id"/>
|
|
|
+ <result property="center" column="center"/>
|
|
|
+ <result property="companyName" column="companyName"/>
|
|
|
+ <result property="permission" column="permission"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="selectGxtRepairOrderVo">
|
|
|
+ select id, work_order_project_no, work_order_status, gxt_center_id, gxt_center, pcs_station_id, pcs_station_name, pcs_device_id,
|
|
|
+ pcs_device_name, brand, model, fault_code, fault_desc, assign_time, assign_user_id, assign_user_name, accept_time,
|
|
|
+ accept_user_id, accept_user_name, real_start_time, real_end_time, team_leader_id, team_leader_name, work_group_member_id,
|
|
|
+ work_group_member_name, t.create_by, t.create_time, t.update_by, t.update_time, t.remark, content, plan_hour, priority_type, score,
|
|
|
+ review_content, maintenance_type, occur_time, fault_barcode, suspend_reason, suspend_description, approval_status,
|
|
|
+ rejection_reason, modify_reason, finalization_remark, related_order_code, related_order_content, mis_order_no, restart_time,
|
|
|
+ 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,
|
|
|
+ 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, over_stop_status
|
|
|
+ from gxt_repair_order t
|
|
|
+ left join sys_user u on u.user_name = t.create_by
|
|
|
+ left join sys_dept d on u.dept_id = d.dept_id
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectGxtRepairOrderList" parameterType="GxtRepairOrder" resultMap="GxtRepairOrderResult">
|
|
|
+ <include refid="selectGxtRepairOrderVo"/>
|
|
|
+ <where>
|
|
|
+ <if test="workOrderProjectNo != null and workOrderProjectNo != ''"> and work_order_project_no like concat('%', #{workOrderProjectNo}, '%')</if>
|
|
|
+ <if test="workOrderStatus != null and workOrderStatus != ''"> and work_order_status = #{workOrderStatus}</if>
|
|
|
+ <if test="gxtCenterId != null "> and gxt_center_id = #{gxtCenterId}</if>
|
|
|
+ <if test="gxtCenter != null and gxtCenter != ''"> and gxt_center = #{gxtCenter}</if>
|
|
|
+ <if test="pcsStationId != null "> and pcs_station_id = #{pcsStationId}</if>
|
|
|
+ <if test="pcsStationName != null and pcsStationName != ''"> and pcs_station_name = #{pcsStationName} </if>
|
|
|
+ <if test="pcsDeviceId != null "> and pcs_device_id = #{pcsDeviceId}</if>
|
|
|
+ <if test="pcsDeviceName != null and pcsDeviceName != ''"> and pcs_device_name like concat('%', #{pcsDeviceName}, '%')</if>
|
|
|
+ <if test="brand != null and brand != ''"> and brand = #{brand}</if>
|
|
|
+ <if test="model != null and model != ''"> and model = #{model}</if>
|
|
|
+ <if test="faultCode != null and faultCode != ''"> and fault_code like concat('%', #{faultCode}, '%')</if>
|
|
|
+ <if test="faultDesc != null and faultDesc != ''"> and fault_desc = #{faultDesc}</if>
|
|
|
+ <if test="assignTime != null "> and assign_time = #{assignTime}</if>
|
|
|
+ <if test="assignUserId != null "> and assign_user_id = #{assignUserId}</if>
|
|
|
+ <if test="assignUserName != null and assignUserName != ''"> and assign_user_name like concat('%', #{assignUserName}, '%')</if>
|
|
|
+ <if test="acceptTime != null "> and accept_time = #{acceptTime}</if>
|
|
|
+ <if test="acceptUserId != null "> and accept_user_id = #{acceptUserId}</if>
|
|
|
+ <if test="acceptUserName != null and acceptUserName != ''"> and accept_user_name like concat('%', #{acceptUserName}, '%')</if>
|
|
|
+ <if test="realStartTime != null "> and real_start_time = #{realStartTime}</if>
|
|
|
+ <if test="realEndTime != null "> and real_end_time = #{realEndTime}</if>
|
|
|
+ <if test="teamLeaderId != null "> and team_leader_id = #{teamLeaderId}</if>
|
|
|
+ <if test="teamLeaderName != null and teamLeaderName != ''"> and team_leader_name like concat('%', #{teamLeaderName}, '%')</if>
|
|
|
+ <if test="workGroupMemberId != null "> and work_group_member_id = #{workGroupMemberId}</if>
|
|
|
+ <if test="workGroupMemberName != null and workGroupMemberName != ''"> and work_group_member_name like concat('%', #{workGroupMemberName}, '%')</if>
|
|
|
+ <if test="content != null and content != ''"> and content = #{content}</if>
|
|
|
+ <if test="planHour != null "> and plan_hour = #{planHour}</if>
|
|
|
+ <if test="priorityType != null "> and priority_type = #{priorityType}</if>
|
|
|
+ <if test="score != null "> and score = #{score}</if>
|
|
|
+ <if test="reviewContent != null and reviewContent != ''"> and review_content = #{reviewContent}</if>
|
|
|
+ <if test="maintenanceType != null and maintenanceType != ''"> and maintenance_type = #{maintenanceType}</if>
|
|
|
+ <if test="occurTime != null "> and occur_time = #{occurTime}</if>
|
|
|
+ <if test="faultBarcode != null and faultBarcode != ''"> and fault_barcode = #{faultBarcode}</if>
|
|
|
+ <if test="suspendReason != null and suspendReason != ''"> and suspend_reason = #{suspendReason}</if>
|
|
|
+ <if test="suspendDescription != null and suspendDescription != ''"> and suspend_description = #{suspendDescription}</if>
|
|
|
+ <if test="approvalStatus != null and approvalStatus != ''"> and approval_status = #{approvalStatus}</if>
|
|
|
+ <if test="rejectionReason != null and rejectionReason != ''"> and rejection_reason = #{rejectionReason}</if>
|
|
|
+ <if test="modifyReason != null and modifyReason != ''"> and modify_reason = #{modifyReason}</if>
|
|
|
+ <if test="finalizationRemark != null and finalizationRemark != ''"> and finalization_remark = #{finalizationRemark}</if>
|
|
|
+ <if test="relatedOrderCode != null and relatedOrderCode != ''"> and related_order_code = #{relatedOrderCode}</if>
|
|
|
+ <if test="relatedOrderContent != null and relatedOrderContent != ''"> and related_order_content = #{relatedOrderContent}</if>
|
|
|
+ <if test="misOrderNo != null and misOrderNo != ''"> and mis_order_no = #{misOrderNo}</if>
|
|
|
+ <if test="restartTime != null "> and restart_time = #{restartTime}</if>
|
|
|
+ <if test="scoringStatus != null "> and scoring_status = #{scoringStatus}</if>
|
|
|
+ <if test="pcsStationPid != null "> and pcs_station_pid = #{pcsStationPid}</if>
|
|
|
+ <if test="attachmentUrls != null and attachmentUrls != ''"> and attachment_urls = #{attachmentUrls}</if>
|
|
|
+ <if test="reviewScoreNum != null "> and review_score_num = #{reviewScoreNum}</if>
|
|
|
+ <if test="finalCoefficient != null "> and final_coefficient = #{finalCoefficient}</if>
|
|
|
+ <if test="orderType != null "> and order_type = #{orderType}</if>
|
|
|
+ <if test="repairMethod != null and repairMethod != ''"> and repair_method = #{repairMethod}</if>
|
|
|
+ <if test="resetMethod != null and resetMethod != ''"> and reset_method = #{resetMethod}</if>
|
|
|
+ <if test="returnType != null and returnType != ''"> and return_type = #{returnType}</if>
|
|
|
+ <if test="returnReason != null and returnReason != ''"> and return_reason = #{returnReason}</if>
|
|
|
+ <if test="outTimeParam != null"> and DATE_SUB(NOW(), INTERVAL #{outTimeParam} MINUTE) > t.update_time </if>
|
|
|
+ <if test="wwryNum != null"> and wwry_num = #{wwryNum}</if>
|
|
|
+ <if test="wlryNum != null"> and wlry_num = #{wlryNum}</if>
|
|
|
+ <if test="workArea != null and workArea != ''"> and work_area = #{workArea}</if>
|
|
|
+ <if test="infoEntry != null and infoEntry != ''"> and info_entry = #{infoEntry}</if>
|
|
|
+ <if test="realFailureReason != null and realFailureReason != ''"> and real_failure_reason = #{realFailureReason}</if>
|
|
|
+ <if test="lostPower != null"> and lost_power = #{lostPower}</if>
|
|
|
+ <if test="workPermitNum != null and workPermitNum != ''"> and work_permit_num = #{workPermitNum}</if>
|
|
|
+ <if test="beginOccurTime != null and beginOccurTime != ''"> and date_format(occur_time,'%y%m%d') >= date_format(#{beginOccurTime},'%y%m%d')</if>
|
|
|
+ <if test="endOccurTime != null and endOccurTime != ''"> and date_format(occur_time,'%y%m%d') <= date_format(#{endOccurTime},'%y%m%d')</if>
|
|
|
+
|
|
|
+ <!-- 业务特定数据权限过滤条件 -->
|
|
|
+ <if test="params.businessDataScope != null and params.businessDataScope != ''">
|
|
|
+ ${params.businessDataScope}
|
|
|
+ </if>
|
|
|
+ <!-- 限制待下发工单只能创建人本部门查看 -->
|
|
|
+ <if test="params.currentUser != null and params.currentUser != ''">
|
|
|
+ and ((t.work_order_status != 'to_issue' and t.work_order_status != 'accept_return') or t.create_by in
|
|
|
+ (select user_name from sys_user t1
|
|
|
+ left join sys_dept t2 on t1.dept_id = t2.dept_id
|
|
|
+ where t2.dept_id = (select dept_id from sys_user where user_name = #{params.currentUser,jdbcType=VARCHAR} and del_flag='0')))
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ order by create_time desc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectGxtRepairOrderListByMonth" parameterType="GxtRepairOrder" resultMap="GxtRepairOrderResult">
|
|
|
+ SELECT
|
|
|
+ t.*
|
|
|
+ FROM
|
|
|
+ gxt_repair_order t
|
|
|
+ <if test="userId != null">LEFT JOIN gxt_repair_order_person p ON p.order_id = t.id</if>
|
|
|
+ <where>
|
|
|
+ <if test="userId != null"> and p.user_id=#{userId}</if>
|
|
|
+ <if test="workOrderStatus != null and workOrderStatus != ''"> and work_order_status IN ('completed','archived')</if>
|
|
|
+ <if test="pcsStationPid != null "> and pcs_station_pid = #{pcsStationPid}</if>
|
|
|
+ <if test="maintenanceType != null and maintenanceType != ''"> and maintenance_type = #{maintenanceType}</if>
|
|
|
+ <if test="monthPeriod != null"> and DATE_FORMAT(occur_time, '%Y-%m') = #{monthPeriod}</if>
|
|
|
+ <if test="params.businessDataScope != null and params.businessDataScope != ''">
|
|
|
+ ${params.businessDataScope}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ order by t.occur_time desc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectGxtRepairOrderById" parameterType="Long" resultMap="GxtRepairOrderResult">
|
|
|
+ <include refid="selectGxtRepairOrderVo"/>
|
|
|
+ where id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertGxtRepairOrder" parameterType="GxtRepairOrder" useGeneratedKeys="true" keyProperty="id">
|
|
|
+ insert into gxt_repair_order
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="workOrderProjectNo != null and workOrderProjectNo != ''">work_order_project_no,</if>
|
|
|
+ <if test="workOrderStatus != null">work_order_status,</if>
|
|
|
+ <if test="gxtCenterId != null">gxt_center_id,</if>
|
|
|
+ <if test="gxtCenter != null">gxt_center,</if>
|
|
|
+ <if test="pcsStationId != null">pcs_station_id,</if>
|
|
|
+ <if test="pcsStationName != null">pcs_station_name,</if>
|
|
|
+ <if test="pcsDeviceId != null">pcs_device_id,</if>
|
|
|
+ <if test="pcsDeviceName != null">pcs_device_name,</if>
|
|
|
+ <if test="brand != null">brand,</if>
|
|
|
+ <if test="model != null">model,</if>
|
|
|
+ <if test="faultCode != null">fault_code,</if>
|
|
|
+ <if test="faultDesc != null">fault_desc,</if>
|
|
|
+ <if test="assignTime != null">assign_time,</if>
|
|
|
+ <if test="assignUserId != null">assign_user_id,</if>
|
|
|
+ <if test="assignUserName != null">assign_user_name,</if>
|
|
|
+ <if test="acceptTime != null">accept_time,</if>
|
|
|
+ <if test="acceptUserId != null">accept_user_id,</if>
|
|
|
+ <if test="acceptUserName != null">accept_user_name,</if>
|
|
|
+ <if test="realStartTime != null">real_start_time,</if>
|
|
|
+ <if test="realEndTime != null">real_end_time,</if>
|
|
|
+ <if test="teamLeaderId != null">team_leader_id,</if>
|
|
|
+ <if test="teamLeaderName != null">team_leader_name,</if>
|
|
|
+ <if test="workGroupMemberId != null">work_group_member_id,</if>
|
|
|
+ <if test="workGroupMemberName != null">work_group_member_name,</if>
|
|
|
+ <if test="createBy != null">create_by,</if>
|
|
|
+ <if test="createTime != null">create_time,</if>
|
|
|
+ <if test="updateBy != null">update_by,</if>
|
|
|
+ <if test="updateTime != null">update_time,</if>
|
|
|
+ <if test="remark != null">remark,</if>
|
|
|
+ <if test="content != null">content,</if>
|
|
|
+ <if test="planHour != null">plan_hour,</if>
|
|
|
+ <if test="priorityType != null">priority_type,</if>
|
|
|
+ <if test="score != null">score,</if>
|
|
|
+ <if test="reviewContent != null">review_content,</if>
|
|
|
+ <if test="maintenanceType != null and maintenanceType != ''">maintenance_type,</if>
|
|
|
+ <if test="occurTime != null">occur_time,</if>
|
|
|
+ <if test="faultBarcode != null">fault_barcode,</if>
|
|
|
+ <if test="suspendReason != null">suspend_reason,</if>
|
|
|
+ <if test="suspendDescription != null">suspend_description,</if>
|
|
|
+ <if test="approvalStatus != null">approval_status,</if>
|
|
|
+ <if test="rejectionReason != null">rejection_reason,</if>
|
|
|
+ <if test="modifyReason != null">modify_reason,</if>
|
|
|
+ <if test="finalizationRemark != null">finalization_remark,</if>
|
|
|
+ <if test="relatedOrderCode != null">related_order_code,</if>
|
|
|
+ <if test="relatedOrderContent != null">related_order_content,</if>
|
|
|
+ <if test="misOrderNo != null">mis_order_no,</if>
|
|
|
+ <if test="restartTime != null">restart_time,</if>
|
|
|
+ <if test="scoringStatus != null">scoring_status,</if>
|
|
|
+ <if test="pcsStationPid != null">pcs_station_pid,</if>
|
|
|
+ <if test="attachmentUrls != null and attachmentUrls != ''">attachment_urls,</if>
|
|
|
+ <if test="reviewScoreNum != null">review_score_num,</if>
|
|
|
+ <if test="finalCoefficient != null">final_coefficient,</if>
|
|
|
+ <if test="orderType != null">order_type,</if>
|
|
|
+ <if test="repairMethod != null and repairMethod != ''">repair_method,</if>
|
|
|
+ <if test="resetMethod != null and resetMethod != ''">reset_method,</if>
|
|
|
+ <if test="invalidReason != null and invalidReason != ''">invalid_reason,</if>
|
|
|
+ <if test="returnType != null and returnType != ''">return_type,</if>
|
|
|
+ <if test="returnReason != null and returnReason != ''">return_reason,</if>
|
|
|
+ <if test="feedbackReason != null and feedbackReason != ''">feedback_reason,</if>
|
|
|
+ <if test="confirmStatus != null">confirm_status,</if>
|
|
|
+ <if test="wwryNum != null">wwry_num,</if>
|
|
|
+ <if test="wlryNum != null">wlry_num,</if>
|
|
|
+ <if test="workArea != null and workArea != ''">work_area,</if>
|
|
|
+ <if test="infoEntry != null and infoEntry != ''">info_entry,</if>
|
|
|
+ <if test="realFailureReason != null and realFailureReason != ''">real_failure_reason,</if>
|
|
|
+ <if test="lostPower != null">lost_power,</if>
|
|
|
+ <if test="workPermitNum != null and workPermitNum != ''">work_permit_num,</if>
|
|
|
+ <if test="appealUserName != null and appealUserName != ''">appeal_user_name,</if>
|
|
|
+ <if test="appealUserId != null">appeal_user_id,</if>
|
|
|
+ <if test="appealTime != null">appeal_time,</if>
|
|
|
+ <if test="appealReason != null and appealReason != ''">appeal_reason,</if>
|
|
|
+ <if test="suspendExplain != null and suspendExplain != ''">suspend_explain,</if>
|
|
|
+ <if test="orderEntryType != null and orderEntryType != ''">order_entry_type,</if>
|
|
|
+ <if test="orderAttachment != null and orderAttachment != ''">order_attachment,</if>
|
|
|
+ <if test="extraWork != null and extraWork != ''">extra_work,</if>
|
|
|
+ <if test="acceptReturnType != null and acceptReturnType != ''">accept_return_type,</if>
|
|
|
+ <if test="acceptReturnReason != null and acceptReturnReason != ''">accept_return_reason,</if>
|
|
|
+ <if test="scoreReturnReason != null and scoreReturnReason != ''">score_return_reason,</if>
|
|
|
+ <if test="finalizeMethod != null and finalizeMethod != ''">finalize_method,</if>
|
|
|
+ <if test="overStopStatus != null">over_stop_status,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="workOrderProjectNo != null and workOrderProjectNo != ''">#{workOrderProjectNo},</if>
|
|
|
+ <if test="workOrderStatus != null">#{workOrderStatus},</if>
|
|
|
+ <if test="gxtCenterId != null">#{gxtCenterId},</if>
|
|
|
+ <if test="gxtCenter != null">#{gxtCenter},</if>
|
|
|
+ <if test="pcsStationId != null">#{pcsStationId},</if>
|
|
|
+ <if test="pcsStationName != null">#{pcsStationName},</if>
|
|
|
+ <if test="pcsDeviceId != null">#{pcsDeviceId},</if>
|
|
|
+ <if test="pcsDeviceName != null">#{pcsDeviceName},</if>
|
|
|
+ <if test="brand != null">#{brand},</if>
|
|
|
+ <if test="model != null">#{model},</if>
|
|
|
+ <if test="faultCode != null">#{faultCode},</if>
|
|
|
+ <if test="faultDesc != null">#{faultDesc},</if>
|
|
|
+ <if test="assignTime != null">#{assignTime},</if>
|
|
|
+ <if test="assignUserId != null">#{assignUserId},</if>
|
|
|
+ <if test="assignUserName != null">#{assignUserName},</if>
|
|
|
+ <if test="acceptTime != null">#{acceptTime},</if>
|
|
|
+ <if test="acceptUserId != null">#{acceptUserId},</if>
|
|
|
+ <if test="acceptUserName != null">#{acceptUserName},</if>
|
|
|
+ <if test="realStartTime != null">#{realStartTime},</if>
|
|
|
+ <if test="realEndTime != null">#{realEndTime},</if>
|
|
|
+ <if test="teamLeaderId != null">#{teamLeaderId},</if>
|
|
|
+ <if test="teamLeaderName != null">#{teamLeaderName},</if>
|
|
|
+ <if test="workGroupMemberId != null">#{workGroupMemberId},</if>
|
|
|
+ <if test="workGroupMemberName != null">#{workGroupMemberName},</if>
|
|
|
+ <if test="createBy != null">#{createBy},</if>
|
|
|
+ <if test="createTime != null">#{createTime},</if>
|
|
|
+ <if test="updateBy != null">#{updateBy},</if>
|
|
|
+ <if test="updateTime != null">#{updateTime},</if>
|
|
|
+ <if test="remark != null">#{remark},</if>
|
|
|
+ <if test="content != null">#{content},</if>
|
|
|
+ <if test="planHour != null">#{planHour},</if>
|
|
|
+ <if test="priorityType != null">#{priorityType},</if>
|
|
|
+ <if test="score != null">#{score},</if>
|
|
|
+ <if test="reviewContent != null">#{reviewContent},</if>
|
|
|
+ <if test="maintenanceType != null and maintenanceType != ''">#{maintenanceType},</if>
|
|
|
+ <if test="occurTime != null">#{occurTime},</if>
|
|
|
+ <if test="faultBarcode != null">#{faultBarcode},</if>
|
|
|
+ <if test="suspendReason != null">#{suspendReason},</if>
|
|
|
+ <if test="suspendDescription != null">#{suspendDescription},</if>
|
|
|
+ <if test="approvalStatus != null">#{approvalStatus},</if>
|
|
|
+ <if test="rejectionReason != null">#{rejectionReason},</if>
|
|
|
+ <if test="modifyReason != null">#{modifyReason},</if>
|
|
|
+ <if test="finalizationRemark != null">#{finalizationRemark},</if>
|
|
|
+ <if test="relatedOrderCode != null">#{relatedOrderCode},</if>
|
|
|
+ <if test="relatedOrderContent != null">#{relatedOrderContent},</if>
|
|
|
+ <if test="misOrderNo != null">#{misOrderNo},</if>
|
|
|
+ <if test="restartTime != null">#{restartTime},</if>
|
|
|
+ <if test="scoringStatus != null">#{scoringStatus},</if>
|
|
|
+ <if test="pcsStationPid != null">#{pcsStationPid},</if>
|
|
|
+ <if test="attachmentUrls != null and attachmentUrls != ''">#{attachmentUrls},</if>
|
|
|
+ <if test="reviewScoreNum != null">#{reviewScoreNum},</if>
|
|
|
+ <if test="finalCoefficient != null">#{finalCoefficient},</if>
|
|
|
+ <if test="orderType != null">#{orderType},</if>
|
|
|
+ <if test="repairMethod != null and repairMethod != ''">#{repairMethod},</if>
|
|
|
+ <if test="resetMethod != null and resetMethod != ''">#{resetMethod},</if>
|
|
|
+ <if test="invalidReason != null and invalidReason != ''">#{invalidReason},</if>
|
|
|
+ <if test="returnType != null and returnType != ''">#{returnType},</if>
|
|
|
+ <if test="returnReason != null and returnReason != ''">#{returnReason},</if>
|
|
|
+ <if test="feedbackReason != null and feedbackReason != ''">#{feedbackReason},</if>
|
|
|
+ <if test="confirmStatus != null">#{confirmStatus},</if>
|
|
|
+ <if test="wwryNum != null">#{wwryNum},</if>
|
|
|
+ <if test="wlryNum != null">#{wlryNum},</if>
|
|
|
+ <if test="workArea != null and workArea != ''">#{workArea},</if>
|
|
|
+ <if test="infoEntry != null and infoEntry != ''">#{infoEntry},</if>
|
|
|
+ <if test="realFailureReason != null and realFailureReason != ''">#{realFailureReason},</if>
|
|
|
+ <if test="lostPower != null">#{lostPower},</if>
|
|
|
+ <if test="workPermitNum != null and workPermitNum != ''">#{workPermitNum},</if>
|
|
|
+ <if test="appealUserName != null and appealUserName != ''">#{appealUserName},</if>
|
|
|
+ <if test="appealUserId != null">#{appealUserId},</if>
|
|
|
+ <if test="appealTime != null">#{appealTime},</if>
|
|
|
+ <if test="appealReason != null and appealReason != ''">#{appealReason},</if>
|
|
|
+ <if test="suspendExplain != null and suspendExplain != ''">#{suspendExplain},</if>
|
|
|
+ <if test="orderEntryType != null and orderEntryType != ''">#{orderEntryType},</if>
|
|
|
+ <if test="orderAttachment != null and orderAttachment != ''">#{orderAttachment},</if>
|
|
|
+ <if test="extraWork != null and extraWork != ''">#{extraWork},</if>
|
|
|
+ <if test="acceptReturnType != null and acceptReturnType != ''">#{acceptReturnType},</if>
|
|
|
+ <if test="acceptReturnReason != null and acceptReturnReason != ''">#{acceptReturnReason},</if>
|
|
|
+ <if test="scoreReturnReason != null and scoreReturnReason != ''">#{scoreReturnReason},</if>
|
|
|
+ <if test="finalizeMethod != null and finalizeMethod != ''">#{finalizeMethod},</if>
|
|
|
+ <if test="overStopStatus != null">#{overStopStatus},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateGxtRepairOrder" parameterType="GxtRepairOrder">
|
|
|
+ update gxt_repair_order
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="workOrderProjectNo != null and workOrderProjectNo != ''">work_order_project_no = #{workOrderProjectNo},</if>
|
|
|
+ <if test="workOrderStatus != null">work_order_status = #{workOrderStatus},</if>
|
|
|
+ <if test="gxtCenterId != null">gxt_center_id = #{gxtCenterId},</if>
|
|
|
+ <if test="gxtCenter != null">gxt_center = #{gxtCenter},</if>
|
|
|
+ <if test="pcsStationId != null">pcs_station_id = #{pcsStationId},</if>
|
|
|
+ <if test="pcsStationName != null">pcs_station_name = #{pcsStationName},</if>
|
|
|
+ <if test="pcsDeviceId != null">pcs_device_id = #{pcsDeviceId},</if>
|
|
|
+ <if test="pcsDeviceName != null">pcs_device_name = #{pcsDeviceName},</if>
|
|
|
+ <if test="brand != null">brand = #{brand},</if>
|
|
|
+ <if test="model != null">model = #{model},</if>
|
|
|
+ <if test="faultCode != null">fault_code = #{faultCode},</if>
|
|
|
+ <if test="faultDesc != null">fault_desc = #{faultDesc},</if>
|
|
|
+ <if test="assignTime != null">assign_time = #{assignTime},</if>
|
|
|
+ <if test="assignUserId != null">assign_user_id = #{assignUserId},</if>
|
|
|
+ <if test="assignUserName != null">assign_user_name = #{assignUserName},</if>
|
|
|
+ <if test="acceptTime != null">accept_time = #{acceptTime},</if>
|
|
|
+ <if test="acceptUserId != null">accept_user_id = #{acceptUserId},</if>
|
|
|
+ <if test="acceptUserName != null">accept_user_name = #{acceptUserName},</if>
|
|
|
+ <if test="realStartTime != null">real_start_time = #{realStartTime},</if>
|
|
|
+ <if test="realEndTime != null">real_end_time = #{realEndTime},</if>
|
|
|
+ <if test="teamLeaderId != null">team_leader_id = #{teamLeaderId},</if>
|
|
|
+ <if test="teamLeaderName != null">team_leader_name = #{teamLeaderName},</if>
|
|
|
+ <if test="workGroupMemberId != null">work_group_member_id = #{workGroupMemberId},</if>
|
|
|
+ <if test="workGroupMemberName != null">work_group_member_name = #{workGroupMemberName},</if>
|
|
|
+ <if test="createBy != null">create_by = #{createBy},</if>
|
|
|
+ <if test="createTime != null">create_time = #{createTime},</if>
|
|
|
+ <if test="updateBy != null">update_by = #{updateBy},</if>
|
|
|
+ <if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
+ <if test="remark != null">remark = #{remark},</if>
|
|
|
+ <if test="content != null">content = #{content},</if>
|
|
|
+ <if test="planHour != null">plan_hour = #{planHour},</if>
|
|
|
+ <if test="priorityType != null">priority_type = #{priorityType},</if>
|
|
|
+ <if test="score != null">score = #{score},</if>
|
|
|
+ <if test="reviewContent != null">review_content = #{reviewContent},</if>
|
|
|
+ <if test="maintenanceType != null and maintenanceType != ''">maintenance_type = #{maintenanceType},</if>
|
|
|
+ <if test="occurTime != null">occur_time = #{occurTime},</if>
|
|
|
+ <if test="faultBarcode != null">fault_barcode = #{faultBarcode},</if>
|
|
|
+ <if test="suspendReason != null">suspend_reason = #{suspendReason},</if>
|
|
|
+ <if test="suspendDescription != null">suspend_description = #{suspendDescription},</if>
|
|
|
+ <if test="approvalStatus != null">approval_status = #{approvalStatus},</if>
|
|
|
+ <if test="rejectionReason != null">rejection_reason = #{rejectionReason},</if>
|
|
|
+ <if test="modifyReason != null">modify_reason = #{modifyReason},</if>
|
|
|
+ <if test="finalizationRemark != null">finalization_remark = #{finalizationRemark},</if>
|
|
|
+ <if test="relatedOrderCode != null">related_order_code = #{relatedOrderCode},</if>
|
|
|
+ <if test="relatedOrderContent != null">related_order_content = #{relatedOrderContent},</if>
|
|
|
+ <if test="misOrderNo != null">mis_order_no = #{misOrderNo},</if>
|
|
|
+ <if test="restartTime != null">restart_time = #{restartTime},</if>
|
|
|
+ <if test="scoringStatus != null">scoring_status = #{scoringStatus},</if>
|
|
|
+ <if test="pcsStationPid != null">pcs_station_pid = #{pcsStationPid},</if>
|
|
|
+ <if test="attachmentUrls != null and attachmentUrls != ''">attachment_urls = #{attachmentUrls},</if>
|
|
|
+ <if test="reviewScoreNum != null">review_score_num = #{reviewScoreNum},</if>
|
|
|
+ <if test="finalCoefficient != null">final_coefficient = #{finalCoefficient},</if>
|
|
|
+ <if test="orderType != null">order_type = #{orderType},</if>
|
|
|
+ <if test="repairMethod != null and repairMethod != ''">repair_method = #{repairMethod},</if>
|
|
|
+ <if test="resetMethod != null and resetMethod != ''">reset_method = #{resetMethod},</if>
|
|
|
+ <if test="invalidReason != null and invalidReason != ''">invalid_reason = #{invalidReason},</if>
|
|
|
+ <if test="returnType != null and returnType != ''">return_type = #{returnType},</if>
|
|
|
+ <if test="workOrderStatus != null and workOrderStatus == 'return'">
|
|
|
+ return_reason = #{returnReason},
|
|
|
+ </if>
|
|
|
+ <if test="feedbackReason != null and feedbackReason != ''">feedback_reason = #{feedbackReason},</if>
|
|
|
+ <if test="confirmStatus != null">confirm_status = #{confirmStatus},</if>
|
|
|
+ <if test="wwryNum != null">wwry_num = #{wwryNum},</if>
|
|
|
+ <if test="wlryNum != null">wlry_num = #{wlryNum},</if>
|
|
|
+ <if test="workArea != null and workArea != ''">work_area = #{workArea},</if>
|
|
|
+ <if test="infoEntry != null and infoEntry != ''">info_entry = #{infoEntry},</if>
|
|
|
+ <if test="realFailureReason != null and realFailureReason != ''">real_failure_reason = #{realFailureReason},</if>
|
|
|
+ <if test="lostPower != null">lost_power = #{lostPower},</if>
|
|
|
+ <if test="workPermitNum != null and workPermitNum != ''">work_permit_num = #{workPermitNum},</if>
|
|
|
+ <if test="appealUserName != null and appealUserName != ''">appeal_user_name = #{appealUserName},</if>
|
|
|
+ <if test="appealUserId != null">appeal_user_id = #{appealUserId},</if>
|
|
|
+ <if test="appealTime != null">appeal_time = #{appealTime},</if>
|
|
|
+ <if test="appealReason != null and appealReason != ''">appeal_reason = #{appealReason},</if>
|
|
|
+ <if test="suspendExplain != null and suspendExplain != ''">suspend_explain = #{suspendExplain},</if>
|
|
|
+ <if test="orderEntryType != null and orderEntryType != ''">order_entry_type = #{orderEntryType},</if>
|
|
|
+ <if test="orderAttachment != null and orderAttachment != ''">order_attachment = #{orderAttachment},</if>
|
|
|
+ <if test="extraWork != null and extraWork != ''">extra_work = #{extraWork},</if>
|
|
|
+ <if test="acceptReturnType != null and acceptReturnType != ''">accept_return_type = #{acceptReturnType},</if>
|
|
|
+ <if test="workOrderStatus != null and workOrderStatus == 'accept_return'">
|
|
|
+ accept_return_reason = #{acceptReturnReason},
|
|
|
+ </if>
|
|
|
+ <if test="scoreReturnReason != null and scoreReturnReason != ''">score_return_reason = #{scoreReturnReason},</if>
|
|
|
+ <if test="finalizeMethod != null and finalizeMethod != ''">finalize_method = #{finalizeMethod},</if>
|
|
|
+ <if test="overStopStatus != null">over_stop_status = #{overStopStatus},</if>
|
|
|
+ </trim>
|
|
|
+ where id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="deleteGxtRepairOrderById" parameterType="Long">
|
|
|
+ delete from gxt_repair_order where id = #{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteGxtRepairOrderByIds" parameterType="String">
|
|
|
+ delete from gxt_repair_order where id in
|
|
|
+ <foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <select id="selectGxtRepairOrderListForAutoFinalize" parameterType="GxtRepairOrder" resultMap="GxtRepairOrderResult">
|
|
|
+ <include refid="selectGxtRepairOrderVo"/>
|
|
|
+ <where>
|
|
|
+ <if test="workOrderStatus != null and workOrderStatus != ''"> and work_order_status in
|
|
|
+ <foreach collection="workOrderStatus.split(',')" item="status" open="(" close=")" separator=",">
|
|
|
+ #{status}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ and accept_time is not null
|
|
|
+ and occur_time is not null
|
|
|
+ and restart_time is not null
|
|
|
+ </where>
|
|
|
+ order by create_time desc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectGxtRepairOrderByWorkOrderProjectNo" parameterType="String" resultMap="GxtRepairOrderResult">
|
|
|
+ <include refid="selectGxtRepairOrderVo"/>
|
|
|
+ where work_order_project_no = #{workOrderProjectNo}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectGxtRepairOrderListNoPermi" parameterType="GxtRepairOrder" resultMap="GxtRepairOrderResult">
|
|
|
+ <include refid="selectGxtRepairOrderVo"/>
|
|
|
+ <where>
|
|
|
+ <if test="workOrderProjectNo != null and workOrderProjectNo != ''"> and work_order_project_no = #{workOrderProjectNo}</if>
|
|
|
+ <if test="workOrderStatus != null and workOrderStatus != ''"> and work_order_status = #{workOrderStatus}</if>
|
|
|
+ <if test="gxtCenterId != null "> and gxt_center_id = #{gxtCenterId}</if>
|
|
|
+ <if test="gxtCenter != null and gxtCenter != ''"> and gxt_center = #{gxtCenter}</if>
|
|
|
+ <if test="pcsStationId != null "> and pcs_station_id = #{pcsStationId}</if>
|
|
|
+ <if test="pcsStationName != null and pcsStationName != ''"> and pcs_station_name = #{pcsStationName} </if>
|
|
|
+ <if test="pcsDeviceId != null "> and pcs_device_id = #{pcsDeviceId}</if>
|
|
|
+ <if test="pcsDeviceName != null and pcsDeviceName != ''"> and pcs_device_name like concat('%', #{pcsDeviceName}, '%')</if>
|
|
|
+ <if test="brand != null and brand != ''"> and brand = #{brand}</if>
|
|
|
+ <if test="model != null and model != ''"> and model = #{model}</if>
|
|
|
+ <if test="faultCode != null and faultCode != ''"> and fault_code like concat('%', #{faultCode}, '%')</if>
|
|
|
+ <if test="faultDesc != null and faultDesc != ''"> and fault_desc = #{faultDesc}</if>
|
|
|
+ <if test="assignTime != null "> and assign_time = #{assignTime}</if>
|
|
|
+ <if test="assignUserId != null "> and assign_user_id = #{assignUserId}</if>
|
|
|
+ <if test="assignUserName != null and assignUserName != ''"> and assign_user_name like concat('%', #{assignUserName}, '%')</if>
|
|
|
+ <if test="acceptTime != null "> and accept_time = #{acceptTime}</if>
|
|
|
+ <if test="acceptUserId != null "> and accept_user_id = #{acceptUserId}</if>
|
|
|
+ <if test="acceptUserName != null and acceptUserName != ''"> and accept_user_name like concat('%', #{acceptUserName}, '%')</if>
|
|
|
+ <if test="realStartTime != null "> and real_start_time = #{realStartTime}</if>
|
|
|
+ <if test="realEndTime != null "> and real_end_time = #{realEndTime}</if>
|
|
|
+ <if test="teamLeaderId != null "> and team_leader_id = #{teamLeaderId}</if>
|
|
|
+ <if test="teamLeaderName != null and teamLeaderName != ''"> and team_leader_name like concat('%', #{teamLeaderName}, '%')</if>
|
|
|
+ <if test="workGroupMemberId != null "> and work_group_member_id = #{workGroupMemberId}</if>
|
|
|
+ <if test="workGroupMemberName != null and workGroupMemberName != ''"> and work_group_member_name like concat('%', #{workGroupMemberName}, '%')</if>
|
|
|
+ <if test="content != null and content != ''"> and content = #{content}</if>
|
|
|
+ <if test="planHour != null "> and plan_hour = #{planHour}</if>
|
|
|
+ <if test="priorityType != null "> and priority_type = #{priorityType}</if>
|
|
|
+ <if test="score != null "> and score = #{score}</if>
|
|
|
+ <if test="reviewContent != null and reviewContent != ''"> and review_content = #{reviewContent}</if>
|
|
|
+ <if test="maintenanceType != null and maintenanceType != ''"> and maintenance_type = #{maintenanceType}</if>
|
|
|
+ <if test="occurTime != null "> and occur_time = #{occurTime}</if>
|
|
|
+ <if test="faultBarcode != null and faultBarcode != ''"> and fault_barcode = #{faultBarcode}</if>
|
|
|
+ <if test="suspendReason != null and suspendReason != ''"> and suspend_reason = #{suspendReason}</if>
|
|
|
+ <if test="suspendDescription != null and suspendDescription != ''"> and suspend_description = #{suspendDescription}</if>
|
|
|
+ <if test="approvalStatus != null and approvalStatus != ''"> and approval_status = #{approvalStatus}</if>
|
|
|
+ <if test="rejectionReason != null and rejectionReason != ''"> and rejection_reason = #{rejectionReason}</if>
|
|
|
+ <if test="modifyReason != null and modifyReason != ''"> and modify_reason = #{modifyReason}</if>
|
|
|
+ <if test="finalizationRemark != null and finalizationRemark != ''"> and finalization_remark = #{finalizationRemark}</if>
|
|
|
+ <if test="relatedOrderCode != null and relatedOrderCode != ''"> and related_order_code = #{relatedOrderCode}</if>
|
|
|
+ <if test="relatedOrderContent != null and relatedOrderContent != ''"> and related_order_content = #{relatedOrderContent}</if>
|
|
|
+ <if test="misOrderNo != null and misOrderNo != ''"> and mis_order_no = #{misOrderNo}</if>
|
|
|
+ <if test="restartTime != null "> and restart_time = #{restartTime}</if>
|
|
|
+ <if test="scoringStatus != null "> and scoring_status = #{scoringStatus}</if>
|
|
|
+ <if test="pcsStationPid != null "> and pcs_station_pid = #{pcsStationPid}</if>
|
|
|
+ <if test="attachmentUrls != null and attachmentUrls != ''"> and attachment_urls = #{attachmentUrls}</if>
|
|
|
+ <if test="reviewScoreNum != null "> and review_score_num = #{reviewScoreNum}</if>
|
|
|
+ <if test="repairMethod != null and repairMethod != ''"> and repair_method = #{repairMethod}</if>
|
|
|
+ <if test="resetMethod != null and resetMethod != ''"> and reset_method = #{resetMethod}</if>
|
|
|
+ <if test="returnType != null and returnType != ''"> and return_type = #{returnType}</if>
|
|
|
+ <if test="returnReason != null and returnReason != ''"> and return_reason = #{returnReason}</if>
|
|
|
+ <if test="wwryNum != null"> and wwry_num = #{wwryNum}</if>
|
|
|
+ <if test="wlryNum != null"> and wlry_num = #{wlryNum}</if>
|
|
|
+ <if test="workArea != null and workArea != ''"> and work_area = #{workArea}</if>
|
|
|
+ <if test="infoEntry != null and infoEntry != ''"> and info_entry = #{infoEntry}</if>
|
|
|
+ <if test="realFailureReason != null and realFailureReason != ''"> and real_failure_reason = #{realFailureReason}</if>
|
|
|
+ <if test="lostPower != null"> and lost_power = #{lostPower}</if>
|
|
|
+ <if test="workPermitNum != null and workPermitNum != ''"> and work_permit_num = #{workPermitNum}</if>
|
|
|
+ </where>
|
|
|
+ order by id desc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectRepairOrderWithPersonById" parameterType="Long" resultMap="GxtRepairOrderWithPersonResult">
|
|
|
+ SELECT
|
|
|
+ t1.id,
|
|
|
+ t1.work_order_project_no,
|
|
|
+ t1.work_order_status,
|
|
|
+ t1.gxt_center_id,
|
|
|
+ t1.gxt_center,
|
|
|
+ t1.pcs_station_id,
|
|
|
+ t1.pcs_station_name,
|
|
|
+ t1.pcs_device_id,
|
|
|
+ t1.pcs_device_name,
|
|
|
+ t1.brand,
|
|
|
+ t1.model,
|
|
|
+ t1.fault_code,
|
|
|
+ t1.fault_desc,
|
|
|
+ t1.assign_time,
|
|
|
+ t1.assign_user_id,
|
|
|
+ t1.assign_user_name,
|
|
|
+ t1.accept_time,
|
|
|
+ t1.accept_user_id,
|
|
|
+ t1.accept_user_name,
|
|
|
+ t1.real_start_time,
|
|
|
+ t1.real_end_time,
|
|
|
+ t1.team_leader_id,
|
|
|
+ t1.team_leader_name,
|
|
|
+ t1.work_group_member_id,
|
|
|
+ t1.work_group_member_name,
|
|
|
+ t1.content,
|
|
|
+ t1.plan_hour,
|
|
|
+ t1.priority_type,
|
|
|
+ t1.score,
|
|
|
+ t1.review_content,
|
|
|
+ t1.maintenance_type,
|
|
|
+ t1.occur_time,
|
|
|
+ t1.fault_barcode,
|
|
|
+ t1.suspend_reason,
|
|
|
+ t1.suspend_description,
|
|
|
+ t1.approval_status,
|
|
|
+ t1.rejection_reason,
|
|
|
+ t1.modify_reason,
|
|
|
+ t1.finalization_remark,
|
|
|
+ t1.related_order_code,
|
|
|
+ t1.related_order_content,
|
|
|
+ t1.mis_order_no,
|
|
|
+ t1.restart_time,
|
|
|
+ t1.scoring_status,
|
|
|
+ t1.pcs_station_pid,
|
|
|
+ t1.attachment_urls,
|
|
|
+ t1.review_score_num,
|
|
|
+ t1.final_coefficient,
|
|
|
+ t1.create_by,
|
|
|
+ t1.create_time,
|
|
|
+ t1.update_by,
|
|
|
+ t1.update_time,
|
|
|
+ t1.remark,
|
|
|
+ t1.return_type,
|
|
|
+ t1.return_reason,
|
|
|
+ t1.order_attachment,
|
|
|
+ t1.extra_work,
|
|
|
+ t1.accept_return_type,
|
|
|
+ t1.accept_return_reason,
|
|
|
+ t1.score_return_reason,
|
|
|
+ t2.id as person_id,
|
|
|
+ t2.user_id as person_user_id,
|
|
|
+ t2.nick_name as person_nick_name,
|
|
|
+ t2.order_id as person_order_id,
|
|
|
+ t2.order_code as person_order_code,
|
|
|
+ t2.status as person_status,
|
|
|
+ t2.self_score as person_self_score,
|
|
|
+ t2.review_score as person_review_score,
|
|
|
+ t2.final_score as person_final_score,
|
|
|
+ t2.is_leader as person_is_leader,
|
|
|
+ t2.extra_score as person_extra_score,
|
|
|
+ t2.total_score as person_total_score
|
|
|
+ FROM gxt_repair_order t1
|
|
|
+ LEFT JOIN gxt_repair_order_person t2 ON t1.id = t2.order_id
|
|
|
+ WHERE t1.id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectGSTJ" resultMap="GxtOrderDataResult">
|
|
|
+ SELECT
|
|
|
+ u.user_id,a.wxgs,b.wbgs
|
|
|
+ FROM sys_user u
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ rop.user_id,
|
|
|
+ SUM(CASE WHEN ro.real_end_time>ro.real_start_time
|
|
|
+ THEN TIMESTAMPDIFF( SECOND, ro.real_start_time, ro.real_end_time ) - IFNULL(gq.total_in_work_suspend_seconds, 0)
|
|
|
+ ELSE 0 END ) / 3600 AS wxgs
|
|
|
+ FROM
|
|
|
+ gxt_repair_order_person rop
|
|
|
+ LEFT JOIN gxt_repair_order ro ON rop.order_id = ro.id
|
|
|
+ LEFT JOIN gxt_repair_order_flow_records_next gq ON gq.order_id = rop.order_id
|
|
|
+ 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
|
|
|
+ WHERE
|
|
|
+ ro.repair_method!='2' AND ro.work_order_status IN ('completed','archived')
|
|
|
+ AND ro.real_end_time >= STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
|
|
|
+ AND ro.real_end_time <![CDATA[<]]> DATE_ADD( STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' ), INTERVAL 1 MONTH )
|
|
|
+ GROUP BY
|
|
|
+ rop.user_id) a ON a.user_id=u.user_id
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ wop.user_id,
|
|
|
+ SUM(CASE WHEN wo.real_end_time>wo.real_start_time
|
|
|
+ THEN TIMESTAMPDIFF( SECOND, wo.real_start_time, wo.real_end_time ) - IFNULL(gq.total_in_work_suspend_seconds, 0)
|
|
|
+ ELSE 0 END ) / 3600 AS wbgs
|
|
|
+ FROM
|
|
|
+ gxt_work_order_person wop
|
|
|
+ LEFT JOIN gxt_work_order wo ON wop.order_id = wo.id
|
|
|
+ LEFT JOIN gxt_work_order_flow_records_next gq ON gq.order_id = wop.order_id
|
|
|
+ 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
|
|
|
+ WHERE
|
|
|
+ wo.work_order_status IN ('completed','archived')
|
|
|
+ AND wo.real_end_time >= STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
|
|
|
+ AND wo.real_end_time <![CDATA[<]]> DATE_ADD( STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' ), INTERVAL 1 MONTH )
|
|
|
+ GROUP BY
|
|
|
+ wop.user_id) b ON u.user_id=b.user_id
|
|
|
+ <where>
|
|
|
+ <if test="userId != null"> and u.user_id=#{userId}</if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectHomePageData" resultMap="GxtOrderDataResult">
|
|
|
+ SELECT
|
|
|
+ u.user_id,
|
|
|
+ IFNULL( a.order_num, 0 ) AS workOrderNum,
|
|
|
+ IFNULL( b.order_num_last, 0 ) AS workOrderNumLast,
|
|
|
+ IFNULL( c.repair_num, 0 ) AS repairOrderNum,
|
|
|
+ IFNULL( cc.repair_num, 0 ) AS repairRestartOrderNum,
|
|
|
+ IFNULL( d.repair_num_last, 0 ) AS repairOrderNumLast,
|
|
|
+ IFNULL( n.score, 0 ) AS score,
|
|
|
+ IFNULL( o.score, 0 ) AS score_last,
|
|
|
+ IFNULL( p.pcsWorkOrderNum, 0 ) AS pcsWorkOrderNum,
|
|
|
+ IFNULL( q.pcsRepairOrderNum, 0 ) AS pcsRepairOrderNum,
|
|
|
+ IFNULL( qq.pcsRepairOrderNum, 0 ) AS pcsRepairRestartOrderNum,
|
|
|
+ IFNULL( r.centerWorkOrderNum, 0 ) AS centerWorkOrderNum,
|
|
|
+ IFNULL( s.centerRepairOrderNum, 0 ) AS centerRepairOrderNum,
|
|
|
+ IFNULL( ss.centerRepairOrderNum, 0 ) AS centerRepairRestartOrderNum,
|
|
|
+ IFNULL( t.companyWorkOrderNum, 0 ) AS companyWorkOrderNum,
|
|
|
+ IFNULL( tt.companyRepairOrderNum, 0 ) AS companyRepairOrderNum,
|
|
|
+ IFNULL( ttt.companyRepairOrderNum, 0 ) AS companyRepairRestartOrderNum
|
|
|
+ FROM
|
|
|
+ sys_user u
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ COUNT(*) AS order_num,
|
|
|
+ wop.user_id
|
|
|
+ FROM
|
|
|
+ gxt_work_order wo
|
|
|
+ LEFT JOIN gxt_work_order_person wop ON wo.id = wop.order_id
|
|
|
+ WHERE wo.work_order_status IN ('completed','archived') AND
|
|
|
+ wo.create_time >= STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
|
|
|
+ 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 )
|
|
|
+ GROUP BY
|
|
|
+ wop.user_id
|
|
|
+ ) a ON a.user_id = u.user_id
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ COUNT(*) AS order_num_last,
|
|
|
+ wop.user_id
|
|
|
+ FROM
|
|
|
+ gxt_work_order wo
|
|
|
+ LEFT JOIN gxt_work_order_person wop ON wo.id = wop.order_id
|
|
|
+ WHERE wo.work_order_status IN ('completed','archived') AND
|
|
|
+ wo.create_time >= DATE_ADD( STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' ), INTERVAL - 1 MONTH )
|
|
|
+ AND wo.create_time <![CDATA[<]]> STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
|
|
|
+ GROUP BY
|
|
|
+ wop.user_id
|
|
|
+ ) b ON u.user_id = b.user_id
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ COUNT(*) AS repair_num,
|
|
|
+ rop.user_id
|
|
|
+ FROM
|
|
|
+ gxt_repair_order ro
|
|
|
+ LEFT JOIN gxt_repair_order_person rop ON ro.id = rop.order_id
|
|
|
+ WHERE ro.work_order_status IN ('completed','archived') AND ro.repair_method != '2'
|
|
|
+ AND ro.occur_time >= STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
|
|
|
+ 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 )
|
|
|
+ GROUP BY
|
|
|
+ rop.user_id
|
|
|
+ ) c ON u.user_id = c.user_id
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ COUNT(*) AS repair_num,
|
|
|
+ rop.operator_id AS user_id
|
|
|
+ FROM
|
|
|
+ gxt_repair_order ro
|
|
|
+ LEFT JOIN gxt_repair_order_flow rop ON ro.id = rop.order_id AND rop.action_type='complete'
|
|
|
+ WHERE ro.work_order_status IN ('completed','archived') AND ro.repair_method = '2'
|
|
|
+ AND ro.occur_time >= STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
|
|
|
+ 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 )
|
|
|
+ GROUP BY
|
|
|
+ rop.operator_id
|
|
|
+ ) cc ON u.user_id = cc.user_id
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ COUNT(*) AS repair_num_last,
|
|
|
+ rop.user_id
|
|
|
+ FROM
|
|
|
+ gxt_repair_order ro
|
|
|
+ LEFT JOIN gxt_repair_order_person rop ON ro.id = rop.order_id
|
|
|
+ WHERE ro.work_order_status IN ('completed','archived') AND
|
|
|
+ ro.occur_time >= DATE_ADD( STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' ), INTERVAL - 1 MONTH )
|
|
|
+ AND ro.occur_time <![CDATA[<]]> STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
|
|
|
+ GROUP BY
|
|
|
+ rop.user_id
|
|
|
+ ) d ON u.user_id = d.user_id
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ SUM( us.final_score ) AS score,
|
|
|
+ su.user_id
|
|
|
+ FROM
|
|
|
+ gxt_user_score us
|
|
|
+ LEFT JOIN sys_user su ON us.user_name = su.user_name
|
|
|
+ WHERE
|
|
|
+ us.month_period = #{monthPeriod}
|
|
|
+ GROUP BY
|
|
|
+ su.user_id
|
|
|
+ ) n ON u.user_id = n.user_id
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ SUM( us.final_score ) AS score,
|
|
|
+ su.user_id
|
|
|
+ FROM
|
|
|
+ gxt_user_score us
|
|
|
+ LEFT JOIN sys_user su ON us.user_name = su.user_name
|
|
|
+ WHERE
|
|
|
+ us.month_period = DATE_FORMAT( DATE_SUB( STR_TO_DATE( CONCAT( #{monthPeriod}, '-01' ), '%Y-%m-%d' ), INTERVAL 1 MONTH ), '%Y-%m' )
|
|
|
+ GROUP BY
|
|
|
+ su.user_id
|
|
|
+ ) o ON u.user_id = o.user_id
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ COUNT(*) AS pcsWorkOrderNum,
|
|
|
+ su.dept_id,su.user_id
|
|
|
+ FROM
|
|
|
+ gxt_work_order wo
|
|
|
+ LEFT JOIN sys_user su ON wo.pcs_station_pid = su.dept_id
|
|
|
+ WHERE wo.work_order_status IN ('completed','archived') AND
|
|
|
+ su.user_id = #{userId}
|
|
|
+ AND wo.create_time >= STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
|
|
|
+ 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 )
|
|
|
+ ) p ON u.user_id = p.user_id
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ COUNT(*) AS pcsRepairOrderNum,
|
|
|
+ su.dept_id,su.user_id
|
|
|
+ FROM
|
|
|
+ gxt_repair_order wo
|
|
|
+ LEFT JOIN sys_user su ON wo.pcs_station_pid = su.dept_id
|
|
|
+ WHERE wo.work_order_status IN ('completed','archived') AND wo.repair_method != '2'
|
|
|
+ AND su.user_id = #{userId}
|
|
|
+ AND wo.occur_time >= STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
|
|
|
+ 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 )
|
|
|
+ ) q ON u.user_id = q.user_id
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ COUNT(*) AS pcsRepairOrderNum,
|
|
|
+ su.dept_id,su.user_id
|
|
|
+ FROM
|
|
|
+ gxt_repair_order wo
|
|
|
+ LEFT JOIN sys_user su ON wo.pcs_station_pid = su.dept_id
|
|
|
+ WHERE wo.work_order_status IN ('completed','archived') AND wo.repair_method = '2'
|
|
|
+ AND su.user_id = #{userId}
|
|
|
+ AND wo.occur_time >= STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
|
|
|
+ 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 )
|
|
|
+ ) qq ON u.user_id = qq.user_id
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ COUNT(*) AS centerWorkOrderNum,
|
|
|
+ su.dept_id,su.user_id
|
|
|
+ FROM
|
|
|
+ gxt_work_order wo
|
|
|
+ LEFT JOIN sys_user su ON wo.gxt_center_id = su.dept_id
|
|
|
+ WHERE wo.work_order_status IN ('completed','archived') AND
|
|
|
+ su.user_id = #{userId}
|
|
|
+ AND wo.create_time >= STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
|
|
|
+ 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 )
|
|
|
+ ) r ON u.user_id = r.user_id
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ COUNT(*) AS centerRepairOrderNum,
|
|
|
+ su.dept_id,su.user_id
|
|
|
+ FROM
|
|
|
+ gxt_repair_order wo
|
|
|
+ LEFT JOIN sys_user su ON wo.gxt_center_id = su.dept_id
|
|
|
+ WHERE wo.work_order_status IN ('completed','archived') AND wo.repair_method != '2'
|
|
|
+ AND su.user_id = #{userId}
|
|
|
+ AND wo.occur_time >= STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
|
|
|
+ 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 )
|
|
|
+ ) s ON u.user_id = s.user_id
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ COUNT(*) AS centerRepairOrderNum,
|
|
|
+ su.dept_id,su.user_id
|
|
|
+ FROM
|
|
|
+ gxt_repair_order wo
|
|
|
+ LEFT JOIN sys_user su ON wo.gxt_center_id = su.dept_id
|
|
|
+ WHERE wo.work_order_status IN ('completed','archived') AND wo.repair_method = '2'
|
|
|
+ AND su.user_id = #{userId}
|
|
|
+ AND wo.occur_time >= STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
|
|
|
+ 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 )
|
|
|
+ ) ss ON u.user_id = ss.user_id
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ COUNT(*) AS companyWorkOrderNum,#{userId} AS user_id
|
|
|
+ FROM
|
|
|
+ gxt_work_order wo
|
|
|
+ WHERE wo.work_order_status IN ('completed','archived') AND
|
|
|
+ wo.create_time >= STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
|
|
|
+ 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 )
|
|
|
+ ) t ON u.user_id = t.user_id
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ COUNT(*) AS companyRepairOrderNum,#{userId} AS user_id
|
|
|
+ FROM
|
|
|
+ gxt_repair_order wo
|
|
|
+ WHERE wo.work_order_status IN ('completed','archived') AND wo.repair_method != '2'
|
|
|
+ AND wo.occur_time >= STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
|
|
|
+ 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 )
|
|
|
+ ) tt ON u.user_id = tt.user_id
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ COUNT(*) AS companyRepairOrderNum,#{userId} AS user_id
|
|
|
+ FROM
|
|
|
+ gxt_repair_order wo
|
|
|
+ WHERE wo.work_order_status IN ('completed','archived') AND wo.repair_method = '2'
|
|
|
+ AND wo.occur_time >= STR_TO_DATE( CONCAT( #{monthPeriod}, '-01 00:00:00' ), '%Y-%m-%d %H:%i:%s' )
|
|
|
+ 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 )
|
|
|
+ ) ttt ON u.user_id = ttt.user_id
|
|
|
+ WHERE
|
|
|
+ u.user_id = #{userId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectHomePageRank" parameterType="GxtUserScore" resultMap="GxtUserScoreResult">
|
|
|
+ SELECT
|
|
|
+ u.user_id,
|
|
|
+ u.user_name,
|
|
|
+ u.nick_name,
|
|
|
+ d.dept_id,
|
|
|
+ d.dept_name,
|
|
|
+ p.dept_id AS center_id,
|
|
|
+ p.dept_name AS center,
|
|
|
+ (SELECT dept_name FROM sys_dept WHERE parent_id=0) AS companyName,
|
|
|
+ IFNULL(us.final_score,0) AS final_score
|
|
|
+ FROM
|
|
|
+ sys_user u
|
|
|
+ LEFT JOIN sys_dept d ON u.dept_id = d.dept_id
|
|
|
+ LEFT JOIN sys_dept p ON d.parent_id = p.dept_id
|
|
|
+ LEFT JOIN (SELECT month_period,user_name,SUM(final_score) AS final_score FROM gxt_user_score GROUP BY month_period,user_name) us ON u.user_name = us.user_name AND us.month_period = DATE_FORMAT(CURDATE(), '%Y-%m')
|
|
|
+ WHERE 1=1
|
|
|
+ <if test="deptId != null">
|
|
|
+ AND d.dept_id=#{deptId}
|
|
|
+ </if>
|
|
|
+ <if test="centerId != null">
|
|
|
+ AND p.dept_id=#{centerId}
|
|
|
+ </if>
|
|
|
+ <if test="permission != null and permission != ''">
|
|
|
+ AND u.user_id IN
|
|
|
+ <foreach item="item" collection="permission.split(',')" open="(" separator="," close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ ORDER BY
|
|
|
+ IFNULL(us.final_score,0) DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectLatestGxtRepairOrderByDeviceId" parameterType="map" resultMap="GxtRepairOrderResult">
|
|
|
+ <include refid="selectGxtRepairOrderVo"/>
|
|
|
+ <where>
|
|
|
+ <if test="pcsDeviceId != null"> and pcs_device_id = #{pcsDeviceId}</if>
|
|
|
+ <if test="limit != null and limit > 0">
|
|
|
+ ORDER BY create_time DESC LIMIT #{limit}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectGxtRepairOrderByDeviceIdWithCondition" parameterType="map" resultMap="GxtRepairOrderResult">
|
|
|
+ <include refid="selectGxtRepairOrderVo"/>
|
|
|
+ <where>
|
|
|
+ <if test="pcsDeviceId != null"> and pcs_device_id = #{pcsDeviceId}</if>
|
|
|
+ <if test="workOrderStatus != null and workOrderStatus != ''">
|
|
|
+ <if test="excludeStatus">
|
|
|
+ and work_order_status != #{workOrderStatus}
|
|
|
+ </if>
|
|
|
+ <if test="!excludeStatus">
|
|
|
+ and work_order_status = #{workOrderStatus}
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="excludeRepairMethod2 != null and excludeRepairMethod2">
|
|
|
+ and repair_method != '2'
|
|
|
+ </if>
|
|
|
+ <if test="orderByField != null and orderByField == 'restartTime'">
|
|
|
+ and work_order_status IN ('completed','archived')
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ <choose>
|
|
|
+ <when test="orderByField != null and orderByField == 'occurTime'">
|
|
|
+ ORDER BY occur_time DESC
|
|
|
+ </when>
|
|
|
+ <when test="orderByField != null and orderByField == 'restartTime'">
|
|
|
+ ORDER BY restart_time DESC
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ ORDER BY create_time DESC
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ <if test="limit != null and limit > 0">
|
|
|
+ LIMIT #{limit}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectGxtRepairOrderListForDeduction" resultMap="GxtRepairOrderResult">
|
|
|
+ SELECT DISTINCT t.*
|
|
|
+ FROM gxt_repair_order t
|
|
|
+ LEFT JOIN gxt_order_score_detail osd ON t.id = osd.order_id AND osd.order_type = 1 AND osd.score_type = 3
|
|
|
+ WHERE t.work_order_status = 'archived'
|
|
|
+ AND t.repair_method != '2'
|
|
|
+ AND osd.order_id IS NULL
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectPendingRepairOrdersForDeduction" resultMap="GxtRepairOrderResult">
|
|
|
+ SELECT t.*
|
|
|
+ FROM gxt_repair_order t
|
|
|
+ WHERE t.work_order_status = 'to_finish'
|
|
|
+ AND t.occur_time IS NOT NULL
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <!-- 查询指定时间之后的有效维修工单(用于奖励计算) -->
|
|
|
+ <select id="selectValidRepairOrdersAfterBreak" parameterType="map" resultMap="GxtRepairOrderResult">
|
|
|
+ SELECT t.*
|
|
|
+ FROM gxt_repair_order t
|
|
|
+ WHERE t.pcs_device_id = #{equipmentId}
|
|
|
+ AND t.work_order_status IN ('completed', 'archived')
|
|
|
+ AND t.restart_time IS NOT NULL
|
|
|
+ AND t.repair_method = '1'
|
|
|
+ AND (
|
|
|
+ #{lastBreakTime} IS NULL
|
|
|
+ OR t.restart_time > #{lastBreakTime}
|
|
|
+ )
|
|
|
+ ORDER BY t.restart_time ASC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 按occurTime倒序查询满足处理方式条件且停机时长大于30分钟的维修工单 -->
|
|
|
+ <select id="selectRepairOrdersByOccurTime" parameterType="map" resultMap="GxtRepairOrderResult">
|
|
|
+ SELECT t.*
|
|
|
+ FROM gxt_repair_order t
|
|
|
+ WHERE t.pcs_device_id = #{equipmentId}
|
|
|
+ AND t.work_order_status != 'invalid'
|
|
|
+ AND t.occur_time IS NOT NULL
|
|
|
+ AND (
|
|
|
+ -- 条件1: repair_method为空
|
|
|
+ (t.repair_method IS NULL AND t.work_order_status NOT IN ('completed', 'archived'))
|
|
|
+ OR
|
|
|
+ -- 条件2: repair_method不为空且满足特定条件
|
|
|
+ -- 处理方式为正常维修
|
|
|
+ t.repair_method = '1'
|
|
|
+ OR
|
|
|
+ -- 处理方式为复位启机且复位方式为人工复位
|
|
|
+ (t.repair_method = '2' AND t.reset_method = '1')
|
|
|
+ )
|
|
|
+ ORDER BY t.occur_time DESC,t.id DESC limit 1
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <!-- 按restartTime倒序查询满足处理方式条件的维修工单 -->
|
|
|
+ <select id="selectRepairOrdersByRestartTime" parameterType="map" resultMap="GxtRepairOrderResult">
|
|
|
+ SELECT t.*
|
|
|
+ FROM gxt_repair_order t
|
|
|
+ WHERE t.pcs_device_id = #{equipmentId}
|
|
|
+ AND t.work_order_status != 'invalid'
|
|
|
+ AND t.occur_time IS NOT NULL
|
|
|
+ AND t.restart_time IS NOT NULL
|
|
|
+ AND (
|
|
|
+ -- 处理方式为正常维修
|
|
|
+ t.repair_method = '1'
|
|
|
+ OR
|
|
|
+ -- 处理方式为复位启机且复位方式为人工复位
|
|
|
+ (t.repair_method = '2' AND t.reset_method = '1')
|
|
|
+ )
|
|
|
+ ORDER BY t.restart_time DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+</mapper>
|