2
13693261870
2022-09-16 653761a31dfeb50dd3d007e892d69c90bf0cdafc
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
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
<?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.landtool.lanbase.modules.res.dao.Res_CatalogMapper">
  <resultMap id="BaseResultMap" type="com.landtool.lanbase.modules.res.entity.Res_Catalog">
    <id column="CATLOGID" property="catlogid" jdbcType="DECIMAL"/>
    <result column="CATLOGCODE" property="catlogcode" jdbcType="OTHER"/>
    <result column="PARENTID" property="parentid" jdbcType="DECIMAL"/>
    <result column="TITLE" property="title" jdbcType="OTHER"/>
    <result column="PINGYINFIIRST" property="pingyinfiirst" jdbcType="OTHER"/>
    <result column="DESCRIPTION" property="description" jdbcType="OTHER"/>
    <result column="IMGURL" property="imgurl" jdbcType="OTHER"/>
    <result column="ORDERID" property="orderid" jdbcType="DECIMAL"/>
    <result column="CREATEUSER" property="createuser" jdbcType="OTHER"/>
    <result column="CREATEDATE" property="createdate" jdbcType="TIMESTAMP"/>
    <result column="REMARK" property="remark" jdbcType="OTHER"/>
    <result column="ICON" property="icon" jdbcType="OTHER"/>
  </resultMap>
  <sql id="Base_Column_List">
    CATLOGID, CATLOGCODE, PARENTID, TITLE, PINGYINFIIRST, DESCRIPTION, IMGURL, ORDERID,
    CREATEUSER, CREATEDATE, REMARK,ICON
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
    select
    <include refid="Base_Column_List"/>
    from RES_CATALOG
    where CATLOGID = #{catlogid,jdbcType=DECIMAL}
  </select>
 
  <select id="selectResCatalogToParentid" resultMap="BaseResultMap" parameterType="java.lang.Integer">
    select
    <include refid="Base_Column_List"/>
    from RES_CATALOG
    where parentid = #{parentid,jdbcType=DECIMAL} order by ORDERID
  </select>
  <select id="selectResCatalogIsExistsSon" resultType="java.lang.Integer" parameterType="java.lang.Integer">
    select
      COUNT(*) as ROW_COUNT
    from RES_CATALOG
    where parentId = #{parentId,jdbcType=DECIMAL}
  </select>
  <select id="selectMuLuZiYuanList" parameterType="java.lang.Integer"
          resultType="com.landtool.lanbase.modules.res.entity.Res_MainInfo">
    select b.* from RES_CATALOG a left join RES_MAININFO  b
                                            on(a.CATLOGCODE = substr(b.CATLOGCODE, 1, LENGTH(a.CATLOGCODE))) where a.CATLOGID =  #{parentId,jdbcType=DECIMAL}
  </select>
  <select id="selectMuLuZiYuanCount" parameterType="java.lang.Integer" resultType="java.lang.Integer">
    select count(b.RESOURCEID) from RES_CATALOG a left join RES_MAININFO  b
                                                            on(a.CATLOGCODE = substr(b.CATLOGCODE, 1, LENGTH(a.CATLOGCODE))) where a.CATLOGID =  #{parentId,jdbcType=DECIMAL}
  </select>
  <select id="getResCatalogInfoById" resultMap="BaseResultMap" parameterType="java.lang.Integer">
    SELECT
    <include refid="Base_Column_List"/>
    FROM RES_CATALOG
    WHERE catlogId = #{catlogId,jdbcType=DECIMAL}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from RES_CATALOG
    where CATLOGID = #{catlogid,jdbcType=DECIMAL}
  </delete>
  <insert id="insert" parameterType="com.landtool.lanbase.modules.res.entity.Res_Catalog">
    insert into RES_CATALOG (CATLOGID, CATLOGCODE, PARENTID,
                             TITLE, PINGYINFIIRST, DESCRIPTION,
                             IMGURL, ORDERID, CREATEUSER,
                             CREATEDATE, REMARK,ICON,STATUS)
    values (#{catlogid,jdbcType=DECIMAL}, #{catlogcode,jdbcType=OTHER}, #{parentid,jdbcType=DECIMAL},
            #{title,jdbcType=OTHER}, #{pingyinfiirst,jdbcType=OTHER}, #{description,jdbcType=OTHER},
            #{imgurl,jdbcType=OTHER}, #{orderid,jdbcType=DECIMAL}, #{createuser,jdbcType=OTHER},
            #{createdate,jdbcType=TIMESTAMP}, #{remark,jdbcType=OTHER},#{icon,jdbcType=OTHER}
  </insert>
  <insert id="insertSelective" parameterType="com.landtool.lanbase.modules.res.entity.Res_Catalog">
    insert into RES_CATALOG
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="catlogcode != null">
        CATLOGCODE,
      </if>
      <if test="parentid != null">
        PARENTID,
      </if>
      <if test="title != null">
        TITLE,
      </if>
      <if test="pingyinfiirst != null">
        PINGYINFIIRST,
      </if>
      <if test="description != null">
        DESCRIPTION,
      </if>
      <if test="imgurl != null">
        IMGURL,
      </if>
      <if test="orderid != null">
        ORDERID,
      </if>
      <if test="createuser != null">
        CREATEUSER,
      </if>
      <if test="createdate != null">
        CREATEDATE,
      </if>
      <if test="remark != null">
        REMARK,
      </if>
      <if test="icon != null">
        ICON,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="catlogcode != null">
        #{catlogcode,jdbcType=OTHER},
      </if>
      <if test="parentid != null">
        #{parentid,jdbcType=DECIMAL},
      </if>
      <if test="title != null">
        #{title,jdbcType=OTHER},
      </if>
      <if test="pingyinfiirst != null">
        #{pingyinfiirst,jdbcType=OTHER},
      </if>
      <if test="description != null">
        #{description,jdbcType=OTHER},
      </if>
      <if test="imgurl != null">
        #{imgurl,jdbcType=OTHER},
      </if>
      <if test="orderid != null">
        #{orderid,jdbcType=DECIMAL},
      </if>
      <if test="createuser != null">
        #{createuser,jdbcType=OTHER},
      </if>
      <if test="createdate != null">
        #{createdate,jdbcType=TIMESTAMP},
      </if>
      <if test="remark != null">
        #{remark,jdbcType=OTHER},
      </if>
      <if test="icon != null">
        #{icon,jdbcType=OTHER}
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.landtool.lanbase.modules.res.entity.Res_Catalog">
    update RES_CATALOG
    <set>
      <if test="catlogcode != null">
        CATLOGCODE = #{catlogcode,jdbcType=OTHER},
      </if>
      <if test="parentid != null">
        PARENTID = #{parentid,jdbcType=DECIMAL},
      </if>
      <if test="title != null">
        TITLE = #{title,jdbcType=OTHER},
      </if>
      <if test="pingyinfiirst != null">
        PINGYINFIIRST = #{pingyinfiirst,jdbcType=OTHER},
      </if>
      <if test="description != null">
        DESCRIPTION = #{description,jdbcType=OTHER},
      </if>
      <if test="imgurl != null">
        IMGURL = #{imgurl,jdbcType=OTHER},
      </if>
      <if test="orderid != null">
        ORDERID = #{orderid,jdbcType=DECIMAL},
      </if>
      <if test="createuser != null">
        CREATEUSER = #{createuser,jdbcType=OTHER},
      </if>
      <if test="createdate != null">
        CREATEDATE = #{createdate,jdbcType=TIMESTAMP},
      </if>
      <if test="remark != null">
        REMARK = #{remark,jdbcType=OTHER},
      </if>
      <if test="icon != null">
        ICON = #{icon,jdbcType=OTHER},
      </if>
    </set>
    where CATLOGID = #{catlogid,jdbcType=DECIMAL}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.landtool.lanbase.modules.res.entity.Res_Catalog">
    update RES_CATALOG
    set CATLOGCODE = #{catlogcode,jdbcType=OTHER},
        PARENTID = #{parentid,jdbcType=DECIMAL},
        TITLE = #{title,jdbcType=OTHER},
        PINGYINFIIRST = #{pingyinfiirst,jdbcType=OTHER},
        DESCRIPTION = #{description,jdbcType=OTHER},
        IMGURL = #{imgurl,jdbcType=OTHER},
        ORDERID = #{orderid,jdbcType=DECIMAL},
        CREATEUSER = #{createuser,jdbcType=OTHER},
        CREATEDATE = #{createdate,jdbcType=TIMESTAMP},
        REMARK = #{remark,jdbcType=OTHER},
        ICON = #{icon,jdbcType=OTHER}
    where CATLOGID = #{catlogid,jdbcType=DECIMAL}
  </update>
  <select id="getMaxOrderId" resultType="java.lang.String" parameterType="java.lang.Integer">
    select
      max(ORDERID)
    from RES_CATALOG
    where PARENTID = #{id,jdbcType=DECIMAL} AND cast(ORDERID as varchar2(50)) LIKE cast((SELECT ORDERID FROM RES_CATALOG WHERE CATLOGID= #{id,jdbcType=DECIMAL}) as VARCHAR2(50) ) ||'%'
  </select>
  <select id="getMaxId" resultType="java.lang.String">
    select
      max(CATLOGID)
    from RES_CATALOG
  </select>
  <select id="getMaxCATLOGCODE" resultType="java.lang.String" parameterType="java.lang.Integer">
    select
      max(CATLOGCODE)
    from RES_CATALOG
    where PARENTID = #{id,jdbcType=DECIMAL} AND CATLOGCODE LIKE  cast((SELECT CATLOGCODE FROM RES_CATALOG WHERE CATLOGID= #{id,jdbcType=DECIMAL}) AS  VARCHAR2(50) )||'%'
  </select>
  <select id="getMinCATLOGCODE" resultType="java.lang.String" parameterType="java.lang.Integer">
    select
      min(CATLOGCODE)
    from RES_CATALOG
    where PARENTID = #{id,jdbcType=DECIMAL} AND CATLOGCODE LIKE CAST((SELECT CATLOGCODE FROM RES_CATALOG WHERE CATLOGID= #{id,jdbcType=DECIMAL}) AS  VARCHAR2(50) )||'%'
  </select>
  <select id="getMinOrderId" resultType="java.lang.String" parameterType="java.lang.Integer">
    select
      min(ORDERID)
    from RES_CATALOG
    where PARENTID = #{id,jdbcType=DECIMAL} AND cast(ORDERID as varchar2(50)) LIKE CAST ((SELECT ORDERID FROM RES_CATALOG WHERE CATLOGID= #{id,jdbcType=DECIMAL}) as VARCHAR2(50))||'%'
  </select>
  <select id="getMaxOrderIdFromMainIndex" resultType="java.lang.String" parameterType="java.lang.Integer">
    select
      max(ORDERID)
    from RES_CATALOG
    where PARENTID = #{id,jdbcType=DECIMAL}
  </select>
  <select id="getMinOrderIdFromMainIndex" resultType="java.lang.String" parameterType="java.lang.Integer">
    select
      min(ORDERID)
    from RES_CATALOG
    where PARENTID = #{id,jdbcType=DECIMAL}
  </select>
  <select id="getMaxCATLOGCODEFromMainIndex" resultType="java.lang.String" parameterType="java.lang.Integer">
    select
      max(CATLOGCODE)
    from RES_CATALOG
    where PARENTID = #{id,jdbcType=DECIMAL}
  </select>
  <select id="getMinCATLOGCODEFromMainIndex" resultType="java.lang.String" parameterType="java.lang.Integer">
    select
      min(CATLOGCODE)
    from RES_CATALOG
    where PARENTID = #{id,jdbcType=DECIMAL}
  </select>
  <select id="selectFilterResCatalogToParentid" resultMap="BaseResultMap"
          parameterType="com.landtool.lanbase.modules.res.entity.Res_MainInfo">
    select
    <include refid="Base_Column_List"/>
    from RES_CATALOG b where b.CATLOGID in
    (select CATLOGID from RES_MAININFO
    where 1 = 1
    <if test="title!=null and title != '' ">
      and (RES_MAININFO.TITLE like '%'||#{title}||'%' OR replace(RES_MAININFO.KEYWORDS,',','') like
      '%'||#{title}||'%')
    </if>
    <if test="createuserid!=null and createuserid != '' ">
      and RES_MAININFO.createuserid = #{createuserid,jdbcType=OTHER}
    </if>
    <if test="pubdateBegin!=null and pubdateBegin != '' ">
      and RES_MAININFO.PUBDATE >= to_timestamp(#{pubdateBegin} || ' 00:00:00','yyyy-mm-dd hh24:mi:ss')
    </if>
    <if test="pubdatefinish!=null and pubdatefinish != '' ">
      <![CDATA[ and RES_MAININFO.PUBDATE <=  to_timestamp(#{pubdatefinish} || ' 23:59:59','yyyy-mm-dd hh24:mi:ss') ]]>
    </if>
    <if test="resourceclass!=null and resourceclass != '' ">
      and RES_MAININFO.resourceclass=#{resourceclass}
    </if>
    group by CATLOGID)
    and parentid = #{cparentid,jdbcType=DECIMAL} order by ORDERID
  </select>
  <select id="SelectMuLuCount"
          resultType="com.landtool.lanbase.modules.res.entity.UserDefined.CatlogJoinActionrecord">
    select c.CATLOGID,d.CATLOGCODE, d.TITLE as Title,c.ACTIONTYPE as ActionType,SUM(c.count) as Count from
    (select a.CATLOGID,b.ACTIONTYPE,b.count from (select RESOURCEID,CATLOGID from RES_MAININFO where CATLOGID!=0
    <if test="isDiTuFuwu != ''">
      and RESOURCECLASS in ( ${isDiTuFuwu} )
    </if>
    )a
    left join (select RESOURCEID,ACTIONTYPE,COUNT(*) as count from RES_ACTIONRECORD where ACTIONTYPE in ('浏览','收藏')
    group by ACTIONTYPE,RESOURCEID)b on a.RESOURCEID=b.RESOURCEID where count is not null)c
    left join (select CATLOGID,CATLOGCODE,TITLE from RES_CATALOG)d on c.CATLOGID=d.CATLOGID group by
    d.TITLE,c.ACTIONTYPE,c.CATLOGID,d.CATLOGCODE
  </select>
  <select id="getYWJCMuLuTree" resultMap="BaseResultMap" parameterType="java.lang.Integer">
    SELECT DISTINCT a.CATLOGID,a.CATLOGCODE,a.PARENTID,a.TITLE,a.PINGYINFIIRST,a.IMGURL,a.ORDERID,a.CREATEUSER,a.CREATEDATE,a.ICON
    FROM RES_CATALOG a
           LEFT JOIN (
      SELECT DISTINCT b.CATLOGCODE
 
      FROM RES_MAININFO b
             LEFT JOIN RES_EXTINTEGRATE c
                       ON b.RESOURCEID=c.RESOURCEID
      WHERE b.AUDITSTATUS = 2 and b.RESOURCESTATUS=0 and b.RESOURCECLASS='YWJC' AND c.INTEGRATETYPE='页面集成' AND c.SHOWMODEL='Iframe区块'
    ) d ON 1=1
    WHERE PARENTID=#{id,jdbcType=DECIMAL} AND a.CATLOGCODE=substr(d.CATLOGCODE, 1, LENGTH(a.CATLOGCODE))
    ORDER BY a.CATLOGID
  </select>
  <select id="getMuLuTreeData" resultMap="BaseResultMap">
    <if test="catalogName != null and catalogName != ''">
      with tab (CATLOGID) as ( select CATLOGID from RES_CATALOG where TITLE LIKE '%'|| #{catalogName} ||'%' union
      all select b.CATLOGID from tab a, RES_CATALOG b where b.parentid = a.CATLOGID )
    </if>
    select distinct
    a.CATLOGID,a.CATLOGCODE,a.PARENTID,a.TITLE,a.PINGYINFIIRST,a.IMGURL,a.ORDERID,a.CREATEUSER,a.CREATEDATE,a.ICON
    from RES_CATALOG a
    left join (
    select RES_MAININFO.* from RES_MAININFO
    <if test="catalogName != null and catalogName != ''">
      left join RES_CATALOG b on b.CATLOGID = RES_MAININFO.CATLOGID
    </if>
    where RESOURCESTATUS = 0
    and AUDITSTATUS = 2
    <if test="shoucang == 1">
      and RESOURCEID in(select RESOURCEID from RES_ACTIONRECORD where ACTIONTYPE='收藏')
    </if>
    <if test="xzqhid != null and xzqhid != ''">
      and SUBSTR(ADMINISTRATIVEID,1, LENGTH(#{xzqhid}))=#{xzqhid}
    </if>
    <if test="nf != null">
      and YEAR(PUBDATE) = #{nf}
    </if>
    <if test="catalogName != null and catalogName != ''">
      and RES_MAININFO.CATLOGID in (select * from tab)
    </if>
    <if test="resourceclass != null and resourceclass != ''">
      and RES_MAININFO.RESOURCECLASS = #{resourceclass}
    </if>
    <if test="spcStatus != null and spcStatus == 1 ">
      and RES_MAININFO.SPC_STATUS =#{spcStatus}
    </if>
    <if test="spcStatus = null">
      and RES_MAININFO.SPC_STATUS =0
    </if>
    ) b on a.CATLOGCODE=SUBSTR(b.CATLOGCODE,1, LENGTH(a.CATLOGCODE))
    where parentid = #{parentid,jdbcType=DECIMAL}
    and b.RESOURCEID is not null
    order by a.ORDERID
  </select>
  <select id="getResourceClassTreeData" resultType="com.landtool.lanbase.modules.res.entity.Res_MainInfo">
    select distinct RESOURCECLASS from RES_MAININFO
    where RESOURCESTATUS=0
    and AUDITSTATUS=2
    <if test="shoucang == 1">
      and RESOURCEID in(select RESOURCEID from RES_ACTIONRECORD where ACTIONTYPE='收藏')
    </if>
    <if test="xzqhid != null and xzqhid != ''">
      and SUBSTR(ADMINISTRATIVEID,1, LENGTH(#{xzqhid}))=#{xzqhid}
    </if>
    <if test="nf != null">
      and YEAR(PUBDATE) = #{nf}
    </if>
  </select>
 
  <select id="getParentCatalogsById" resultMap="BaseResultMap" parameterType="java.lang.Integer">
    with tab(CATLOGID,CATLOGCODE,TITLE,PARENTID) AS(
      select CATLOGID,CATLOGCODE,TITLE,PARENTID from RES_CATALOG where CATLOGID = #{catlogId,jdbcType=DECIMAL}
      union all
      select b.CATLOGID,b.CATLOGCODE,b.TITLE,b.PARENTID from tab a,RES_CATALOG b
      where a.PARENTID = b.CATLOGID )
    select * from tab where CATLOGID != #{catlogId,jdbcType=DECIMAL} order by CATLOGCODE
  </select>
 
  <select id="getMuLuTreeDataByResourceType" resultMap="BaseResultMap" parameterType="java.util.HashMap">
    select distinct a.CATLOGID,a.CATLOGCODE,a.PARENTID,a.TITLE,a.PINGYINFIIRST,a.IMGURL,a.ORDERID,a.CREATEUSER,a.CREATEDATE,a.ICON
                    <if test="spcStatus!=1">, b.resourceclass</if>
    from RES_CATALOG a left join ( select RES_MAININFO.* from RES_MAININFO where RESOURCESTATUS = 0 and AUDITSTATUS = 2
    ) b
                                 on a.CATLOGCODE=SUBSTR(b.CATLOGCODE,1, LENGTH(a.CATLOGCODE))
    where parentid = #{parentid,jdbcType=DECIMAL} and b.RESOURCEID is not null order by a.ORDERID
  </select>
 
  <select id="selectResCatalogExistsSon" resultType="java.lang.Integer">
    select PARENTID from RES_CATALOG
    GROUP BY PARENTID
  </select>
 
  <select id="getMuLuTreeDataBySpcStatus" resultMap="BaseResultMap" parameterType="java.util.HashMap">
    select distinct a.CATLOGID,a.CATLOGCODE,a.PARENTID,a.TITLE,a.PINGYINFIIRST,a.IMGURL,a.ORDERID,a.CREATEUSER,a.CREATEDATE,a.ICON
    from RES_CATALOG a left join ( select RES_MAININFO.* from RES_MAININFO where RESOURCESTATUS = 0 and AUDITSTATUS = 2 and SPC_STATUS=1 ) b
                                 on a.CATLOGCODE=SUBSTR(b.CATLOGCODE,1, LENGTH(a.CATLOGCODE))
    where parentid = #{parentid,jdbcType=DECIMAL} and b.RESOURCEID is not null order by a.ORDERID
  </select>
</mapper>