From a8d80ddd0aef61cbaf1dbe9fe7abec12f0835399 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期四, 01 二月 2024 14:52:14 +0800
Subject: [PATCH] 代码合并

---
 Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CodeCLassifyMapper.xml |  103 +++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 78 insertions(+), 25 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 a604bf7..3af89eb 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
@@ -37,6 +37,7 @@
         <result column="CODERULEOID" property="codeRuleOid"/>
         <result column="CODEKEYATTRREPEATOID" property="codeKeyAttrRepeatOid"/>
         <result column="CODERESEMBLERULEOID" property="codeResembleRuleOid"/>
+        <result column="ISPARTICIPATECHECK" property="isParticipateCheck"/>
         <result column="TENANT_ID" property="tenantId"/>
         <result column="TOTAL" property="total"/>
     </resultMap>
@@ -57,6 +58,13 @@
         from PL_CODE_CLASSIFY
                  START WITH parentCodeClassifyOid = #{oid} CONNECT BY
             PRIOR OID = parentCodeClassifyOid
+    </select>
+
+    <select id="selectAllParentOid" resultType="java.lang.String">
+        SELECT oid
+        FROM PL_CODE_CLASSIFY
+                 START WITH oid = #{oid}
+        CONNECT BY PRIOR PARENTCODECLASSIFYOID = oid
     </select>
 
     <select id="checkHasChild" resultType="java.lang.Boolean">
@@ -88,7 +96,8 @@
                codeclassify0.TENANT_ID             as tenantId ,
                coderuleoid.name                    as codeRuleOidName,
                codekeyattrrepeatoid.name           as codeKeyAttrRepeatOidName,
-               coderesembleruleoid.name            as codeResembleRuleOidName
+               coderesembleruleoid.name            as codeResembleRuleOidName,
+               codeclassify0.ISPARTICIPATECHECK   as isParticipateCheck
         from pl_code_classify codeclassify0
              left join pl_code_rule coderuleoid
                        on codeclassify0.codeRuleOid = coderuleoid.oid
@@ -99,7 +108,7 @@
         <where>
              1=1
             <if test="oid != null and oid != ''">
-               and  codeclassify0.parentcodeclassifyoid = ${oid}
+               and codeclassify0.parentcodeclassifyoid = ${oid}
             </if>
             <if test="oid = null">
                and codeclassify0.parentcodeclassifyoid is null
@@ -108,10 +117,9 @@
                and  codeclassify0.tenant_id = #{tenantId}
             </if>
         </where>
-        order by lastmodifytime asc
+        order by id asc
     </select>
 
-    <!--codeclassify0.parentCodeClassifyOid = '${oid}'-->
     <select id="selectAllLevelChildHasPath" resultMap="plCodeClassifyResultMap">
         select codeclassify0.OWNER as owner,
                codeclassify0.BTMTYPEID as btmtypeid,
@@ -132,6 +140,7 @@
                codeclassify0.CODERESEMBLERULEOID as coderesembleruleoid,
                codeclassify0.LCSTATUS as lcstatus,
                codeclassify0.TS as ts,
+               codeclassify0.ISPARTICIPATECHECK   as isParticipateCheck,
                coderuleoid.name as codeRuleOidName,
                codekeyattrrepeatoid.name as codeKeyAttrRepeatOidName,
                coderesembleruleoid.name as codeResembleRuleOidName,
@@ -213,8 +222,9 @@
         codeclassify0.CODERESEMBLERULEOID   as coderesembleruleoid,
         codeclassify0.LCSTATUS              as lcstatus,
         codeclassify0.TS                    as ts,
-        codeclassify0.namePath                 as namepath,
-        codeclassify0.idPath                 as idpath
+        codeclassify0.namePath              as namepath,
+        codeclassify0.idPath                as idpath,
+        codeclassify0.ISPARTICIPATECHECK   as isParticipateCheck
         from (select plcodeclassify.*,
                 SYS_CONNECT_BY_PATH(name, '#')   as namePath,
                 SYS_CONNECT_BY_PATH(id, '#')   as idPath
@@ -243,7 +253,8 @@
                codeclassify0.CODERESEMBLERULEOID   as coderesembleruleoid,
                codeclassify0.LCSTATUS              as lcstatus,
                codeclassify0.TS                    as ts,
-               codeclassify0.paths                 as paths
+               codeclassify0.paths                 as paths,
+               codeclassify0.ISPARTICIPATECHECK   as isParticipateCheck
         from (select plcodeclassify.*,
                 <choose>
                      <when test='fieldName=="name"'>
@@ -296,7 +307,8 @@
         codeclassify0.CODERESEMBLERULEOID   as coderesembleruleoid,
         codeclassify0.LCSTATUS              as lcstatus,
         codeclassify0.TS                    as ts,
-        codeclassify0.TENANT_ID             as tenantId ,
+        codeclassify0.TENANT_ID             as tenantId,
+        codeclassify0.ISPARTICIPATECHECK   as isParticipateCheck,
         coderuleoid.name                    as codeRuleOidName,
         codekeyattrrepeatoid.name           as codeKeyAttrRepeatOidName,
         coderesembleruleoid.name            as codeResembleRuleOidName
@@ -308,16 +320,13 @@
         left join pl_code_resemblerule coderesembleruleoid
         on codeclassify0.codeResembleRuleOid = coderesembleruleoid.oid
         where codeclassify0.lcstatus = #{lcstatus}
-        <if test="parentcodeclassifyoid != null and parentcodeclassifyoid != ''">
-            and codeclassify0.parentcodeclassifyoid = #{parentcodeclassifyoid}
-        </if>
-        <if test="parentcodeclassifyoid == null or parentcodeclassifyoid == ''">
-            and codeclassify0.parentcodeclassifyoid is null
-            and codeclassify0.id = #{id}
-        </if>
         <if test="tenantId != null and tenantId != ''">
-            and codeclassify0.tenant_id = #{tenantId}
+            AND codeclassify0.tenant_id = #{tenantId}
         </if>
+        START WITH
+            codeclassify0.ID = #{id}
+        CONNECT BY
+        PRIOR codeclassify0.OID = codeclassify0.parentCodeClassifyOid
         order by id asc
     </select>
 
@@ -359,7 +368,8 @@
         codeclassify0.TENANT_ID             as tenantId ,
         coderuleoid.name                    as codeRuleOidName,
         codekeyattrrepeatoid.name           as codeKeyAttrRepeatOidName,
-        coderesembleruleoid.name            as codeResembleRuleOidName
+        coderesembleruleoid.name            as codeResembleRuleOidName,
+        codeclassify0.ISPARTICIPATECHECK   as isParticipateCheck
         from pl_code_classify codeclassify0
         left join pl_code_rule coderuleoid
         on codeclassify0.codeRuleOid = coderuleoid.oid
@@ -381,7 +391,7 @@
     </select>
 
     <select id="getRMLibByName" resultMap="plCodeClassifyResultMap">
-        select codeclassify0.OWNER                 as owner,
+        select codeclassify0.OWNER          as owner,
         codeclassify0.BTMTYPEID             as btmtypeid,
         codeclassify0.CREATOR               as creator,
         codeclassify0.CREATETIME            as createtime,
@@ -401,6 +411,7 @@
         codeclassify0.LCSTATUS              as lcstatus,
         codeclassify0.TS                    as ts,
         codeclassify0.TENANT_ID             as tenantId ,
+        codeclassify0.ISPARTICIPATECHECK   as isParticipateCheck,
         coderuleoid.name                    as codeRuleOidName,
         codekeyattrrepeatoid.name           as codeKeyAttrRepeatOidName,
         coderesembleruleoid.name            as codeResembleRuleOidName
@@ -446,6 +457,7 @@
         codeclassify0.LCSTATUS              as lcstatus,
         codeclassify0.TS                    as ts,
         codeclassify0.TENANT_ID             as tenantId ,
+        codeclassify0.ISPARTICIPATECHECK   as isParticipateCheck,
         coderuleoid.name                    as codeRuleOidName,
         codekeyattrrepeatoid.name           as codeKeyAttrRepeatOidName,
         coderesembleruleoid.name            as codeResembleRuleOidName
@@ -488,6 +500,7 @@
         codeclassify0.LCSTATUS              as lcstatus,
         codeclassify0.TS                    as ts,
         codeclassify0.TENANT_ID             as tenantId ,
+        codeclassify0.ISPARTICIPATECHECK   as isParticipateCheck,
         coderuleoid.name                    as codeRuleOidName,
         codekeyattrrepeatoid.name           as codeKeyAttrRepeatOidName,
         coderesembleruleoid.name            as codeResembleRuleOidName
@@ -531,7 +544,8 @@
         codeclassify0.CODERESEMBLERULEOID   as coderesembleruleoid,
         codeclassify0.LCSTATUS              as lcstatus,
         codeclassify0.TS                    as ts,
-        codeclassify0.TENANT_ID             as tenantId ,
+        codeclassify0.TENANT_ID             as tenantId,
+        codeclassify0.ISPARTICIPATECHECK   as isParticipateCheck,
         coderuleoid.name                    as codeRuleOidName,
         codekeyattrrepeatoid.name           as codeKeyAttrRepeatOidName,
         coderesembleruleoid.name            as codeResembleRuleOidName
@@ -547,12 +561,6 @@
            and  codeclassify0.tenant_id = #{tenantId}
           </if>
             connect by prior codeclassify0.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">
@@ -574,4 +582,49 @@
         connect by p.oid = prior p.PARENTCODECLASSIFYOID
     </select>
 
+    <select id="selectLeafByParentClassifyOid" resultType="com.vci.ubcs.code.entity.CodeClassify">
+        select *
+            from (
+                select
+                    oid,
+                    name,
+                    id,
+                    level lvl,
+                    isparticipatecheck,
+                    nvl((select 'N'
+                        from PL_CODE_CLASSIFY pcc1
+                        where pcc.oid = pcc1.PARENTCODECLASSIFYOID
+                            and rownum &lt; 2),'Y') is_leaf
+                from PL_CODE_CLASSIFY pcc
+                start with pcc.PARENTCODECLASSIFYOID = #{topOid}
+                connect by pcc.PARENTCODECLASSIFYOID = prior oid
+            ) plcls
+        where
+        is_leaf = 'Y'
+        and isparticipatecheck = 0
+        and oid != #{currentOid}
+    </select>
+
+    <!--鏍规嵁椤跺眰鑺傜偣oid鏌ヨ鎵�鏈夊彾瀛愯妭鐐瑰垎绫籵id-->
+    <select id="selectLeafByPid" resultType="com.vci.ubcs.code.entity.CodeClassify">
+        select *
+        from (
+                 select
+                     oid,
+                     name,
+                     id,
+                     level lvl,
+                     isparticipatecheck,
+                     nvl((select 'N'
+                          from PL_CODE_CLASSIFY pcc1
+                          where pcc.oid = pcc1.PARENTCODECLASSIFYOID
+                            and rownum &lt; 2),'Y') is_leaf
+                 from PL_CODE_CLASSIFY pcc
+                     start with pcc.oid = #{pid}
+                 connect by pcc.PARENTCODECLASSIFYOID = prior oid
+             ) plcls
+        where
+            is_leaf = 'Y'
+    </select>
+
 </mapper>

--
Gitblit v1.9.3