From 4a2deb11b819dd78a8c75e244ef67ec2e48cf5f5 Mon Sep 17 00:00:00 2001
From: zhubaomin <zhubaomin>
Date: 星期一, 14 四月 2025 21:03:28 +0800
Subject: [PATCH] 重构轮灌组修改接口

---
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/OpeInspectMapper.xml |   81 ++++++++++++++++++++++++++++++++++------
 1 files changed, 68 insertions(+), 13 deletions(-)

diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/OpeInspectMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/OpeInspectMapper.xml
index c7f927a..c11b0d3 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/OpeInspectMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/OpeInspectMapper.xml
@@ -8,10 +8,11 @@
     <result column="inspector_id" jdbcType="BIGINT" property="inspectorId" />
     <result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
     <result column="stop_time" jdbcType="TIMESTAMP" property="stopTime" />
+    <result column="inspect_distance" jdbcType="FLOAT" property="inspectDistance" />
   </resultMap>
   <sql id="Base_Column_List">
     <!--@mbg.generated-->
-    id, inspector_id, start_time, stop_time
+    id, inspector_id, start_time, stop_time, inspect_distance
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
     <!--@mbg.generated-->
@@ -28,9 +29,9 @@
   <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoOp.OpeInspect">
     <!--@mbg.generated-->
     insert into ope_inspect (id, inspector_id, start_time, 
-      stop_time)
+      stop_time, inspect_distance)
     values (#{id,jdbcType=BIGINT}, #{inspectorId,jdbcType=BIGINT}, #{startTime,jdbcType=TIMESTAMP}, 
-      #{stopTime,jdbcType=TIMESTAMP})
+      #{stopTime,jdbcType=TIMESTAMP}, #{inspectDistance,jdbcType=FLOAT})
   </insert>
   <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoOp.OpeInspect">
     <!--@mbg.generated-->
@@ -48,6 +49,9 @@
       <if test="stopTime != null">
         stop_time,
       </if>
+      <if test="inspectDistance != null">
+        inspect_distance,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="id != null">
@@ -61,6 +65,9 @@
       </if>
       <if test="stopTime != null">
         #{stopTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="inspectDistance != null">
+        #{inspectDistance,jdbcType=FLOAT},
       </if>
     </trim>
   </insert>
@@ -77,6 +84,9 @@
       <if test="stopTime != null">
         stop_time = #{stopTime,jdbcType=TIMESTAMP},
       </if>
+      <if test="inspectDistance != null">
+        inspect_distance = #{inspectDistance,jdbcType=FLOAT},
+      </if>
     </set>
     where id = #{id,jdbcType=BIGINT}
   </update>
@@ -85,10 +95,12 @@
     update ope_inspect
     set inspector_id = #{inspectorId,jdbcType=BIGINT},
       start_time = #{startTime,jdbcType=TIMESTAMP},
-      stop_time = #{stopTime,jdbcType=TIMESTAMP}
+      stop_time = #{stopTime,jdbcType=TIMESTAMP},
+      inspect_distance = #{inspectDistance,jdbcType=FLOAT}
     where id = #{id,jdbcType=BIGINT}
   </update>
-<!-- 鏌ヨ鎬绘暟 -->
+
+  <!-- 鏌ヨ鎬绘暟 -->
   <select id="getInspectsCount" resultType="java.lang.Long">
     SELECT
     count(*)
@@ -109,17 +121,19 @@
         AND oi.start_time BETWEEN #{timeStart} AND #{timeStop}
       </if>
     </where>
-    </select>
-<!-- 鏌ヨ鍒楄〃 -->
+  </select>
+
+  <!-- 鏌ヨ鍒楄〃 -->
   <select id="getInspects" resultType="com.dy.pipIrrGlobal.voOp.VoInspect">
     SELECT
-      oi.inspector_id AS inspectorId,
-      ba_user.`name` AS inspectorName,
-      oi.id AS inspectId,
-      oi.start_time AS startTime,
-      oi.stop_time AS stopTime
+    oi.inspector_id AS inspectorId,
+    ba_user.`name` AS inspectorName,
+    oi.id AS inspectId,
+    oi.start_time AS startTime,
+    oi.stop_time AS stopTime,
+    oi.inspect_distance AS inspectDistance
     FROM	`ope_inspect` oi
-              INNER JOIN `ba_user` ON oi.inspector_id = ba_user.id
+    INNER JOIN `ba_user` ON oi.inspector_id = ba_user.id
     <where>
       ba_user.deleted = 0
       <if test="inspectorId != null">
@@ -135,5 +149,46 @@
         AND oi.start_time BETWEEN #{timeStart} AND #{timeStop}
       </if>
     </where>
+    <trim prefix="limit " >
+      <if test="start != null and count != null">
+        #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
+      </if>
+    </trim>
+  </select>
+
+  <!--鏇存柊鎸囧畾宸℃璁板綍鐨勫贰妫�璺濈-->
+  <update id="updateInspectDistance">
+    UPDATE ope_inspect
+    SET inspect_distance = #{distance}
+    WHERE id = #{inspectId}
+  </update>
+
+  <!--鏍规嵁宸℃鍛業D鑾峰彇宸℃璁板綍鏁伴噺-->
+  <select id="getInstectsCountByInspectorId" resultType="java.lang.Long">
+    SELECT
+        count(*)
+    FROM ope_inspect ins
+    LEFT JOIN ba_user user ON user.id = ins.inspector_id
+    WHERE ins.inspector_id = #{inspectorId}
+  </select>
+
+  <!--鏍规嵁宸℃鍛業D鑾峰彇宸℃鍒楄〃-->
+  <select id="getInstectsByInspectorId" resultType="com.dy.pipIrrGlobal.voOp.VoInspect">
+    SELECT
+        user.id AS inspectorId,
+        user.name AS inspectorName,
+        ins.id AS inspectId,
+        ins.start_time AS startTime,
+        ins.stop_time AS stopTime,
+        ins.inspect_distance AS inspectDistance
+    FROM ope_inspect ins
+        LEFT JOIN ba_user user ON user.id = ins.inspector_id
+    WHERE ins.inspector_id = #{inspectorId}
+    ORDER BY ins.start_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