From 87a49ccc47abbb3505403d174001ceb3a2d2341d Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期五, 08 十一月 2024 09:02:46 +0800
Subject: [PATCH] Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV

---
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/OpeWorkOrderMapper.xml |  159 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 154 insertions(+), 5 deletions(-)

diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/OpeWorkOrderMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/OpeWorkOrderMapper.xml
index ea42de9..9e2a155 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/OpeWorkOrderMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/OpeWorkOrderMapper.xml
@@ -13,6 +13,8 @@
     <result column="dead_line" jdbcType="TIMESTAMP" property="deadLine" />
     <result column="complete_time" jdbcType="TIMESTAMP" property="completeTime" />
     <result column="dispatch_time" jdbcType="TIMESTAMP" property="dispatchTime" />
+    <result column="client_report_id" jdbcType="BIGINT" property="clientReportId" />
+    <result column="inspector_report_id" jdbcType="BIGINT" property="inspectorReportId" />
     <result column="state" jdbcType="TINYINT" property="state" />
     <result column="reject_times" jdbcType="INTEGER" property="rejectTimes" />
     <result column="deleted" jdbcType="BIGINT" property="deleted" />
@@ -20,7 +22,8 @@
   <sql id="Base_Column_List">
     <!--@mbg.generated-->
     id, dispatcher_id, inspector_id, task_type_id, task_content, complete_criteria, dead_line, 
-    complete_time, dispatch_time, `state`, reject_times, deleted
+    complete_time, dispatch_time, client_report_id, inspector_report_id, `state`, reject_times, 
+    deleted
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
     <!--@mbg.generated-->
@@ -39,13 +42,13 @@
     insert into ope_work_order (id, dispatcher_id, inspector_id, 
       task_type_id, task_content, complete_criteria, 
       dead_line, complete_time, dispatch_time, 
-      `state`, reject_times, deleted
-      )
+      client_report_id, inspector_report_id, `state`, 
+      reject_times, deleted)
     values (#{id,jdbcType=BIGINT}, #{dispatcherId,jdbcType=BIGINT}, #{inspectorId,jdbcType=BIGINT}, 
       #{taskTypeId,jdbcType=BIGINT}, #{taskContent,jdbcType=VARCHAR}, #{completeCriteria,jdbcType=VARCHAR}, 
       #{deadLine,jdbcType=TIMESTAMP}, #{completeTime,jdbcType=TIMESTAMP}, #{dispatchTime,jdbcType=TIMESTAMP}, 
-      #{state,jdbcType=TINYINT}, #{rejectTimes,jdbcType=INTEGER}, #{deleted,jdbcType=BIGINT}
-      )
+      #{clientReportId,jdbcType=BIGINT}, #{inspectorReportId,jdbcType=BIGINT}, #{state,jdbcType=TINYINT}, 
+      #{rejectTimes,jdbcType=INTEGER}, #{deleted,jdbcType=BIGINT})
   </insert>
   <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoOp.OpeWorkOrder">
     <!--@mbg.generated-->
@@ -77,6 +80,12 @@
       </if>
       <if test="dispatchTime != null">
         dispatch_time,
+      </if>
+      <if test="clientReportId != null">
+        client_report_id,
+      </if>
+      <if test="inspectorReportId != null">
+        inspector_report_id,
       </if>
       <if test="state != null">
         `state`,
@@ -115,6 +124,12 @@
       </if>
       <if test="dispatchTime != null">
         #{dispatchTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="clientReportId != null">
+        #{clientReportId,jdbcType=BIGINT},
+      </if>
+      <if test="inspectorReportId != null">
+        #{inspectorReportId,jdbcType=BIGINT},
       </if>
       <if test="state != null">
         #{state,jdbcType=TINYINT},
@@ -155,6 +170,12 @@
       <if test="dispatchTime != null">
         dispatch_time = #{dispatchTime,jdbcType=TIMESTAMP},
       </if>
+      <if test="clientReportId != null">
+        client_report_id = #{clientReportId,jdbcType=BIGINT},
+      </if>
+      <if test="inspectorReportId != null">
+        inspector_report_id = #{inspectorReportId,jdbcType=BIGINT},
+      </if>
       <if test="state != null">
         `state` = #{state,jdbcType=TINYINT},
       </if>
@@ -178,9 +199,137 @@
       dead_line = #{deadLine,jdbcType=TIMESTAMP},
       complete_time = #{completeTime,jdbcType=TIMESTAMP},
       dispatch_time = #{dispatchTime,jdbcType=TIMESTAMP},
+      client_report_id = #{clientReportId,jdbcType=BIGINT},
+      inspector_report_id = #{inspectorReportId,jdbcType=BIGINT},
       `state` = #{state,jdbcType=TINYINT},
       reject_times = #{rejectTimes,jdbcType=INTEGER},
       deleted = #{deleted,jdbcType=BIGINT}
     where id = #{id,jdbcType=BIGINT}
   </update>
+
+  <!--鏍规嵁涓婚敭鑾峰彇宸ュ崟瑙嗗浘瀵硅薄-->
+  <select id="getWorkOrderById" resultType="com.dy.pipIrrGlobal.voOp.VoWorkOrder">
+    SELECT
+        ord.id AS workOrderId,
+        ord.dispatcher_id AS dispatcherId,
+        us1.name AS dispatcher,
+        ord.inspector_id AS inspectorId,
+        us2.name AS inspector,
+        typ.task_type AS taskType,
+        ord.task_content AS taskContent,
+        ord.complete_criteria AS completeCriteria,
+        ord.dead_line AS deadLine,
+        ord.client_report_id AS clientReportId,
+        ord.inspector_report_id AS inspectorReportId,
+        ord.complete_time AS completeTime,
+        ord.dispatch_time AS dispatchTime,
+        ord.reject_times AS rejectTimes,
+        CASE
+            WHEN ord.state = 1 THEN '鏈畬鎴�'
+            WHEN ord.state = 2 THEN '宸插畬鎴�'
+        END AS state,
+        CASE
+            WHEN res.state = 1 THEN	'宸蹭笂鎶�'
+            WHEN res.state = 2 THEN	'宸查�氳繃'
+            WHEN res.state = 3 THEN	'宸查┏鍥�'
+            ELSE '鏈笂鎶�'
+        END AS processingState
+    FROM ope_work_order ord
+        INNER JOIN ba_user us1 ON us1.id = ord.dispatcher_id
+        INNER JOIN ba_user us2 ON us2.id = ord.inspector_id
+        INNER JOIN ope_task_type typ ON typ.id = ord.task_type_id
+        LEFT JOIN ope_processing_result res ON res.work_order_id = ord.id
+    WHERE ord.deleted = 0 AND ord.id = #{workOrderId}
+  </select>
+
+  <!--鑾峰彇鎸囧畾娲惧崟浜虹殑鎸囧畾鏈垹闄ゅ伐鍗曪紝鍒犻櫎宸ュ崟鍓嶅垽鏂娇鐢ㄤ娇鐢�-->
+  <select id="getWorkOrder" resultType="com.dy.pipIrrGlobal.pojoOp.OpeWorkOrder">
+    SELECT * FROM ope_work_order
+    WHERE deleted = 0 AND id = #{workOrderId} AND dispatcher_id = #{dispatcherId} LIMIT 1
+  </select>
+
+  <!--閫昏緫鍒犻櫎涓�涓湭鍒犻櫎鐨勫伐鍗�-->
+  <update id="deleteWorkOrder">
+    UPDATE ope_work_order SET deleted = UNIX_TIMESTAMP() WHERE deleted = 0 AND id = #{workOrderId}
+  </update>
+
+<!--  鏍规嵁鎸囧畾鏉′欢鑾峰彇宸ュ崟鏁伴噺-->
+  <select id="getWorkOrdersCount" resultType="java.lang.Long">
+    select
+      COUNT(*) AS recordCount
+    FROM ope_work_order ord
+    INNER JOIN ba_user us1 ON us1.id = ord.dispatcher_id
+    INNER JOIN ba_user us2 ON us2.id = ord.inspector_id
+    INNER JOIN ope_task_type typ ON typ.id = ord.task_type_id
+    LEFT JOIN ope_processing_result res ON res.work_order_id = ord.id
+    <where>
+      AND ord.deleted = 0
+
+      <if test = "dispatcher != null and dispatcher !=''">
+        AND us1.name like CONCAT('%',#{dispatcher},'%')
+      </if>
+
+      <if test = "inspector != null and inspector !=''">
+        AND us2.name like CONCAT('%',#{inspector},'%')
+      </if>
+
+      <if test = "timeStart != null and timeStop != null">
+        AND ord.dispatch_time BETWEEN #{timeStart} AND #{timeStop}
+      </if>
+    </where>
+  </select>
+
+  <select id="getWorkOrders" resultType="com.dy.pipIrrGlobal.voOp.VoWorkOrder">
+    SELECT
+        ord.id AS workOrderId,
+        ord.dispatcher_id AS dispatcherId,
+        us1.name AS dispatcher,
+        ord.inspector_id AS inspectorId,
+        us2.name AS inspector,
+        typ.task_type AS taskType,
+        ord.task_content AS taskContent,
+        ord.complete_criteria AS completeCriteria,
+        ord.dead_line AS deadLine,
+        ord.client_report_id AS clientReportId,
+        ord.inspector_report_id AS inspectorReportId,
+        ord.complete_time AS completeTime,
+        ord.dispatch_time AS dispatchTime,
+        ord.reject_times AS rejectTimes,
+        CASE
+            WHEN ord.state = 1 THEN '鏈畬鎴�'
+            WHEN ord.state = 2 THEN '宸插畬鎴�'
+        END AS state,
+        CASE
+            WHEN res.state = 1 THEN	'宸蹭笂鎶�'
+            WHEN res.state = 2 THEN	'宸查�氳繃'
+            WHEN res.state = 3 THEN	'宸查┏鍥�'
+            ELSE '鏈笂鎶�'
+        END AS processingState
+    FROM ope_work_order ord
+        INNER JOIN ba_user us1 ON us1.id = ord.dispatcher_id
+        INNER JOIN ba_user us2 ON us2.id = ord.inspector_id
+        INNER JOIN ope_task_type typ ON typ.id = ord.task_type_id
+        LEFT JOIN ope_processing_result res ON res.work_order_id = ord.id
+    <where>
+      AND ord.deleted = 0
+
+      <if test = "dispatcher != null and dispatcher !=''">
+        AND us1.name like CONCAT('%',#{dispatcher},'%')
+      </if>
+
+      <if test = "inspector != null and inspector !=''">
+        AND us2.name like CONCAT('%',#{inspector},'%')
+      </if>
+
+      <if test = "timeStart != null and timeStop != null">
+        AND ord.dispatch_time BETWEEN #{timeStart} AND #{timeStop}
+      </if>
+    </where>
+    ORDER BY ord.dispatch_time DESC
+    <trim prefix="limit " >
+      <if test="start != null and count != null">
+        #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
+      </if>
+    </trim>
+  </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0