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
<?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.DiTuFuWuMapper" >
    <select id="getZuiXinZiYuanGD" parameterType="com.landtool.lanbase.modules.res.entity.Res_MainInfo" resultType="com.landtool.lanbase.modules.res.entity.Res_MainInfo">
 
        select *
        from RES_MAININFO
        where RESOURCESTATUS=0
        and AUDITSTATUS=2
        <if test="isDiTuFuwu != '' and isDiTuFuwu != null">
            and RESOURCECLASS in ( ${isDiTuFuwu} )
        </if>
        <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 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 PUBDATE desc
    </select>
 
    <select id="getWoDeZiYuan" 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 from RES_MAININFO a
        left join RES_APPLYRECOMMEND b on(a.resourceid=b.resourceid)
        where APPUSERID = ${appuserid} and RESOURCESTATUS=0
        <!--我的申请只显示自己申请的个人申请部分 alert ykm 2018/12/25-->
        and apptype = 0 AND ISRECOMMEND = 0
        <if test="isDiTuFuwu != '' and isDiTuFuwu != null">
            and RESOURCECLASS in ( ${isDiTuFuwu} )
        </if>
        )
        SELECT * FROM tab WHERE <![CDATA[ rn <= ${num} ]]>
    </select>
 
    <select id="getWoDeSQZiYuan" 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} and RESOURCESTATUS=0
            <!--我的申请只显示自己申请的个人申请部分 alert ykm 2018/12/25-->
            and apptype = 0 and ISRECOMMEND = 0
            <if test="isDiTuFuwu != '' and isDiTuFuwu != null">
                and RESOURCECLASS in ( ${isDiTuFuwu} )
            </if>
            <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 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>
            order by b.appdate desc
        </where>
    </select>
 
    <select id="getZuiXinZiYuan" resultType="com.landtool.lanbase.modules.res.entity.Res_MainInfo">
        WITH tab as(
        SELECT row_number() over(ORDER BY PUBDATE DESC) rn, a.* from RES_MAININFO a
        <where>
            RESOURCESTATUS=0 and AUDITSTATUS=2
            <if test="isDiTuFuwu != '' and isDiTuFuwu != null">
                and RESOURCECLASS in ( ${isDiTuFuwu} )
            </if>
        </where>
        ORDER BY PUBDATE DESC
        )
        SELECT * from tab  WHERE <![CDATA[ rn <= ${num} ]]>
    </select>
</mapper>