<?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>
|