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
<?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_ThemeMapper">
  <resultMap id="BaseResultMap" type="com.landtool.lanbase.modules.res.entity.Res_Theme">
    <result column="THEMEID" jdbcType="INTEGER" property="themeid" />
    <result column="TITLE" jdbcType="VARCHAR" property="title" />
    <result column="CONTENT" jdbcType="VARCHAR" property="content" />
    <result column="ADDUSERID" jdbcType="INTEGER" property="adduserid" />
    <result column="ADDTIME" jdbcType="TIMESTAMP" property="addtime" />
    <result column="ORDERINDEX" jdbcType="INTEGER" property="orderindex" />
    <result column="ISDEFAULT" jdbcType="TINYINT" property="isdefault" />
    <result column="RESOURCEID" jdbcType="INTEGER" property="resourceid" />
    <result column="ISONEMAP" jdbcType="TINYINT" property="isonemap" />
    <result column="ORDERID" jdbcType="INTEGER" property="orderid" />
  </resultMap>
  <insert id="insert" parameterType="com.landtool.lanbase.modules.res.entity.Res_Theme">
    insert into RES_THEME (THEMEID, TITLE, CONTENT,
      ADDUSERID, ADDTIME, ORDERINDEX, 
      ISDEFAULT,RESOURCEID,ISONEMAP,ORDERID)
    values (#{themeid,jdbcType=INTEGER}, #{title,jdbcType=VARCHAR}, #{content,jdbcType=VARCHAR}, 
      #{adduserid,jdbcType=INTEGER}, #{addtime,jdbcType=TIMESTAMP}, #{orderindex,jdbcType=INTEGER}, 
      #{isdefault,jdbcType=TINYINT},#{resourceid,jdbcType=INTEGER},#{isonemap,jdbcType=TINYINT},#{orderid,jdbcType=INTEGER})
  </insert>
  <insert id="insertSelective" parameterType="com.landtool.lanbase.modules.res.entity.Res_Theme">
    <selectKey keyProperty="themeid" resultType="java.lang.Integer" order="BEFORE">
      select  NEXTVAL('RES_THEME_INS_SEQ') from dual
    </selectKey>
    insert into RES_THEME
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="themeid != null">
        THEMEID,
      </if>
      <if test="title != null">
        TITLE,
      </if>
      <if test="content != null">
        CONTENT,
      </if>
      <if test="adduserid != null">
        ADDUSERID,
      </if>
      <if test="addtime != null">
        ADDTIME,
      </if>
      <if test="orderindex != null">
        ORDERINDEX,
      </if>
      <if test="isdefault != null">
        ISDEFAULT,
      </if>
      <if test="resourceid != null">
        RESOURCEID,
      </if>
      <if test="isonemap != null">
        ISONEMAP,
      </if>
      <if test="orderid != null">
        ORDERID,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="themeid != null">
        #{themeid,jdbcType=INTEGER},
      </if>
      <if test="title != null">
        #{title,jdbcType=VARCHAR},
      </if>
      <if test="content != null">
        #{content,jdbcType=VARCHAR},
      </if>
      <if test="adduserid != null">
        #{adduserid,jdbcType=INTEGER},
      </if>
      <if test="addtime != null">
        #{addtime,jdbcType=TIMESTAMP},
      </if>
      <if test="orderindex != null">
        #{orderindex,jdbcType=INTEGER},
      </if>
      <if test="isdefault != null">
        #{isdefault,jdbcType=TINYINT},
      </if>
      <if test="resourceid != null">
        #{resourceid,jdbcType=INTEGER},
      </if>
      <if test="isonemap != null">
        #{isonemap,jdbcType=TINYINT},
      </if>
      <if test="orderid != null">
        #{orderid,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
 
  <select id="selectResTheme" parameterType="com.landtool.lanbase.modules.res.entity.Res_Theme" resultType="com.landtool.lanbase.modules.res.entity.Res_Theme">
    SELECT * from RES_THEME
    <where>
      <if test="title!=null and title != '' ">
        and (TITLE like '%'||#{title}||'%')
      </if>
      <if test="pubdateBegin!=null and pubdateBegin != '' ">
        and ADDTIME >= to_timestamp(#{pubdateBegin} || ' 00:00:00','yyyy-mm-dd hh24:mi:ss')
      </if>
      <if test="pubdatefinish!=null and pubdatefinish != '' ">
        <![CDATA[ and ADDTIME <= to_timestamp(#{pubdatefinish} || ' 23:59:59','yyyy-mm-dd hh24:mi:ss') ]]>
      </if>
      <if test="isonemap!=null and isonemap != '' and isonemap==1">
      and (ISONEMAP =1)
    </if>
      <if test="isonemap!=null and isonemap != '' and isonemap==3">
        and (ISDEFAULT =1)
      </if>
    </where>
    <if test="sort!=null and sort != '' ">
      order by ${sort} ${dir}
    </if>
    <if test="sort==null">
      order by orderid asc,ADDTIME desc
    </if>
  </select>
 
  <select id="selectByThemeId" parameterType="java.lang.Integer" resultType="com.landtool.lanbase.modules.res.entity.Res_Theme">
    SELECT * from RES_THEME  WHERE themeid = #{themeid,jdbcType=INTEGER}
  </select>
 
  <update id="updateById" parameterType="com.landtool.lanbase.modules.res.entity.Res_Theme">
    UPDATE RES_THEME
    <set>
      <if test="title != null">
        TITLE =  #{title,jdbcType=VARCHAR},
      </if>
      <if test="content != null">
        CONTENT =  #{content,jdbcType=VARCHAR},
      </if>
      <if test="adduserid != null">
        ADDUSERID =  #{adduserid,jdbcType=INTEGER},
      </if>
      <if test="addtime != null">
        ADDTIME =  #{addtime,jdbcType=TIMESTAMP},
      </if>
      <if test="orderindex != null">
        ORDERINDEX =  #{orderindex,jdbcType=INTEGER},
      </if>
      <if test="isdefault != null">
        ISDEFAULT =  #{isdefault,jdbcType=TINYINT},
      </if>
      <if test="resourceid != null">
        RESOURCEID = #{resourceid,jdbcType=INTEGER},
      </if>
      <if test="isonemap != null">
        ISONEMAP = #{isonemap,jdbcType=TINYINT},
      </if>
      <if test="orderid != null">
        ORDERID = #{orderid,jdbcType=INTEGER}
      </if>
    </set>
    WHERE THEMEID = #{themeid,jdbcType=INTEGER}
  </update>
 
  <delete id="deleteById" parameterType="java.lang.Integer">
    DELETE FROM RES_THEME WHERE THEMEID = #{themeid,jdbcType=INTEGER}
  </delete>
  
  <select id="getDefaultThemeList" parameterType="java.lang.Integer" resultType="com.landtool.lanbase.modules.res.entity.Res_Theme">
    select *
    from RES_THEME
    where ISDEFAULT=1
    order by orderid asc,ADDTIME desc
  </select>
 
  <select id="getAllThemeList" parameterType="java.lang.Integer" resultType="com.landtool.lanbase.modules.res.entity.Res_Theme">
    select *
    from RES_THEME
    order by orderid asc,ADDTIME desc
  </select>
 
  <select id="getAllTheme" resultType="com.landtool.lanbase.modules.res.entity.Res_Theme">
    SELECT * FROM RES_THEME order by orderid asc,ADDTIME desc
  </select>
 
  <select id="selectThemeMapTree" resultType="com.landtool.lanbase.modules.res.entity.Res_MainInfo">
    select distinct  b.RESOURCEID,b.CATLOGID, b.TITLE,
    b.ABBREVIATION, b.PINGYINFIIRST, b.CATLOGCODE,
    b.KEYWORDS, b.DESURL,
    b.IMGURL, b.RESOURCECLASS,
    b.DATASOURCES, b.PRODUCTIONTIME,
    b.UPDATETIMES, b.PUBDATE, b.PUBUNITID,
    b.CREATEUSERID, b.ADMINISTRATIVEID, b.SECURITYLEV,
    b.SHARPROTOCOL, b.ESPPROXY, b.USERNAME,
    b.PASSWORD, b.RESOURCESTATUS,
    b.AUDITSTATUS, b.DISPLAYBY2D, b.DISPLAYBY3D,
    b.ORDERID from RES_EXTTHEMEMAP  a left join RES_MAININFO b on(a.RESOURCEID = b.RESOURCEID)
 
    <where>
      (b.AUDITSTATUS = 2 and b.RESOURCESTATUS = 0 and b.resourceclass = 'KJ_ZTDT' and a.type = '系统制作'
      and (
      b.SHARPROTOCOL = '完全公开'
      or (b.SHARPROTOCOL = '依申请公开' and b.CREATEUSERID = #{userid})
      or (b.SHARPROTOCOL = '单位内公开' and b.PUBUNITID = #{unitid})
      or exists(
      select * from RES_APPLYRECOMMEND c
      where (
      (c.APPTYPE = 0 and APPUSERID = #{userid})
      or (c.APPTYPE = 1 and APPUNITID = #{unitid})
      )
      and (c.EFFENDTIME is null or c.EFFENDTIME >= now())
      and b.RESOURCEID = c.RESOURCEID
      )
      )
      )
      <if test="title!=null and title != '' ">
        and b.TITLE like '%${title}%'
      </if>
      <if test="parentid != null and parentid != ''">
        and b.CATLOGID = #{parentid}
      </if>
      <if test="keyWord != null and keyWord != ''">
        and (b.PINGYINFIIRST like '%'||#{keyWord}||'%' or b.TITLE like '%'||#{keyWord}||'%')
      </if>
    </where>
    order by b.ORDERID
  </select>
 
  <select id="selectThememapNode" resultType="com.landtool.lanbase.modules.res.entity.Res_Catalog">
    SELECT distinct b.CATLOGID,b.CATLOGCODE,b.PARENTID,b.TITLE,b.PINGYINFIIRST,b.IMGURL,b.ORDERID,b.CREATEUSER,b.CREATEDATE,b.ICON FROM RES_CATALOG b LEFT JOIN
    ( select CATLOGCODE from RES_MAININFO a left join RES_EXTTHEMEMAP c on(a.RESOURCEID = c.RESOURCEID)
    WHERE 1=1 and
    (a.AUDITSTATUS = 2 and a.RESOURCESTATUS = 0 and a.resourceclass = 'KJ_ZTDT' and c.type = '系统制作'
    and (
    a.SHARPROTOCOL = '完全公开'
    or (a.SHARPROTOCOL = '依申请公开' and a.CREATEUSERID = #{userid})
    or (a.SHARPROTOCOL = '单位内公开' and a.PUBUNITID = #{unitid})
    or exists(
    select * from RES_APPLYRECOMMEND c
    where (
    (c.APPTYPE = 0 and APPUSERID = #{userid})
    or (c.APPTYPE = 1 and APPUNITID = #{unitid})
    )
    and (c.EFFENDTIME is null or c.EFFENDTIME >= now())
    and a.RESOURCEID = c.RESOURCEID
    )
    )
    )
    <if test="title!=null and title != '' ">
      and a.TITLE like '%${title}%'
    </if>
    group by CATLOGCODE
    ) r on b.CATLOGCODE = substr(r.CATLOGCODE, 1, LENGTH(b.CATLOGCODE))
    where parentid = #{parentid} and r.CATLOGCODE is not null
    order by ORDERID
  </select>
  
  <update id="updateOrderid" parameterType="com.landtool.lanbase.modules.res.entity.Res_Theme">
    update RES_THEME set orderid = #{orderid} where themeid = #{themeid}
  </update>
 
  <select id="getOneMapThemeList" parameterType="java.lang.Integer" resultType="com.landtool.lanbase.modules.res.entity.Res_Theme">
    select *
    from RES_THEME where ISONEMAP = 1
    order by orderid asc,ADDTIME desc
  </select>
 
  <select id="getFirstDefaultThemeByOneMap" parameterType="java.lang.Integer" resultType="com.landtool.lanbase.modules.res.entity.Res_Theme">
 
    with tab as(
    select row_number() over(order by ORDERID asc, ADDTIME desc) rn,a.*
     from RES_THEME a
     where ISDEFAULT=1 and ISONEMAP = 1
     order by orderid asc,ADDTIME desc
    )
 
    SELECT * from tab where rn = 1
  </select>
 
  <select id="selectKongJianFuWuNode" resultType="com.landtool.lanbase.modules.res.entity.Res_Catalog">
    SELECT distinct b.CATLOGID,b.CATLOGCODE,b.PARENTID,b.TITLE,b.PINGYINFIIRST,b.IMGURL,b.ORDERID,b.CREATEUSER,b.CREATEDATE,b.ICON FROM RES_CATALOG b
    LEFT JOIN
    ( select CATLOGCODE from RES_MAININFO a
    WHERE 1=1 and
    (a.AUDITSTATUS = 2 and a.RESOURCESTATUS = 0 and a.resourceclass = #{resourceclass}
    and not EXISTS(select b.RESOURCEID from RES_ONEMAP_CATALOGRESOURCE b where a.RESOURCEID = b.RESOURCEID and b.CATLOGID = #{catlogid} )
    and (
    a.SHARPROTOCOL = '完全公开'
    or (a.SHARPROTOCOL = '依申请公开' and a.CREATEUSERID = #{userid})
    or (a.SHARPROTOCOL = '单位内公开' and a.PUBUNITID = #{unitid})
    or exists(
    select * from RES_APPLYRECOMMEND c
    where (
    (c.APPTYPE = 0 and APPUSERID = #{userid})
    or (c.APPTYPE = 1 and APPUNITID = #{unitid})
    )
    and (c.EFFENDTIME is null or c.EFFENDTIME >= now())
    and a.RESOURCEID = c.RESOURCEID
    )
    )
    )
    <if test="title!=null and title != '' ">
      and a.TITLE like '%${title}%'
    </if>
    group by CATLOGCODE
    ) r on b.CATLOGCODE = substr(r.CATLOGCODE, 1, LENGTH(b.CATLOGCODE))
    where parentid = #{parentid} and r.CATLOGCODE is not null
    order by ORDERID
  </select>
 
  <select id="selectKongJianFuWuTree" resultType="com.landtool.lanbase.modules.res.entity.Res_MainInfo">
    select distinct  b.RESOURCEID,b.CATLOGID, b.TITLE,
    b.ABBREVIATION, b.PINGYINFIIRST, b.CATLOGCODE,
    b.KEYWORDS, b.DESURL,
    b.IMGURL, b.RESOURCECLASS,
    b.DATASOURCES, b.PRODUCTIONTIME,
    b.UPDATETIMES, b.PUBDATE, b.PUBUNITID,
    b.CREATEUSERID, b.ADMINISTRATIVEID, b.SECURITYLEV,
    b.SHARPROTOCOL, b.ESPPROXY, b.USERNAME,
    b.PASSWORD, b.RESOURCESTATUS,
    b.AUDITSTATUS, b.DISPLAYBY2D, b.DISPLAYBY3D,
    b.ORDERID from RES_MAININFO b
    <where>
      (b.AUDITSTATUS = 2 and b.RESOURCESTATUS = 0 and b.resourceclass = #{resourceclass}
      and not EXISTS (select a.RESOURCEID from RES_ONEMAP_CATALOGRESOURCE a where b.RESOURCEID = a.RESOURCEID and a.CATLOGID = #{catlogid} )
      and (
      b.SHARPROTOCOL = '完全公开'
      or (b.SHARPROTOCOL = '依申请公开' and b.CREATEUSERID = #{userid})
      or (b.SHARPROTOCOL = '单位内公开' and b.PUBUNITID = #{unitid})
      or exists(
      select * from RES_APPLYRECOMMEND c
      where (
      (c.APPTYPE = 0 and APPUSERID = #{userid})
      or (c.APPTYPE = 1 and APPUNITID = #{unitid})
      )
      and (c.EFFENDTIME is null or c.EFFENDTIME >= now())
      and b.RESOURCEID = c.RESOURCEID
      )
      )
      )
      <if test="title!=null and title != '' ">
        and b.TITLE like '%${title}%'
      </if>
      <if test="parentid != null and parentid != ''">
        and b.CATLOGID = #{parentid}
      </if>
      <if test="keyWord != null and keyWord != ''">
        and (b.PINGYINFIIRST like '%'||#{keyWord}||'%' or b.TITLE like '%'||#{keyWord}||'%')
      </if>
    </where>
    order by ORDERID
  </select>
</mapper>