From 03ab24af158dba0d506569d7e7cf22929ae67296 Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期三, 31 一月 2024 16:35:28 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CodeCLassifyMapper.xml |  102 +++++++++++++++++++++++++++++++++++----------------
 1 files changed, 70 insertions(+), 32 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 c4e4702..2305909 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,7 +37,9 @@
         <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>
 
     <sql id="tableName">
@@ -56,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">
@@ -87,18 +96,19 @@
                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
-                 left join pl_code_keyattrrepeat codekeyattrrepeatoid
-                           on codeclassify0.codeKeyAttrRepeatOid = codekeyattrrepeatoid.oid
-                 left join pl_code_resemblerule coderesembleruleoid
-                           on codeclassify0.codeResembleRuleOid = coderesembleruleoid.oid
+             left join pl_code_rule coderuleoid
+                       on codeclassify0.codeRuleOid = coderuleoid.oid
+             left join pl_code_keyattrrepeat codekeyattrrepeatoid
+                       on codeclassify0.codeKeyAttrRepeatOid = codekeyattrrepeatoid.oid
+             left join pl_code_resemblerule coderesembleruleoid
+                       on codeclassify0.codeResembleRuleOid = coderesembleruleoid.oid
         <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
@@ -107,7 +117,7 @@
                and  codeclassify0.tenant_id = #{tenantId}
             </if>
         </where>
-        order by lastmodifytime asc
+        order by id asc
     </select>
 
     <select id="selectAllLevelChildHasPath" resultMap="plCodeClassifyResultMap">
@@ -130,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,
@@ -154,10 +165,13 @@
                            on codeclassify0.codeResembleRuleOid = coderesembleruleoid.oid
             START WITH
             <if test="oid != null ">
-                codeclassify0.parentCodeClassifyOid = '${oid}'
+                codeclassify0.parentCodeClassifyOid = #{oid}
             </if>
             <if test="oid == null ">
                 codeclassify0.parentCodeClassifyOid is null
+            </if>
+            <if test="tenantId != null and tenantId != ''">
+                and  codeclassify0.tenant_id = #{tenantId}
             </if>
         CONNECT BY PRIOR codeclassify0.OID = codeclassify0.parentCodeClassifyOid
     </select>
@@ -208,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
@@ -238,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"'>
@@ -291,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
@@ -303,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>
 
@@ -354,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
@@ -376,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,
@@ -396,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
@@ -441,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
@@ -460,9 +477,10 @@
         </if>
         order by id asc
     </select>
+
     <!--鑾峰彇鎵�鏈変笅绾ц妭鐐�,涓嶈鍔ㄨ繖涓柟娉晄ql-->
     <select id="selectAllClassifyByOid" resultMap="plCodeClassifyResultMap">
-        select codeclassify0.OWNER                 as owner,
+        select codeclassify0.OWNER          as owner,
         codeclassify0.BTMTYPEID             as btmtypeid,
         codeclassify0.CREATOR               as creator,
         codeclassify0.CREATETIME            as createtime,
@@ -482,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
@@ -504,6 +523,7 @@
         start with oid = #{oid}
         connect by prior oid = parentcodeclassifyoid;
     </select>
+
     <select id="selectAllParenClassifytByOid" resultMap="plCodeClassifyResultMap">
         select codeclassify0.OWNER                 as owner,
         codeclassify0.BTMTYPEID             as btmtypeid,
@@ -524,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
@@ -540,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">
@@ -567,4 +582,27 @@
         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>
+
 </mapper>

--
Gitblit v1.9.3