yuxc
2023-06-06 229b9793ca9964ead44b35eb04cdcbe0ce14310f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.vci.ubcs.code.mapper.CodeClassifyMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="plCodeClassifyResultMap" type="com.vci.ubcs.code.entity.CodeClassify">
        <result column="OID" property="oid"/>
        <result column="REVISIONOID" property="revisionOid"/>
        <result column="NAMEOID" property="nameOid"/>
        <result column="BTMNAME" property="btmname"/>
        <result column="LASTR" property="lastR"/>
        <result column="FIRSTR" property="firstR"/>
        <result column="LASTV" property="lastV"/>
        <result column="FIRSTV" property="firstV"/>
        <result column="CREATOR" property="creator"/>
        <result column="CREATETIME" property="createTime"/>
        <result column="LASTMODIFIER" property="lastModifier"/>
        <result column="LASTMODIFYTIME" property="lastModifyTime"/>
        <result column="REVISIONRULE" property="revisionRule"/>
        <result column="VERSIONRULE" property="versionRule"/>
        <result column="REVISIONSEQ" property="revisionSeq"/>
        <result column="REVISIONVALUE" property="revisionValue"/>
        <result column="VERSIONSEQ" property="versionSeq"/>
        <result column="VERSIONVALUE" property="versionValue"/>
        <result column="LCTID" property="lctid"/>
        <result column="LCSTATUS" property="lcStatus"/>
        <result column="TS" property="ts"/>
        <result column="ID" property="id"/>
        <result column="NAME" property="name"/>
        <result column="DESCRIPTION" property="description"/>
        <result column="OWNER" property="owner"/>
        <result column="COPYFROMVERSION" property="copyFromVersion"/>
        <result column="PARENTCODECLASSIFYOID" property="parentCodeClassifyOid"/>
        <result column="ORDERNUM" property="orderNum"/>
        <result column="BTMTYPEID" property="btmTypeId"/>
        <result column="BTMTYPENAME" property="btmTypeName"/>
        <result column="CODERULEOID" property="codeRuleOid"/>
        <result column="CODEKEYATTRREPEATOID" property="codeKeyAttrRepeatOid"/>
        <result column="CODERESEMBLERULEOID" property="codeResembleRuleOid"/>
    </resultMap>
 
 
    <select id="selectPlCodeClassifyPage" resultMap="plCodeClassifyResultMap">
        select * from PL_CODE_CLASSIFY where is_deleted = 0
    </select>
 
    <select id="selectAllLevelChildOid" resultType="java.util.HashMap">
        select oid, level
        from PL_CODE_CLASSIFY
                 START WITH parentCodeClassifyOid = #{oid} CONNECT BY
            PRIOR OID = parentCodeClassifyOid
    </select>
 
    <select id="checkHasChild" resultType="java.lang.Boolean">
        <![CDATA[select count(oid)
        from PL_CODE_CLASSIFY
        where parentCodeClassifyOid = #{oid}]]>
    </select>
 
    <select id="selectCodeClassifyVOByTree" 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,
               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
        <where>
            <if test="oid != null and oid != ''">
                codeclassify0.parentcodeclassifyoid = '${oid}'
            </if>
            <if test="oid = null">
                codeclassify0.parentcodeclassifyoid is null
            </if>
        </where>
        order by id asc
    </select>
 
    <select id="selectAllLevelChildHasPath" 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,
               coderuleoid.name as codeRuleOidName,
               codekeyattrrepeatoid.name as codeKeyAttrRepeatOidName,
               coderesembleruleoid.name as codeResembleRuleOidName,
               level as datalevel,
               SYS_CONNECT_BY_PATH(codeclassify0.id, '#') as path
        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
            <if test="oid != null ">
                codeclassify0.parentCodeClassifyOid = '${oid}'
            </if>
            <if test="oid == null ">
                codeclassify0.parentCodeClassifyOid is null
            </if>
        CONNECT BY PRIOR codeclassify0.OID = codeclassify0.parentCodeClassifyOid
    </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>
 
    <select id="selectByFieldNamePath"  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.paths                 as paths
        from (select plcodeclassify.*,
                <choose>
                     <when test='fieldName=="name"'>
                         SUBSTR(SYS_CONNECT_BY_PATH(name, '##'),3)   as paths
                     </when>
                    <otherwise>
                        SUBSTR(SYS_CONNECT_BY_PATH(id, '##'),3)   as paths
                    </otherwise>
                </choose>
 
        from pl_code_classify  plcodeclassify
                  START WITH parentCodeClassifyOid is null
              CONNECT BY PRIOR OID = parentCodeClassifyOid) codeclassify0
        where codeclassify0.paths =#{fieldPath}
    </select>
 
    <select id="selectByFieldPath" resultType="java.util.HashMap">
        select *
        from (select oid, SYS_CONNECT_BY_PATH(id, '/') as paths
              from pl_code_classify
                       START WITH parentCodeClassifyOid is null
              CONNECT BY PRIOR OID = parentCodeClassifyOid) a
        where a.paths = #{fieldPath}
    </select>
 
    <select id="selectAllLevelParents" resultType="java.util.HashMap">
        select oid, id, name, btmtypeid, btmtypename
            from PL_CODE_CLASSIFY
            where btmtypeid is not null
                start with oid = #{oid}
            connect by prior PARENTCODECLASSIFYOID = oid
    </select>
 
    <select id="selectCodeClassifyDOByTree" 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,
        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
        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>
        order by id asc
    </select>
 
</mapper>