From aa3b56b8ab335277351f503b8d38e1a0a5fe7477 Mon Sep 17 00:00:00 2001
From: yuxc <653031404@qq.com>
Date: 星期四, 14 九月 2023 18:28:51 +0800
Subject: [PATCH] 1、处理层级码段生成问题。

---
 Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CodeCLassifyMapper.xml |   58 +++++++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 47 insertions(+), 11 deletions(-)

diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CodeCLassifyMapper.xml b/Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CodeCLassifyMapper.xml
index 8015984..40dfb07 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CodeCLassifyMapper.xml
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CodeCLassifyMapper.xml
@@ -40,8 +40,15 @@
         <result column="TENANT_ID" property="tenantId"/>
     </resultMap>
 
+    <sql id="tableName">
+        pl_code_classify
+    </sql>
+
     <select id="selectPlCodeClassifyPage" resultMap="plCodeClassifyResultMap">
-        select * from PL_CODE_CLASSIFY where is_deleted = 0
+        select * from PL_CODE_CLASSIFY where
+        <if test="tenantId != null and tenantId != ''">
+            tenant_id = #{tenantId}
+        </if>
     </select>
 
     <select id="selectAllLevelChildOid" resultType="java.util.HashMap">
@@ -99,7 +106,7 @@
                 codeclassify0.tenant_id = #{tenantId}
             </if>
         </where>
-        order by id asc
+        order by lastmodifytime asc
     </select>
 
     <select id="selectAllLevelChildHasPath" resultMap="plCodeClassifyResultMap">
@@ -170,8 +177,14 @@
     </select>
 
     <select id="selectAllLevelParentByOid" resultType="java.util.HashMap">
-        select oid,
-               level from pl_code_classify start with oid= #{oid} connect by prior PARENTCODECLASSIFYOID = oid
+            select b.oid as oid,level from
+                pl_code_classify  b
+                    join (select oid
+                          from  pl_code_classify
+                                    start with oid = #{oid}
+                          connect by oid = prior PARENTCODECLASSIFYOID) a on b.oid = a.OID
+                start with b.PARENTCODECLASSIFYOID is null
+            connect by prior b.oid = b.PARENTCODECLASSIFYOID
     </select>
 
     <select id="getIdPathToNamePathByParentId"  resultMap="plCodeClassifyResultMap">
@@ -204,7 +217,6 @@
         CONNECT BY PRIOR OID = parentCodeClassifyOid) codeclassify0
     </select>
 
-
     <select id="selectByFieldNamePath"  resultMap="plCodeClassifyResultMap">
         select codeclassify0.OWNER                 as owner,
                codeclassify0.BTMTYPEID             as btmtypeid,
@@ -235,7 +247,6 @@
                         SYS_CONNECT_BY_PATH(id, '#')   as paths
                     </otherwise>
                 </choose>
-
         from pl_code_classify  plcodeclassify
                   START WITH parentCodeClassifyOid is null
               CONNECT BY PRIOR OID = parentCodeClassifyOid) codeclassify0
@@ -301,7 +312,7 @@
         <if test="tenantId != null and tenantId != ''">
             and codeclassify0.tenant_id = #{tenantId}
         </if>
-        order by id asc
+        order by lastmodifytime desc
     </select>
 
     <select id="selectClassifyByKeyAndReseRel" resultMap="plCodeClassifyResultMap">
@@ -357,12 +368,12 @@
         <if test="parentOid == null or parentOid == ''">
             and codeclassify0.parentcodeclassifyoid is null
         </if>
-
         <if test="tenantId != null and tenantId != ''">
-            codeclassify0.tenant_id = #{tenantId}
+            and codeclassify0.tenant_id = #{tenantId}
         </if>
         order by id asc
     </select>
+
     <select id="getRMLibByName" resultMap="plCodeClassifyResultMap">
         select codeclassify0.OWNER                 as owner,
         codeclassify0.BTMTYPEID             as btmtypeid,
@@ -403,7 +414,7 @@
             </foreach>
         </if>
         <if test="tenantId != null and tenantId != ''">
-            codeclassify0.tenant_id = #{tenantId}
+            and codeclassify0.tenant_id = #{tenantId}
         </if>
         order by id asc
     </select>
@@ -443,7 +454,6 @@
         <if test="desc != null">
             and  codeclassify0.DESCRIPTION = #{desc}
         </if>
-
         <if test="tenantId != null and tenantId != ''">
           and  codeclassify0.tenant_id = #{tenantId}
         </if>
@@ -487,4 +497,30 @@
           </if>
             connect by prior PARENTCODECLASSIFYOID = codeclassify0.oid
     </select>
+
+    <select id="selectStartWithCurrentOid" resultMap="plCodeClassifyResultMap">
+        select * from <include refid="tableName"/>
+                          start with oid = #{oid}
+        connect by prior oid = parentcodeclassifyoid;
+    </select>
+
+    <update id="batchUpdateLcStatus" parameterType="java.util.List">
+        BEGIN
+        <foreach collection="records" item="item" index="index" separator=";">
+            update <include refid="tableName"/> set
+            lcstatus = #{item.lcStatus},
+            ts = #{item.ts},
+            lastModifyTime = #{item.lastModifyTime},
+            lastModifier = #{item.lastModifier}
+            where oid = #{item.oid,jdbcType=VARCHAR}
+        </foreach>
+        ;END;
+    </update>
+
+    <select id="selectAllParents" resultMap="plCodeClassifyResultMap">
+        select * from PL_CODE_CLASSIFY p
+            start with p.OID =#{oid}
+        connect by p.oid = prior p.PARENTCODECLASSIFYOID
+    </select>
+
 </mapper>

--
Gitblit v1.9.3