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
<?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.JiChuDiTuMapper" >
    <resultMap id="BaseResultMap" type="com.landtool.lanbase.modules.res.entity.Res_MainInfo" >
        <id column="RESOURCEID" property="resourceid" jdbcType="DECIMAL" />
        <result column="CATLOGID" property="catlogid" jdbcType="DECIMAL" />
        <result column="TITLE" property="title" jdbcType="OTHER" />
        <result column="ABBREVIATION" property="abbreviation" jdbcType="OTHER" />
        <result column="PINGYINFIIRST" property="pingyinfiirst" jdbcType="OTHER" />
        <result column="CATLOGCODE" property="catlogcode" jdbcType="OTHER" />
        <result column="KEYWORDS" property="keywords" jdbcType="OTHER" />
        <result column="DESCRIPTION" property="description" jdbcType="OTHER" />
        <result column="DESURL" property="desurl" jdbcType="OTHER" />
        <result column="IMGURL" property="imgurl" jdbcType="OTHER" />
        <result column="RESOURCECLASS" property="resourceclass" jdbcType="OTHER" />
        <result column="DATASOURCES" property="datasources" jdbcType="DECIMAL" />
        <result column="PRODUCTIONTIME" property="productiontime" jdbcType="TIMESTAMP" />
        <result column="UPDATETIMES" property="updatetimes" jdbcType="OTHER" />
        <result column="PUBDATE" property="pubdate" jdbcType="TIMESTAMP" />
        <result column="PUBUNITID" property="pubunitid" jdbcType="OTHER" />
        <result column="CREATEUSERID" property="createuserid" jdbcType="OTHER" />
        <result column="ADMINISTRATIVEID" property="administrativeid" jdbcType="OTHER" />
        <result column="SECURITYLEV" property="securitylev" jdbcType="OTHER" />
        <result column="SHARPROTOCOL" property="sharprotocol" jdbcType="OTHER" />
        <result column="ESPPROXY" property="espproxy" jdbcType="DECIMAL" />
        <result column="USERNAME" property="username" jdbcType="OTHER" />
        <result column="PASSWORD" property="password" jdbcType="OTHER" />
        <result column="TOKEN" property="token" jdbcType="OTHER" />
        <result column="RESOURCESTATUS" property="resourcestatus" jdbcType="DECIMAL" />
        <result column="AUDITSTATUS" property="auditstatus" jdbcType="DECIMAL" />
        <result column="DISPLAYBY2D" property="displayby2d" jdbcType="DECIMAL" />
        <result column="DISPLAYBY3D" property="displayby3d" jdbcType="DECIMAL" />
        <result column="ORDERID" property="orderid" jdbcType="DECIMAL" />
        <result column="CREATEDATE" property="createdate" jdbcType="TIMESTAMP" />
        <result column="LASTEDITDATE" property="lasteditdate" jdbcType="TIMESTAMP" />
        <result column="REMARK" property="remark" jdbcType="OTHER" />
        <result column="INSTEADAUDIT" property="insteadaudit" jdbcType="OTHER" />
    </resultMap>
    <sql id="Base_Column_List" >
        RES_MAININFO.RESOURCEID, CATLOGID, TITLE, ABBREVIATION, PINGYINFIIRST, CATLOGCODE, KEYWORDS, DESCRIPTION,
        DESURL, IMGURL, RESOURCECLASS, DATASOURCES, PRODUCTIONTIME,
        UPDATETIMES, PUBDATE, PUBUNITID, CREATEUSERID, ADMINISTRATIVEID, SECURITYLEV, SHARPROTOCOL,
        ESPPROXY, USERNAME, PASSWORD, TOKEN, RESOURCESTATUS, AUDITSTATUS, DISPLAYBY2D, DISPLAYBY3D,
        ORDERID, CREATEDATE, LASTEDITDATE, REMARK,INSTEADAUDIT
    </sql>
    <select id="selectResMainInfo" parameterType="com.landtool.lanbase.modules.res.entity.Res_MainInfo"
            resultType="com.landtool.lanbase.modules.res.entity.Res_MainInfo">
        select <include refid="Base_Column_List" />,readcount,applycount
        from RES_MAININFO
        left join (select b.RESOURCEID,count(*) as readcount from RES_ACTIONRECORD b where ACTIONTYPE = '浏览' group by b.RESOURCEID)t2 on RES_MAININFO.RESOURCEID = t2.RESOURCEID
        left join (select c.RESOURCEID,count(*) as applycount from RES_APPLYRECOMMEND c group by c.RESOURCEID)t3 on RES_MAININFO.RESOURCEID = t3.RESOURCEID
        <where>
            <!--RESOURCESTATUS = 0 -->
            <if test="title!=null and title != '' ">
                and (TITLE like '%'||#{title}||'%' OR replace(KEYWORDS,',','') like '%'||#{title}||'%')
            </if>
            <if test="resourceclass !=null and resourceclass != '' ">
                and (resourceclass like #{resourceclass} || '%' )
            </if>
            <if test="createuserid!=null and createuserid != '' ">
                and createuserid =  #{createuserid,jdbcType=OTHER}
            </if>
            <if test="catlogid!=null and catlogid != '' ">
                and catlogid =  #{catlogid,jdbcType=DECIMAL}
            </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>
            <if test="auditstatus !=null and (auditstatus==0 ? '0' : auditstatus) ">
                and auditstatus=#{auditstatus,jdbcType=DECIMAL}
            </if>
        </where>
        <if test="sort!=null and sort != '' ">
            order by ${sort}
        </if>
        <if test="sort==null or sort == '' ">
            order by CREATEDATE DESC
        </if>
    </select>
</mapper>