ludc
2023-10-31 c2efc1b0dfe76f5603dee63a917d3b7415053330
Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CodeCLassifyMapper.xml
@@ -38,6 +38,7 @@
        <result column="CODEKEYATTRREPEATOID" property="codeKeyAttrRepeatOid"/>
        <result column="CODERESEMBLERULEOID" property="codeResembleRuleOid"/>
        <result column="TENANT_ID" property="tenantId"/>
        <result column="TOTAL" property="total"/>
    </resultMap>
    <sql id="tableName">
@@ -89,21 +90,22 @@
               codekeyattrrepeatoid.name           as codeKeyAttrRepeatOidName,
               coderesembleruleoid.name            as codeResembleRuleOidName
        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 != ''">
                codeclassify0.parentcodeclassifyoid = '${oid}'
               and  codeclassify0.parentcodeclassifyoid = ${oid}
            </if>
            <if test="oid = null">
                codeclassify0.parentcodeclassifyoid is null
               and codeclassify0.parentcodeclassifyoid is null
            </if>
            <if test="tenantId != null and tenantId != ''">
                codeclassify0.tenant_id = #{tenantId}
               and  codeclassify0.tenant_id = #{tenantId}
            </if>
        </where>
        order by lastmodifytime asc
@@ -177,8 +179,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">
@@ -265,7 +273,7 @@
    </select>
    <select id="selectCodeClassifyDOByTree" resultMap="plCodeClassifyResultMap">
        select codeclassify0.OWNER                 as owner,
        select codeclassify0.OWNER          as owner,
        codeclassify0.BTMTYPEID             as btmtypeid,
        codeclassify0.CREATOR               as creator,
        codeclassify0.CREATETIME            as createtime,
@@ -287,7 +295,28 @@
        codeclassify0.TENANT_ID             as tenantId ,
        coderuleoid.name                    as codeRuleOidName,
        codekeyattrrepeatoid.name           as codeKeyAttrRepeatOidName,
        coderesembleruleoid.name            as codeResembleRuleOidName
        coderesembleruleoid.name            as codeResembleRuleOidName,
        (
            SELECT
                COUNT(*)
            FROM
                PLBT_CODE_part
            WHERE
                CODECLSFID IN (
                    SELECT
                    oid
                    FROM
                    PL_CODE_CLASSIFY
                    WHERE
                    lcstatus = 'Enabled'
                    START WITH
                    OID = codeclassify0.OID
                    CONNECT BY
                    PRIOR OID = parentCodeClassifyOid
                )
                AND lastr = '1'
                AND lastv = '1'
        ) AS total
        from pl_code_classify codeclassify0
        left join pl_code_rule coderuleoid
        on codeclassify0.codeRuleOid = coderuleoid.oid
@@ -306,7 +335,7 @@
        <if test="tenantId != null and tenantId != ''">
            and codeclassify0.tenant_id = #{tenantId}
        </if>
        order by lastmodifytime desc
        order by id asc
    </select>
    <select id="selectClassifyByKeyAndReseRel" resultMap="plCodeClassifyResultMap">
@@ -408,7 +437,7 @@
            </foreach>
        </if>
        <if test="tenantId != null and tenantId != ''">
            codeclassify0.tenant_id = #{tenantId}
            and codeclassify0.tenant_id = #{tenantId}
        </if>
        order by id asc
    </select>
@@ -453,6 +482,50 @@
        </if>
        order by id asc
    </select>
    <!--获取所有下级节点,不要动这个方法sql-->
    <select id="selectAllClassifyByOid" resultMap="plCodeClassifyResultMap">
        select codeclassify0.OWNER                 as owner,
        codeclassify0.BTMTYPEID             as btmtypeid,
        codeclassify0.CREATOR               as creator,
        codeclassify0.CREATETIME            as createtime,
        codeclassify0.LASTMODIFIER          as lastmodifier,
        codeclassify0.DESCRIPTION           as description,
        codeclassify0.ORDERNUM              as ordernum,
        codeclassify0.CODERULEOID           as coderuleoid,
        codeclassify0.OID                   as oid,
        codeclassify0.BTMNAME               as btmname,
        codeclassify0.BTMTYPENAME           as btmtypename,
        codeclassify0.CODEKEYATTRREPEATOID  as codekeyattrrepeatoid,
        codeclassify0.PARENTCODECLASSIFYOID as parentcodeclassifyoid,
        codeclassify0.NAME                  as name,
        codeclassify0.LASTMODIFYTIME        as lastmodifytime,
        codeclassify0.ID                    as id,
        codeclassify0.CODERESEMBLERULEOID   as coderesembleruleoid,
        codeclassify0.LCSTATUS              as lcstatus,
        codeclassify0.TS                    as ts,
        codeclassify0.TENANT_ID             as tenantId ,
        coderuleoid.name                    as codeRuleOidName,
        codekeyattrrepeatoid.name           as codeKeyAttrRepeatOidName,
        coderesembleruleoid.name            as codeResembleRuleOidName
        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
        start with  codeclassify0.oid=#{oid}
        <if test="tenantId != null and tenantId != ''">
            and  codeclassify0.tenant_id = #{tenantId}
        </if>
        connect by prior  codeclassify0.oid=codeclassify0.PARENTCODECLASSIFYOID
    </select>
    <select id="selectStartWithCurrentOid" resultMap="plCodeClassifyResultMap">
        select * from <include refid="tableName"/>
        start with oid = #{oid}
        connect by prior oid = parentcodeclassifyoid;
    </select>
    <select id="selectAllParenClassifytByOid" resultMap="plCodeClassifyResultMap">
        select codeclassify0.OWNER                 as owner,
@@ -489,7 +562,7 @@
         <if test="tenantId != null and tenantId != ''">
           and  codeclassify0.tenant_id = #{tenantId}
          </if>
            connect by prior PARENTCODECLASSIFYOID = codeclassify0.oid
            connect by prior codeclassify0.PARENTCODECLASSIFYOID = codeclassify0.oid
    </select>
    <select id="selectStartWithCurrentOid" resultMap="plCodeClassifyResultMap">
@@ -510,4 +583,11 @@
        </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>