From 2d8dafdddd85653371e463ee43f960f2366d9313 Mon Sep 17 00:00:00 2001
From: 李旭东 <woaiguo66@sina.com>
Date: 星期五, 27 十月 2023 15:51:16 +0800
Subject: [PATCH] Merge branch 'master' of http://111.30.93.211:10101/r/supipe

---
 hd/pipe/engineeringManage/src/main/resources/mapping/SysSegmentMapper.xml |   92 +++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 82 insertions(+), 10 deletions(-)

diff --git a/hd/pipe/engineeringManage/src/main/resources/mapping/SysSegmentMapper.xml b/hd/pipe/engineeringManage/src/main/resources/mapping/SysSegmentMapper.xml
index 70eb53c..0a2313a 100644
--- a/hd/pipe/engineeringManage/src/main/resources/mapping/SysSegmentMapper.xml
+++ b/hd/pipe/engineeringManage/src/main/resources/mapping/SysSegmentMapper.xml
@@ -14,12 +14,21 @@
     <result column="shield_enp" jdbcType="VARCHAR" property="shieldEnp" />
     <result column="station" jdbcType="VARCHAR" property="station" />
     <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+      <result column="mileage" jdbcType="VARCHAR" property="mileage" />
+      <result column="unit_project_name" jdbcType="VARCHAR" property="unitProjectName" />
+      <result column="start_time" jdbcType="DATE" property="startTime" />
+      <result column="end_time" jdbcType="DATE" property="endTime" />
+      <result column="duration" jdbcType="VARCHAR" property="duration" />
   </resultMap>
 
   <select id="segmentNameByOne" parameterType="java.lang.String" resultType="java.lang.String" >
     select segment_id from sys_segment where segment_name=#{segmentName}
     and is_use=1
   </select>
+    <select id="segmentNameByProjectName" parameterType="java.lang.String" resultType="java.lang.String" >
+        select segment_id from sys_segment where unit_project_name=#{unitProjectName}
+        and is_use=1
+    </select>
   <insert id="segmentInsert" useGeneratedKeys="true" keyProperty="segment_id">
     insert into sys_segment
     <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -44,6 +53,21 @@
       <if test="createTime != null">
         create_time,
       </if>
+        <if test="mileage != null">
+            mileage,
+        </if>
+        <if test="unitProjectName != null">
+            unit_project_name,
+        </if>
+        <if test="startTime != null">
+            start_time,
+        </if>
+        <if test="endTime != null">
+            end_time,
+        </if>
+        <if test="duration != null">
+            duration,
+        </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="segmentId != null">
@@ -67,6 +91,21 @@
       <if test="createTime != null">
         #{createTime,jdbcType=TIMESTAMP},
       </if>
+        <if test="mileage != null">
+            #{mileage,jdbcType=VARCHAR},
+        </if>
+        <if test="unitProjectName != null">
+            #{unitProjectName,jdbcType=VARCHAR},
+        </if>
+        <if test="startTime != null">
+            #{startTime,jdbcType=DATE},
+        </if>
+        <if test="endTime != null">
+            #{endTime,jdbcType=DATE},
+        </if>
+        <if test="duration != null">
+            #{duration,jdbcType=VARCHAR},
+        </if>
     </trim>
   </insert>
   <insert id="segmentNeedInsert" >
@@ -101,17 +140,29 @@
     </trim>
   </insert>
   <select id="segmentList" resultType="com.thhy.engineering.modules.biz.engineering.entity.SysSegment">
-        select ss.segment_id as segmentId,
-         ss.segment_name as segmentName,
-         ss.pro_id as proId,
-         ss.segment_admin as segmentAdmin,
-         ss.shield_enp as shieldEnp,
-         ss.station as station,
-         ss.create_time as createTime,
-        sp.pro_name as proName,spu.real_name as realName from sys_segment ss
-        left join sys_project sp on ss.pro_id=sp.pro_id
-        left join sys_plat_user spu on ss.segment_admin=spu.user_id
+      select ss.segment_id as segmentId,
+      ss.segment_name as segmentName,
+      ss.pro_id as proId,
+      ss.segment_admin as segmentAdmin,
+      ss.shield_enp as shieldEnp,
+      ss.station as station,
+      ss.create_time as createTime,
+      ss.mileage as mileage,
+      ss.unit_project_name as unitProjectName,
+      ss.start_time as startTime,
+      ss.end_time as endTime,
+      ss.duration as duration,
+      COUNT(tpi.segment_id) completedQuantity,
+      sp.pro_name as proName,spu.real_name as realName
+      from sys_segment ss
+      left join sys_project sp on ss.pro_id=sp.pro_id
+      left join sys_plat_user spu on ss.segment_admin=spu.user_id
+      left join (SELECT segment_id FROM t_pipe_info WHERE check_result in (1,2,3))  tpi on ss.segment_id = tpi.segment_id
+
         where ss.is_use=1
+        <if test="unitProjectName!=null and unitProjectName!='' ">
+          and ss.unit_project_name like concat('%',#{unitProjectName},'%')
+        </if>
         <if test="segmentName!=null and segmentName!='' ">
           and ss.segment_name like concat('%',#{segmentName},'%')
         </if>
@@ -121,6 +172,7 @@
         <if test="companyId!=null and companyId!='' ">
             and sp.company_id=#{companyId}
         </if>
+        GROUP BY ss.segment_id
         order by  ss.create_time desc
   </select>
   <select id="segmentInfo" parameterType="java.lang.String" resultType="com.thhy.engineering.modules.biz.engineering.entity.SysSegment">
@@ -132,6 +184,11 @@
          ss.shield_enp as shieldEnp,
          ss.station as station,
          ss.create_time as createTime,
+        ss.mileage as mileage,
+        ss.unit_project_name as unitProjectName,
+        ss.start_time as startTime,
+        ss.end_time as endTime,
+        ss.duration as duration,
         sp.pro_name,spu.real_name from sys_segment ss
         left join sys_project sp on ss.pro_id=sp.pro_id
         left join sys_plat_user spu on ss.segment_admin=spu.user_id
@@ -178,6 +235,21 @@
       <if test="createTime != null">
         create_time = #{createTime,jdbcType=TIMESTAMP},
       </if>
+        <if test="mileage != null">
+            mileage = #{mileage,jdbcType=VARCHAR},
+        </if>
+        <if test="unitProjectName != null">
+            unit_project_name = #{unitProjectName,jdbcType=VARCHAR},
+        </if>
+        <if test="startTime != null">
+            start_time = #{startTime,jdbcType=DATE},
+        </if>
+        <if test="endTime != null">
+            end_time = #{endTime,jdbcType=DATE},
+        </if>
+        <if test="duration != null">
+            duration = #{duration,jdbcType=VARCHAR},
+        </if>
     </set>
     where segment_id = #{segmentId,jdbcType=VARCHAR}
   </update>

--
Gitblit v1.9.3