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