<?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_ApplyRecommendMapper">
|
<resultMap id="BaseResultMap" type="com.landtool.lanbase.modules.res.entity.Res_ApplyRecommend">
|
<id column="APPID" property="appid" jdbcType="DECIMAL"/>
|
<result column="RESOURCEID" property="resourceid" jdbcType="DECIMAL"/>
|
<result column="APPUSERID" property="appuserid" jdbcType="OTHER"/>
|
<result column="APPUNITID" property="appunitid" jdbcType="OTHER"/>
|
<result column="APPTYPE" property="apptype" jdbcType="DECIMAL"/>
|
<result column="APPREASON" property="appreason" jdbcType="OTHER"/>
|
<result column="APPDATE" property="appdate" jdbcType="TIMESTAMP"/>
|
<result column="AUDITUSERID" property="audituserid" jdbcType="DECIMAL"/>
|
<result column="AUDITTIME" property="audittime" jdbcType="TIMESTAMP"/>
|
<result column="AUDITOPINION" property="auditopinion" jdbcType="OTHER"/>
|
<result column="AUDITRESULT" property="auditresult" jdbcType="DECIMAL"/>
|
<result column="RESUSETYPE" property="resusetype" jdbcType="OTHER"/>
|
<result column="OFFLINEURL" property="offlineurl" jdbcType="OTHER"/>
|
<result column="EFFENDTIME" property="effendtime" jdbcType="TIMESTAMP"/>
|
<result column="ISRECOMMEND" property="isrecommend" jdbcType="DECIMAL"/>
|
<result column="SYSID" property="sysid" jdbcType="DECIMAL"/>
|
</resultMap>
|
<sql id="Base_Column_List">
|
APPID, ra.RESOURCEID, APPUSERID, APPUNITID, APPTYPE, APPREASON, APPDATE, AUDITUSERID,
|
AUDITTIME, AUDITOPINION, AUDITRESULT, RESUSETYPE, OFFLINEURL, EFFENDTIME, ISRECOMMEND, SYSID
|
</sql>
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
|
select
|
<include refid="Base_Column_List"/>,b.title
|
from RES_APPLYRECOMMEND ra
|
left join RES_MAININFO b on RES_APPLYRECOMMEND.RESOURCEID = b.RESOURCEID
|
where APPID = #{appid,jdbcType=DECIMAL}
|
</select>
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
delete from RES_APPLYRECOMMEND
|
where APPID = #{appid,jdbcType=DECIMAL}
|
</delete>
|
<insert id="insert" parameterType="com.landtool.lanbase.modules.res.entity.Res_ApplyRecommend">
|
insert into RES_APPLYRECOMMEND (APPID, RESOURCEID, APPUSERID,
|
APPUNITID, APPTYPE, APPREASON,
|
APPDATE, AUDITUSERID, AUDITTIME,
|
AUDITOPINION, AUDITRESULT, RESUSETYPE,
|
OFFLINEURL, EFFENDTIME, ISRECOMMEND, SYSID
|
)
|
values (#{appid,jdbcType=DECIMAL}, #{resourceid,jdbcType=DECIMAL}, #{appuserid,jdbcType=OTHER},
|
#{appunitid,jdbcType=OTHER}, #{apptype,jdbcType=DECIMAL}, #{appreason,jdbcType=OTHER},
|
#{appdate,jdbcType=TIMESTAMP}, #{audituserid,jdbcType=DECIMAL}, #{audittime,jdbcType=TIMESTAMP},
|
#{auditopinion,jdbcType=OTHER}, #{auditresult,jdbcType=DECIMAL}, #{resusetype,jdbcType=OTHER},
|
#{offlineurl,jdbcType=OTHER}, #{effendtime,jdbcType=TIMESTAMP}, #{isrecommend,jdbcType=DECIMAL},
|
#{sysid,jdbcType=DECIMAL}
|
)
|
</insert>
|
<insert id="insertSelective" parameterType="com.landtool.lanbase.modules.res.entity.Res_ApplyRecommend">
|
insert into RES_APPLYRECOMMEND
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="appid != null">
|
APPID,
|
</if>
|
<if test="resourceid != null">
|
RESOURCEID,
|
</if>
|
<if test="appuserid != null">
|
APPUSERID,
|
</if>
|
<if test="appunitid != null">
|
APPUNITID,
|
</if>
|
<if test="apptype != null">
|
APPTYPE,
|
</if>
|
<if test="appreason != null">
|
APPREASON,
|
</if>
|
<if test="appdate != null">
|
APPDATE,
|
</if>
|
<if test="audituserid != null">
|
AUDITUSERID,
|
</if>
|
<if test="audittime != null">
|
AUDITTIME,
|
</if>
|
<if test="auditopinion != null">
|
AUDITOPINION,
|
</if>
|
<if test="auditresult != null">
|
AUDITRESULT,
|
</if>
|
<if test="resusetype != null">
|
RESUSETYPE,
|
</if>
|
<if test="offlineurl != null">
|
OFFLINEURL,
|
</if>
|
<if test="effendtime != null">
|
EFFENDTIME,
|
</if>
|
<if test="isrecommend != null">
|
ISRECOMMEND,
|
</if>
|
<if test="sysid != null">
|
SYSID,
|
</if>
|
<if test="sysName != null">
|
SYS_NAME,
|
</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="appid != null">
|
#{appid,jdbcType=DECIMAL},
|
</if>
|
<if test="resourceid != null">
|
#{resourceid,jdbcType=DECIMAL},
|
</if>
|
<if test="appuserid != null">
|
#{appuserid,jdbcType=OTHER},
|
</if>
|
<if test="appunitid != null">
|
#{appunitid,jdbcType=OTHER},
|
</if>
|
<if test="apptype != null">
|
#{apptype,jdbcType=DECIMAL},
|
</if>
|
<if test="appreason != null">
|
#{appreason,jdbcType=OTHER},
|
</if>
|
<if test="appdate != null">
|
#{appdate,jdbcType=TIMESTAMP},
|
</if>
|
<if test="audituserid != null">
|
#{audituserid,jdbcType=DECIMAL},
|
</if>
|
<if test="audittime != null">
|
#{audittime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="auditopinion != null">
|
#{auditopinion,jdbcType=OTHER},
|
</if>
|
<if test="auditresult != null">
|
#{auditresult,jdbcType=DECIMAL},
|
</if>
|
<if test="resusetype != null">
|
#{resusetype,jdbcType=OTHER},
|
</if>
|
<if test="offlineurl != null">
|
#{offlineurl,jdbcType=OTHER},
|
</if>
|
<if test="effendtime != null">
|
#{effendtime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="isrecommend != null">
|
#{isrecommend,jdbcType=DECIMAL},
|
</if>
|
<if test="sysid != null">
|
#{sysid,jdbcType=DECIMAL},
|
</if>
|
<if test="sysName != null">
|
#{sysName,jdbcType=OTHER},
|
</if>
|
</trim>
|
</insert>
|
<update id="updateByPrimaryKeySelective" parameterType="com.landtool.lanbase.modules.res.entity.Res_ApplyRecommend">
|
update RES_APPLYRECOMMEND
|
<set>
|
<if test="resourceid != null">
|
RESOURCEID = #{resourceid,jdbcType=DECIMAL},
|
</if>
|
<if test="appuserid != null">
|
APPUSERID = #{appuserid,jdbcType=OTHER},
|
</if>
|
<if test="appunitid != null">
|
APPUNITID = #{appunitid,jdbcType=OTHER},
|
</if>
|
<if test="apptype != null">
|
APPTYPE = #{apptype,jdbcType=DECIMAL},
|
</if>
|
<if test="appreason != null">
|
APPREASON = #{appreason,jdbcType=OTHER},
|
</if>
|
<if test="appdate != null">
|
APPDATE = #{appdate,jdbcType=TIMESTAMP},
|
</if>
|
<if test="audituserid != null">
|
AUDITUSERID = #{audituserid,jdbcType=DECIMAL},
|
</if>
|
<if test="audittime != null">
|
AUDITTIME = #{audittime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="auditopinion != null">
|
AUDITOPINION = #{auditopinion,jdbcType=OTHER},
|
</if>
|
<if test="auditresult != null">
|
AUDITRESULT = #{auditresult,jdbcType=DECIMAL},
|
</if>
|
<if test="resusetype != null">
|
RESUSETYPE = #{resusetype,jdbcType=OTHER},
|
</if>
|
<if test="offlineurl != null">
|
OFFLINEURL = #{offlineurl,jdbcType=OTHER},
|
</if>
|
<if test="effendtime != null">
|
EFFENDTIME = #{effendtime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="isrecommend != null">
|
ISRECOMMEND = #{isrecommend,jdbcType=DECIMAL},
|
</if>
|
<if test="sysid != null">
|
SYSID = #{sysid,jdbcType=DECIMAL},
|
</if>
|
</set>
|
where APPID = #{appid,jdbcType=DECIMAL}
|
</update>
|
<update id="updateByPrimaryKey" parameterType="com.landtool.lanbase.modules.res.entity.Res_ApplyRecommend">
|
update RES_APPLYRECOMMEND
|
set RESOURCEID = #{resourceid,jdbcType=DECIMAL},
|
APPUSERID = #{appuserid,jdbcType=OTHER},
|
APPUNITID = #{appunitid,jdbcType=OTHER},
|
APPTYPE = #{apptype,jdbcType=DECIMAL},
|
APPREASON = #{appreason,jdbcType=OTHER},
|
APPDATE = #{appdate,jdbcType=TIMESTAMP},
|
AUDITUSERID = #{audituserid,jdbcType=DECIMAL},
|
AUDITTIME = #{audittime,jdbcType=TIMESTAMP},
|
AUDITOPINION = #{auditopinion,jdbcType=OTHER},
|
AUDITRESULT = #{auditresult,jdbcType=DECIMAL},
|
RESUSETYPE = #{resusetype,jdbcType=OTHER},
|
OFFLINEURL = #{offlineurl,jdbcType=OTHER},
|
EFFENDTIME = #{effendtime,jdbcType=TIMESTAMP},
|
ISRECOMMEND = #{isrecommend,jdbcType=DECIMAL},
|
SYSID = #{sysid,jdbcType=DECIMAL}
|
where APPID = #{appid,jdbcType=DECIMAL}
|
</update>
|
<select id="shenQingZiYuan" parameterType="com.landtool.lanbase.modules.res.entity.Res_ApplyRecommend"
|
resultType="com.landtool.lanbase.modules.res.entity.UserDefined.MainInfoJoinApplyRecommend">
|
|
WITH tab as(
|
SELECT row_number() over(ORDER BY b.APPDATE DESC) rn, a.RESOURCEID, a.TITLE, a.RESOURCECLASS, b.AUDITOPINION, b.AUDITRESULT, b.AUDITTIME,b.appid from RES_MAININFO a left join RES_APPLYRECOMMEND b on(a.resourceid=b.resourceid)
|
where APPUSERID = #{appuserid,jdbcType=INTEGER} and RESOURCESTATUS=0
|
<!--我的申请只显示自己申请的个人申请部分 alert ykm 2018/12/25-->
|
and apptype = 0 and ISRECOMMEND = 0
|
)
|
|
SELECT * from tab where <![CDATA[ rn <= 10 ]]>
|
</select>
|
|
<select id="selectResApplyreCommend" parameterType="com.landtool.lanbase.modules.res.entity.Res_ApplyRecommend"
|
resultType="com.landtool.lanbase.modules.res.entity.UserDefined.MainInfoJoinApplyRecommendInfo">
|
select * from (
|
select
|
a.APPID,a.RESOURCEID,d.CREATEUSERID,d.INSTEADAUDIT,d.TITLE,d.KEYWORDS,APPTYPE,APPDATE,APPUSERID,AUDITUSERID,a.AUDITRESULT,applycount,
|
case when replycount > 0 then replycount else 0 end as replycount,a.sysId,
|
date_part('day',(a.EFFENDTIME - a.APPDATE)) as appDays,
|
a.sys_name from RES_APPLYRECOMMEND a
|
left join (select RESOURCEID,COUNT(*) as applycount from RES_APPLYRECOMMEND group by RESOURCEID)b
|
on a.RESOURCEID = b.RESOURCEID
|
left join (select RESOURCEID,COUNT(*) as replycount from RES_APPLYRECOMMEND where AUDITRESULT=1 group by
|
RESOURCEID)c
|
on a.RESOURCEID = c.RESOURCEID
|
left join RES_MAININFO d on a.RESOURCEID = d.RESOURCEID
|
<where>
|
RESOURCESTATUS = 0 and ISRECOMMEND = 0
|
<if test="title!=null and title != '' ">
|
and (d.TITLE like ('%' || #{title} || '%') OR replace(KEYWORDS,',','') like ('%' || #{title} || '%'))
|
</if>
|
<if test="auditresult !=null and auditresult != 3">
|
and AUDITRESULT= #{auditresult}
|
</if>
|
<if test="auditresult == 3">
|
and AUDITRESULT != 0
|
</if>
|
<if test="isaudit == 0 and ExistPermission ==null"> <!--有权限批复,即当前用户是发布人且为管理员 或者是委托批复-->
|
and (CREATEUSERID = #{createuserid} or INSTEADAUDIT = 1)
|
</if>
|
<if test="isaudit == 1 and ExistPermission ==null"> <!--无权限批复,即当前用户不是发布人且为管理员 且不为委托批复资源-->
|
and CREATEUSERID != #{createuserid} and (INSTEADAUDIT != 1 or INSTEADAUDIT is null)
|
</if>
|
<if test="apptype !=null">
|
and APPTYPE=#{apptype}
|
</if>
|
<if test="ExistPermission !=null">
|
and CREATEUSERID=#{ExistPermission}
|
</if>
|
<if test="appdateBeg != null and appdateBeg != '' ">
|
<![CDATA[ and APPDATE >= to_timestamp(#{appdateBeg} || ' 00:00:00','yyyy-mm-dd hh24:mi:ss') ]]>
|
</if>
|
<if test="appdateEnd != null and appdateEnd != '' ">
|
<![CDATA[ and APPDATE <= to_timestamp(#{appdateEnd} || ' 23:59:59','yyyy-mm-dd hh24:mi:ss') ]]>
|
</if>
|
</where>
|
) tmp order by APPDATE DESC
|
</select>
|
|
<select id="selectResApplyreCommendCount" parameterType="com.landtool.lanbase.modules.res.entity.Res_ApplyRecommend"
|
resultType="java.lang.Integer">
|
select count(*) from RES_APPLYRECOMMEND a
|
left join (select RESOURCEID,COUNT(*) as applycount from RES_APPLYRECOMMEND group by RESOURCEID)b on
|
a.RESOURCEID = b.RESOURCEID
|
left join (select RESOURCEID,COUNT(*) as replycount from RES_APPLYRECOMMEND where AUDITRESULT=1 group by
|
RESOURCEID)c on a.RESOURCEID = c.RESOURCEID
|
left join RES_MAININFO d on a.RESOURCEID = d.RESOURCEID
|
<where>
|
RESOURCESTATUS = 0 and ISRECOMMEND = 0
|
<if test="title!=null and title != '' ">
|
and (d.TITLE like ('%' || #{title} || '%') OR replace(KEYWORDS,',','') like ('%' || #{title} || '%'))
|
</if>
|
<if test="auditresult !=null and auditresult != 3">
|
and AUDITRESULT= #{auditresult}
|
</if>
|
<if test="auditresult == 3">
|
and AUDITRESULT != 0
|
</if>
|
<if test="apptype !=null">
|
and APPTYPE=#{apptype}
|
</if>
|
<if test="appdateBeg != null and appdateBeg != '' ">
|
<![CDATA[ and APPDATE >= to_timestamp(#{appdateBeg} || ' 00:00:00','yyyy-mm-dd hh24:mi:ss') ]]>
|
</if>
|
<if test="appdateEnd != null and appdateEnd != '' ">
|
<![CDATA[ and APPDATE <= to_timestamp(#{appdateEnd} || ' 23:59:59','yyyy-mm-dd hh24:mi:ss') ]]>
|
</if>
|
</where>
|
</select>
|
<update id="updateResApplyreCommendResult"
|
parameterType="com.landtool.lanbase.modules.res.entity.Res_ApplyRecommend">
|
update RES_APPLYRECOMMEND
|
set
|
AUDITUSERID = #{audituserid,jdbcType=DECIMAL},
|
AUDITTIME = #{audittime,jdbcType=TIMESTAMP},
|
AUDITOPINION = #{auditopinion,jdbcType=OTHER},
|
AUDITRESULT = #{auditresult,jdbcType=DECIMAL}
|
where APPID = #{appid,jdbcType=DECIMAL}
|
</update>
|
<select id="selectByResApplyRecommend" resultMap="BaseResultMap"
|
parameterType="com.landtool.lanbase.modules.res.entity.Res_ApplyRecommend">
|
select
|
<include refid="Base_Column_List"/>
|
from RES_APPLYRECOMMEND ra
|
<where>
|
isRecommend=0
|
<if test="appuserid!=null and appuserid!=''">
|
and appuserid=#{appuserid,jdbcType=DECIMAL}
|
</if>
|
<if test="resourceid!=null and resourceid!=''">
|
and resourceid=#{resourceid,jdbcType=DECIMAL}
|
</if>
|
<if test="apptype!=null and apptype!=''">
|
and apptype=#{apptype,jdbcType=OTHER}
|
</if>
|
</where>
|
</select>
|
<select id="selectResMainInfoShenQingZiYuan"
|
parameterType="com.landtool.lanbase.modules.res.entity.Res_ApplyRecommend"
|
resultType="com.landtool.lanbase.modules.res.entity.UserDefined.MainInfoJoinApplyRecommend">
|
select a.RESOURCEID, a.TITLE, a.ABBREVIATION, a.RESOURCECLASS, a.PUBUNITID, a.PUBDATE,b.APPDATE,b.AUDITOPINION,
|
b.AUDITRESULT, b.AUDITTIME, b.APPID
|
from RES_MAININFO a inner join RES_APPLYRECOMMEND b on(a.resourceid=b.resourceid)
|
<where>
|
and APPUSERID = #{appuserid,jdbcType=OTHER}
|
<!--我的申请只显示自己申请的个人申请部分 alert ykm 2018/12/25-->
|
and ISRECOMMEND = 0
|
<if test="title!=null and title != '' ">
|
and (TITLE like '%'||#{title}||'%' OR replace(KEYWORDS,',','') like '%'||#{title}||'%' OR ABBREVIATION like
|
'%'||#{title}||'%')
|
</if>
|
<if test="resourceclass !=null and resourceclass != '' ">
|
<!--and resourceclass=#{resourceclass,jdbcType=OTHER}-->
|
and (resourceclass like #{resourceclass} || '%' )
|
</if>
|
<if test="auditresult !=null and (auditresult==0 ? '0' : auditresult) ">
|
and auditresult = #{auditresult}
|
</if>
|
<if test="pubdateBegin!=null and pubdateBegin != '' ">
|
and APPDATE >= to_timestamp(#{pubdateBegin} || ' 00:00:00','yyyy-mm-dd hh24:mi:ss')
|
</if>
|
<if test="pubdatefinish!=null and pubdatefinish != '' ">
|
<![CDATA[ and APPDATE <= to_timestamp(#{pubdatefinish} || ' 23:59:59','yyyy-mm-dd hh24:mi:ss') ]]>
|
</if>
|
</where>
|
order by b.appdate desc
|
</select>
|
<select id="getTopRecommend" parameterType="com.landtool.lanbase.modules.res.entity.Res_ApplyRecommend" resultType="com.landtool.lanbase.modules.res.entity.Res_MainInfo">
|
select a.*
|
from RES_MAININFO a
|
left join RES_APPLYRECOMMEND b on a.RESOURCEID=b.RESOURCEID
|
where a.RESOURCESTATUS=0
|
and a.AUDITSTATUS=2
|
and b.ISRECOMMEND=1
|
and (
|
(cast(b.APPUSERID as numeric)=#{appuserid} and b.APPTYPE=0)
|
<if test="appunitid !=null and (appunitid==0 ? '0' : appunitid)">
|
or (cast(b.APPUNITID as numeric)=#{appunitid} and b.APPTYPE=1)
|
</if>
|
)
|
<if test="isDiTuFuwu != '' and isDiTuFuwu != null">
|
and a.RESOURCECLASS in ( ${isDiTuFuwu} )
|
</if>
|
order by b.APPDATE desc
|
</select>
|
<select id="getAllRecommend" parameterType="com.landtool.lanbase.modules.res.entity.Res_ApplyRecommend" resultType="com.landtool.lanbase.modules.res.entity.Res_MainInfo">
|
select a.*
|
from RES_MAININFO a
|
left join RES_APPLYRECOMMEND b on a.RESOURCEID=b.RESOURCEID
|
where a.RESOURCESTATUS=0
|
and a.AUDITSTATUS=2
|
and b.ISRECOMMEND=1
|
and (
|
(b.APPUSERID=cast(#{appuserid} as char) and b.APPTYPE=0)
|
<if test="appunitid !=null and (appunitid==0 ? '0' : appunitid)">
|
or (b.APPUNITID=cast(#{appunitid} as char) and b.APPTYPE=1)
|
</if>
|
)
|
<if test="isDiTuFuwu != '' and isDiTuFuwu != null">
|
and a.RESOURCECLASS in ( ${isDiTuFuwu} )
|
</if>
|
<if test="title!=null and title != '' ">
|
and (a.TITLE like '%'||#{title}||'%' OR replace(a.KEYWORDS,',','') like '%'||#{title}||'%' OR a.ABBREVIATION like '%'||#{title}||'%')
|
</if>
|
<if test="resourceclass !=null and resourceclass != '' ">
|
<!--and resourceclass=#{resourceclass,jdbcType=OTHER}-->
|
and (a.resourceclass like #{resourceclass} || '%' )
|
</if>
|
<if test="pubdateBegin!=null and pubdateBegin != '' ">
|
and PUBDATE >= to_timestamp(#{pubdateBegin} || ' 00:00:00','yyyy-mm-dd hh24:mi:ss')
|
</if>
|
<if test="pubdatefinish!=null and pubdatefinish != '' ">
|
<![CDATA[ and PUBDATE <= to_timestamp(#{pubdatefinish} || ' 23:59:59','yyyy-mm-dd hh24:mi:ss') ]]>
|
</if>
|
order by b.APPDATE desc
|
</select>
|
<select id="getRecommendListByResourceid" parameterType="com.landtool.lanbase.modules.res.entity.Res_ApplyRecommend" resultType="com.landtool.lanbase.modules.res.entity.Res_ApplyRecommend">
|
select *
|
from RES_APPLYRECOMMEND
|
where RESOURCEID=#{resourceid}
|
and ISRECOMMEND=1
|
<if test="apptype != null and (apptype == 0 ? '0' : apptype)">
|
and APPTYPE = #{apptype}
|
</if>
|
</select>
|
<!--add: Xxx 新增获取资源申请数量统计-->
|
<select id="getApplyCount" parameterType="java.lang.Integer" resultType="java.lang.Integer">
|
select COUNT(*) from RES_APPLYRECOMMEND
|
where RESOURCEID=#{resourceid} and ISRECOMMEND=0
|
</select>
|
<select id="checkZiYuanShenQing" resultType="com.landtool.lanbase.modules.res.entity.Res_ApplyRecommend">
|
select * from RES_APPLYRECOMMEND
|
where RESOURCEID = #{resourceid} and ISRECOMMEND = 0
|
and ((APPTYPE = 0 and APPUSERID = #{userid}) or (APPTYPE = 1 and APPUNITID = #{unitid}))
|
</select>
|
<select id="selectCountByResourceid" resultType="java.lang.Integer" parameterType="java.lang.Integer">
|
select count(*) from RES_APPLYRECOMMEND
|
where resourceid = #{resourceid,jdbcType=DECIMAL}
|
</select>
|
<delete id="deleteByResourceid" parameterType="java.lang.Integer">
|
delete from RES_APPLYRECOMMEND
|
where resourceid = #{resourceid,jdbcType=DECIMAL}
|
</delete>
|
<select id="selectByResourceidAndUserid" parameterType="com.landtool.lanbase.modules.res.entity.Res_ApplyRecommend" resultType="com.landtool.lanbase.modules.res.entity.Res_ApplyRecommend">
|
select *
|
from RES_APPLYRECOMMEND
|
where resourceid = #{resourceid,jdbcType=DECIMAL} and APPUSERID = #{appuserid}
|
</select>
|
<select id="selectResMainInfoBySysid" parameterType="com.landtool.lanbase.modules.res.entity.UserDefined.MainInfoJoinApplyRecommend" resultType="com.landtool.lanbase.modules.res.entity.UserDefined.MainInfoJoinApplyRecommend">
|
select b.*,a.auditresult,a.appdate,appuserid from RES_APPLYRECOMMEND a left join RES_MAININFO b on a.RESOURCEID = b.RESOURCEID
|
<where>
|
a.APPTYPE = 3 and a.SYSID = #{sysid} and RESOURCESTATUS = 0
|
<if test="title!=null and title != '' ">
|
and (b.TITLE like ('%' || #{title} || '%') OR replace(KEYWORDS,',','') like ('%' || #{title} || '%') OR b.ABBREVIATION like '%'||#{title}||'%')
|
</if>
|
<if test="auditresult !=null and auditresult != ''">
|
and auditresult = #{auditresult}
|
</if>
|
<if test="resourceclass !=null and resourceclass != '' ">
|
and (resourceclass like #{resourceclass} || '%' )
|
</if>
|
<if test="appdateBeg != null and appdateBeg != '' ">
|
<![CDATA[ and APPDATE >= to_timestamp(#{appdateBeg} || ' 00:00:00','yyyy-mm-dd hh24:mi:ss') ]]>
|
</if>
|
<if test="appdateEnd != null and appdateEnd != '' ">
|
<![CDATA[ and APPDATE <= to_timestamp(#{appdateEnd} || ' 23:59:59','yyyy-mm-dd hh24:mi:ss') ]]>
|
</if>
|
</where>
|
order by b.CREATEDATE desc
|
</select>
|
<select id="checkAppZiYuan" resultType="java.lang.Integer">
|
SELECT COUNT(*) FROM RES_APPLYRECOMMEND
|
where APPTYPE=3 and RESOURCEID=#{resourceid} and SYSID=#{sysid} and AUDITRESULT=1
|
</select>
|
|
<select id="selectCatalog" 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.sharprotocol != '完全公开'
|
and a.RESOURCEID not in
|
(select RESOURCEID from RES_APPLYRECOMMEND where APPTYPE = 3 and SYSID = #{sysid} and (EFFENDTIME >= to_timestamp(to_char(now(),'yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd hh24:mi:ss') or EFFENDTIME is null)and AUDITRESULT != 2)
|
group by CATLOGCODE
|
) c on b.CATLOGCODE = substr(c.CATLOGCODE, 1, LENGTH(b.CATLOGCODE))
|
where parentid = #{parentid} and c.CATLOGCODE is not null
|
order by ORDERID
|
</select>
|
|
<select id="selectCatalogZiYuanList" resultType="com.landtool.lanbase.modules.res.entity.Res_MainInfo">
|
select distinct a.RESOURCEID,a.CATLOGID, a.TITLE,
|
a.ABBREVIATION, a.PINGYINFIIRST, a.CATLOGCODE,
|
a.KEYWORDS, a.DESURL,
|
a.IMGURL, a.RESOURCECLASS,
|
a.DATASOURCES, a.PRODUCTIONTIME,
|
a.UPDATETIMES, a.PUBDATE, a.PUBUNITID,
|
a.CREATEUSERID, a.ADMINISTRATIVEID, a.SECURITYLEV,
|
a.SHARPROTOCOL, a.ESPPROXY, a.USERNAME,
|
a.PASSWORD, a.RESOURCESTATUS,
|
a.AUDITSTATUS, a.DISPLAYBY2D, a.DISPLAYBY3D,
|
a.ORDERID from RES_MAININFO a
|
where 1 = 1
|
and a.AUDITSTATUS = 2
|
and a.RESOURCESTATUS = 0
|
and a.sharprotocol != '完全公开'
|
and a.RESOURCEID not in
|
(select RESOURCEID from RES_APPLYRECOMMEND where APPTYPE = 3 and SYSID = #{sysid} and (EFFENDTIME >= to_timestamp(to_char(now(),'yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd hh24:mi:ss') or EFFENDTIME is null)and AUDITRESULT != 2)
|
<if test="parentid != null and (parentid==0 ? '0' : parentid)">
|
and a.CATLOGID = #{parentid,jdbcType=DECIMAL}
|
</if>
|
order by a.ORDERID
|
</select>
|
|
<select id="getResourceList" resultType="com.landtool.lanbase.modules.res.entity.Res_MainInfo">
|
select b.* from RES_APPLYRECOMMEND a LEFT JOIN RES_MAININFO b on a.RESOURCEID = b.RESOURCEID where APPTYPE = 3 and AUDITRESULT = 1 and (EFFENDTIME is null or EFFENDTIME >= to_timestamp(to_char(now(),'yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd hh24:mi:ss'))
|
and RESOURCESTATUS = 0
|
<if test="sysid != null">
|
and SYSID = #{sysid}
|
</if>
|
</select>
|
|
<select id="selectResApplyreCommendForSys" parameterType="com.landtool.lanbase.modules.res.entity.Res_ApplyRecommend"
|
resultType="com.landtool.lanbase.modules.res.entity.UserDefined.MainInfoJoinApplyRecommendInfo">
|
|
</select>
|
|
<select id="getApplyDate" resultType="com.landtool.lanbase.modules.res.entity.Res_ApplyRecommend">
|
select *
|
from (
|
select date_part('day',(ra.EFFENDTIME - ra.APPDATE)) as appDays,ra.*
|
from RES_APPLYRECOMMEND ra
|
where RESOURCEID = #{resourceid}
|
and APPUSERID = #{userid}
|
and AUDITRESULT = 1
|
order by APPDATE desc
|
) TEMP limit 1
|
</select>
|
</mapper>
|