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
<?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_DiyLayerInfoMapper" >
  <resultMap id="BaseResultMap" type="com.landtool.lanbase.modules.res.entity.Res_DiyLayerInfo" >
    <id column="DIYID" property="diyid" jdbcType="DECIMAL" />
    <result column="RESOURCEID" property="resourceid" jdbcType="DECIMAL" />
    <result column="TITLE" property="title" jdbcType="VARCHAR" />
    <result column="TYPENAME" property="typename" jdbcType="VARCHAR" />
    <result column="DIYUSERID" property="diyuserid" jdbcType="DECIMAL" />
    <result column="DIYTIME" property="diytime" jdbcType="TIMESTAMP" />
    <result column="ISSHARE" property="isshare" jdbcType="DECIMAL" />
  </resultMap>
  <resultMap id="ResultMapWithBLOBs" type="com.landtool.lanbase.modules.res.entity.Res_DiyLayerInfo" extends="BaseResultMap" >
    <result column="CONTENT" property="content" jdbcType="VARCHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    DIYID, RESOURCEID, TITLE, TYPENAME, DIYUSERID, DIYTIME, ISSHARE
  </sql>
  <sql id="Blob_Column_List" >
    CONTENT
  </sql>
  <select id="selectByPrimaryKey" resultMap="ResultMapWithBLOBs" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from RES_DIYLAYERINFO
    where DIYID = #{diyid,jdbcType=DECIMAL}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
    delete from RES_DIYLAYERINFO
    where DIYID = #{diyid}
  </delete>
  <insert id="insert" parameterType="com.landtool.lanbase.modules.res.entity.Res_DiyLayerInfo" >
    insert into RES_DIYLAYERINFO
       (
       RESOURCEID, 
       TITLE, 
       TYPENAME, 
       DIYUSERID, 
       DIYTIME, 
       CONTENT,
       ISSHARE)
    values (
      #{resourceid,jdbcType=DECIMAL}, 
      #{title,jdbcType=VARCHAR}, 
      #{typename,jdbcType=VARCHAR}, 
      #{diyuserid,jdbcType=DECIMAL}, 
      #{diytime,jdbcType=TIMESTAMP}, 
      #{content,jdbcType=CLOB},
      #{isshare,jdbcType=DECIMAL})
  </insert>
  <insert id="insertSelective" parameterType="com.landtool.lanbase.modules.res.entity.Res_DiyLayerInfo" >
    insert into RES_DIYLAYERINFO
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="resourceid != null" >
        RESOURCEID,
      </if>
      <if test="title != null" >
        TITLE,
      </if>
      <if test="typename != null" >
        TYPENAME,
      </if>
      <if test="diyuserid != null" >
        DIYUSERID,
      </if>
      <if test="diytime != null" >
        DIYTIME,
      </if>
      <if test="content != null" >
        CONTENT,
      </if>
      <if test="isshare != null" >
        ISSHARE,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="resourceid != null" >
        #{resourceid,jdbcType=DECIMAL},
      </if>
      <if test="title != null" >
        #{title,jdbcType=VARCHAR},
      </if>
      <if test="typename != null" >
        #{typename,jdbcType=VARCHAR},
      </if>
      <if test="diyuserid != null" >
        #{diyuserid,jdbcType=DECIMAL},
      </if>
      <if test="diytime != null" >
        #{diytime,jdbcType=TIMESTAMP},
      </if>
      <if test="content != null" >
        #{content,jdbcType=CLOB},
      </if>
      <if test="isshare != null" >
        #{isshare,jdbcType=CLOB},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.landtool.lanbase.modules.res.entity.Res_DiyLayerInfo" >
    update RES_DIYLAYERINFO
    <set >
      <if test="resourceid != null" >
        RESOURCEID = #{resourceid,jdbcType=DECIMAL},
      </if>
      <if test="title != null" >
        TITLE = #{title,jdbcType=VARCHAR},
      </if>
      <if test="typename != null" >
        TYPENAME = #{typename,jdbcType=VARCHAR},
      </if>
      <if test="diyuserid != null" >
        DIYUSERID = #{diyuserid,jdbcType=DECIMAL},
      </if>
      <if test="diytime != null" >
        DIYTIME = #{diytime,jdbcType=TIMESTAMP},
      </if>
      <if test="content != null" >
        CONTENT = #{content,jdbcType=CLOB},
      </if>
      <if test="isshare != null" >
        ISSHARE = #{isshare,jdbcType=CLOB},
      </if>
    </set>
    where DIYID = #{diyid,jdbcType=DECIMAL}
  </update>
  <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.landtool.lanbase.modules.res.entity.Res_DiyLayerInfo" >
    update RES_DIYLAYERINFO
    set RESOURCEID = #{resourceid,jdbcType=DECIMAL},
      TITLE = #{title,jdbcType=VARCHAR},
      TYPENAME = #{typename,jdbcType=VARCHAR},
      DIYUSERID = #{diyuserid,jdbcType=DECIMAL},
      DIYTIME = #{diytime,jdbcType=TIMESTAMP},
      CONTENT = #{content,jdbcType=CLOB},
      ISSHARE = #{isshare,jdbcType=DECIMAL}
    where DIYID = #{diyid,jdbcType=DECIMAL}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.landtool.lanbase.modules.res.entity.Res_DiyLayerInfo" >
    update RES_DIYLAYERINFO
    set RESOURCEID = #{resourceid,jdbcType=DECIMAL},
      TITLE = #{title,jdbcType=VARCHAR},
      TYPENAME = #{typename,jdbcType=VARCHAR},
      DIYUSERID = #{diyuserid,jdbcType=DECIMAL},
      DIYTIME = #{diytime,jdbcType=TIMESTAMP},
      ISSHARE = #{isshare,jdbcType=DECIMAL}
    where DIYID = #{diyid,jdbcType=DECIMAL}
  </update>
  
  <update id="updateContentApi" parameterType="com.landtool.lanbase.modules.res.entity.Res_DiyLayerInfo">
        update RES_DIYLAYERINFO
        <set>
           <if test="title != null" >
            TITLE = #{title},
          </if>
          <if test="typename != null" >
            TYPENAME = #{typename},
          </if>
          <if test="content != null" >
            CONTENT = #{content},
          </if>
          <if test="diyuserid != null" >
            diyuserid = #{diyuserid},
          </if>
      </set>
            where DIYID = #{diyid}
  </update>
 
  <select id="queryApiList" resultType="com.landtool.lanbase.modules.res.entity.Res_DiyLayerInfo" parameterType="com.landtool.lanbase.modules.res.entity.Res_DiyLayerInfo">
          select * from RES_DIYLAYERINFO
          <where>
              <if test="resourceid != null">
                AND resourceid = #{resourceid} 
            </if>
            <if test="title != null and title.trim() != ''">
                AND title LIKE ('%' || #{title} || '%')
            </if>
            <if test="typename != null and typename.trim() != ''">
                AND typename = #{typename}
            </if>
            <if test="diyid != null">
                AND diyid = #{diyid}
            </if>
            <if test="diyuserid != null and isshare != null">
              AND (diyuserid = #{diyuserid} or isshare = #{isshare})
            </if>
          </where>
          order by DIYTIME desc
  </select>
 
  <select id="queryObjectByUseridAndResid" resultType="com.landtool.lanbase.modules.res.entity.Res_DiyLayerInfo" parameterType="com.landtool.lanbase.modules.res.entity.Res_DiyLayerInfo" >
    select * from RES_DIYLAYERINFO where diyuserid = #{diyuserid} and resourceid = #{resourceid} and title = #{title}
  </select>
  <select id="queryUserObject" resultType="com.landtool.lanbase.modules.res.entity.Res_DiyLayerInfo" parameterType="com.landtool.lanbase.modules.res.entity.Res_DiyLayerInfo">
 
    with tab as (
    SELECT  row_number() over(partition by RESOURCEID order by DIYTIME desc) rn, a.*
    FROM RES_DIYLAYERINFO a
    WHERE diyuserid= #{diyuserid,jdbcType=DECIMAL}
    and resourceid = #{resourceid,jdbcType=DECIMAL}
    <if test="isshare != null">
      and isshare = #{resourceid,jdbcType=DECIMAL}
    </if>
    and typename = 0
    )
    SELECT * from tab where rn = 1
  </select>
  <select id="getById" parameterType="java.lang.Integer" resultType="com.landtool.lanbase.modules.res.entity.Res_DiyLayerInfo">
    select * from RES_DIYLAYERINFO where DIYID=#{diyid}
  </select>
  <select id="selectByResourceid" parameterType="java.lang.Integer" resultType="com.landtool.lanbase.modules.res.entity.Res_DiyLayerInfo">
    select * from RES_DIYLAYERINFO where resourceid=#{resourceid} ORDER BY diytime
  </select>
</mapper>