From b1d76ff75fef33e8b2307f3a8c2f4ec5e638f0cd Mon Sep 17 00:00:00 2001
From: shenyijian <1178253012@qq.com>
Date: Sat, 02 Nov 2024 14:45:08 +0800
Subject: [PATCH] 湖北水库:项目单位过滤

---
 skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sg/mapper/SgProjectInfoMapper.xml |   78 ++++++++++++++++++++++++++++++++------
 1 files changed, 65 insertions(+), 13 deletions(-)

diff --git a/skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sg/mapper/SgProjectInfoMapper.xml b/skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sg/mapper/SgProjectInfoMapper.xml
index fa38d0e..6932dd1 100644
--- a/skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sg/mapper/SgProjectInfoMapper.xml
+++ b/skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sg/mapper/SgProjectInfoMapper.xml
@@ -9,12 +9,31 @@
         dria."county_nm",
         dria."town_nm",
         dria."eng_scal",
-        dria."bas_guid"
+        dria."bas_guid",
+        dria."oth_reg_cd"
         FROM
         YWXT.SG_PROJECT_INFO info
         LEFT JOIN SJZT_DW."dim_res_info_a" dria ON dria."res_cd" = info.sk_id
         WHERE
         1 =1
+        <if test="dto.selfUnit != null and dto.selfUnit.size>0 ">
+            and
+            <foreach collection="dto.selfUnit" item="item" index="index" open="(" separator="or" close=")">
+                info.CONSTRUCTION_UNIT Like  CONCAT(CONCAT('%', #{item}), '%')
+            </foreach>
+        </if>
+        <if test="dto.userUnit != null and dto.userUnit.size>0">
+            and
+            <foreach collection="dto.userUnit" item="item" index="index" open="(" separator="or" close=")">
+                info.CONTROL_UNIT Like  CONCAT(CONCAT('%', #{item}), '%')
+            </foreach>
+        </if>
+        <if test="dto.countryUnit != null and dto.countryUnit.size>0">
+            and dria."county_cd" in
+            <foreach collection="dto.countryUnit" item="item" index="index" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
         <if test="dto.projectName != null and dto.projectName != ''">
             and info.project_name like concat( concat ('%',#{dto.projectName}),'%')
         </if>
@@ -66,8 +85,11 @@
                 #{id}
             </foreach>)
         </if>
-        <if test="dto.deptId != null and dto.deptId !=''">
+        <!--<if test="dto.deptId != null and dto.deptId !=''">
             and (info.control_unit = #{dto.deptId} or info.construction_unit = #{dto.deptId})
+        </if>-->
+        <if test="dto.adCode != null and dto.adCode !=''">
+            and dria."county_cd" = #{dto.adCode}
         </if>
        <if test="dto.projectSort == null">
             ORDER BY TO_NUMBER(info.project_progress) desc NULLS LAST,info.status desc
@@ -80,16 +102,16 @@
            ORDER BY info.sk_id asc
        </if>-->
         <if test="dto.projectSort != null and dto.projectSort ==3">
-            ORDER BY info.surface_progress desc NULLS LAST
+            ORDER BY TO_NUMBER(SUBSTR(info.surface_progress, 1, LENGTH(info.surface_progress) - 1))  desc NULLS LAST
         </if>
         <if test="dto.projectSort != null and dto.projectSort ==4">
-            ORDER BY info.video_progress desc NULLS LAST
+            ORDER BY TO_NUMBER(SUBSTR(info.video_progress, 1, LENGTH(info.video_progress) - 1))  desc NULLS LAST
         </if>
         <if test="dto.projectSort != null and dto.projectSort ==5">
-            ORDER BY info.trans_progress desc NULLS LAST
+            ORDER BY TO_NUMBER(SUBSTR(info.trans_progress, 1, LENGTH(info.trans_progress) - 1))  desc NULLS LAST
         </if>
         <if test="dto.projectSort != null and dto.projectSort ==6">
-            ORDER BY info.seepage_progress desc NULLS LAST
+            ORDER BY TO_NUMBER(SUBSTR(info.seepage_progress , 1, LENGTH(info.seepage_progress ) - 1))  desc NULLS LAST
         </if>
     </select>
 
@@ -127,7 +149,10 @@
         pro.STATUS AS projectStatus,
         re.id AS reportId,
         pro.lon_lat,
-        re.resubmit
+        re.resubmit,
+        COALESCE(d.price, 99) as price,
+        COALESCE(Pdict.sort, 0)  as sort,
+        COALESCE(dict.sort, 0)  as dSort
         FROM
         ywxt.sg_project_info pro
         LEFT JOIN SJZT_DW."dim_res_info_a" dria ON dria."res_cd" = pro.sk_id
@@ -161,7 +186,7 @@
             and pro.build_stage like CONCAT(CONCAT('%',#{dto.buildStage}),'%')
         </if>
         <include refid="queryBySgCodeS"></include>
-       ORDER BY pro.status desc ,pro.project_progress desc
+       ORDER BY pro.status desc ,pro.project_progress desc,step.gx_step_num asc
 
     </select>
     <select id="progressList" resultType="cn.gistack.sm.sg.VO.SgProjectInfoVO">
@@ -481,6 +506,24 @@
     </select>
 
     <sql id="queryBySgCodeS">
+        <if test="dto.selfUnit != null and dto.selfUnit.size>0">
+            and
+            <foreach collection="dto.selfUnit" item="item" index="index" open="(" separator="or" close=")">
+                pro.CONSTRUCTION_UNIT Like  CONCAT(CONCAT('%', #{item}), '%')
+            </foreach>
+        </if>
+        <if test="dto.userUnit != null and dto.userUnit.size>0">
+            and
+            <foreach collection="dto.userUnit" item="item" index="index" open="(" separator="or" close=")">
+                pro.CONTROL_UNIT Like  CONCAT(CONCAT('%', #{item}), '%')
+            </foreach>
+        </if>
+        <if test="dto.countryUnit != null and dto.countryUnit.size>0">
+            and dria."county_cd" in
+            <foreach collection="dto.countryUnit" item="item" index="index" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
         <if test="dto.sgCodeS != null and dto.sgCodeS.size > 0">
             and (dria."province_cd" in
             <foreach collection="dto.sgCodeS" item="id" separator="," open="(" close=")">
@@ -535,7 +578,7 @@
     </select>
     <select id="projectTree" resultType="cn.gistack.sm.sg.VO.SgProjectTreeVO">
         SELECT
-<!--         TOP 200 -->
+       <!--  TOP 200 -->
         info.id,
         info.lot,
         dria."province_nm",
@@ -569,6 +612,9 @@
                 #{id}
             </foreach>)
         </if>
+        <if test="dto.adCode != null and dto.adCode !=''">
+            and dria."county_cd" = #{dto.adCode}
+        </if>
     </select>
     <select id="getUserS" resultType="java.lang.String">
 
@@ -576,16 +622,22 @@
             user_id
         FROM
             "YWXT"."BLADE_USER_DEPT"
-        WHERE
-            dept_id = #{controlUnit}
-
-
+        WHERE 1=1
+        <if test="list != null and list.size>0">
+            and dept_id in
+            <foreach collection="list" item="item" index="index" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
     </select>
     <select id="resList" resultType="cn.gistack.sm.sg.VO.ResVO">
         select dria.* from "SJZT_DW"."dim_res_info_a" dria where 1=1
         <if test="dto.adCode != null and dto.adCode != ''">
            and (dria."province_cd" = #{dto.adCode} or dria."city_cd" = #{dto.adCode} or dria."county_cd" = #{dto.adCode})
         </if>
+        <if test="dto.skName != null and dto.skName != ''">
+            and dria."res_nm" like CONCAT(CONCAT('%', #{dto.skName}), '%')
+        </if>
         <include refid="queryBySgCodeS"></include>
     </select>
 </mapper>

--
Gitblit v1.9.3