小程序后台代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

114 lines
5.6 KiB

<?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.zdxt.knowledge.mapper.CustomImageMapper">
<resultMap type="com.zdxt.knowledge.domain.CustomImage" id="CustomImageResult">
<result property="guid" column="guid" />
<result property="title" column="title" />
<result property="srot" column="srot" />
<result property="status" column="status" />
<result property="page" column="page" />
<result property="position" column="position" />
<result property="creator" column="creator" />
<result property="createTime" column="create_time" />
<result property="updator" column="updator" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectCustomImageVo">
select guid, title, srot, status, page, position, creator, create_time, updator, update_time from custom_image
</sql>
<select id="selectCustomImageList" parameterType="CustomImage" resultMap="CustomImageResult">
<include refid="selectCustomImageVo"/>
<where>
<if test="title != null and title != ''"> and title like concat('%', #{title}, '%')</if>
<if test="srot != null "> and srot = #{srot}</if>
<if test="status != null "> and status = #{status}</if>
<if test="page != null and page != ''"> and page = #{page}</if>
<if test="position != null and position != ''"> and position = #{position}</if>
<if test="creator != null and creator != ''"> and creator = #{creator}</if>
<if test="updator != null and updator != ''"> and updator = #{updator}</if>
</where>
</select>
<select id="selectCustomImageListAll" parameterType="CustomImage" resultMap="CustomImageResult">
select cu.guid, cu.title, cu.srot, cu.status, cu.page, cu.position, zd.upload_path from custom_image as cu
inner join zdxt_file as zd
on cu.guid = zd.business_id
<where>
<if test="title != null and title != ''"> and cu.title like concat('%', #{title}, '%')</if>
<if test="srot != null "> and cu.srot = #{srot}</if>
<if test="status != null "> and cu.status = #{status}</if>
<if test="page != null and page != ''"> and cu.page = #{page}</if>
<if test="position != null and position != ''"> and cu.position = #{position}</if>
</where>
</select>
<select id="selectCustomImageById" parameterType="String" resultMap="CustomImageResult">
<include refid="selectCustomImageVo"/>
where guid = #{guid}
</select>
<insert id="insertCustomImage" parameterType="CustomImage">
insert into custom_image
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="guid != null and guid != ''">guid,</if>
<if test="title != null and title != ''">title,</if>
<if test="status != null ">status,</if>
<if test="page != null and page != ''">page,</if>
<if test="position != null and position != ''">position,</if>
<if test="creator != null and creator != ''">creator,</if>
<if test="createTime != null ">create_time,</if>
<if test="updator != null and updator != ''">updator,</if>
<if test="updateTime != null ">update_time,</if>
srot,
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="guid != null and guid != ''">#{guid},</if>
<if test="title != null and title != ''">#{title},</if>
<if test="status != null ">#{status},</if>
<if test="page != null and page != ''">#{page},</if>
<if test="position != null and position != ''">#{position},</if>
<if test="creator != null and creator != ''">#{creator},</if>
<if test="createTime != null ">#{createTime},</if>
<if test="updator != null and updator != ''">#{updator},</if>
<if test="updateTime != null ">#{updateTime},</if>
(select IFNULL((max(srot)+1), 1) as srot from custom_image tmp),
</trim>
</insert>
<update id="updateCustomImage" parameterType="CustomImage">
update custom_image
<trim prefix="SET" suffixOverrides=",">
<if test="title != null and title != ''">title = #{title},</if>
<if test="srot != null ">srot = #{srot},</if>
<if test="status != null ">status = #{status},</if>
<if test="page != null and page != ''">page = #{page},</if>
<if test="position != null and position != ''">position = #{position},</if>
<if test="creator != null and creator != ''">creator = #{creator},</if>
<if test="createTime != null ">create_time = #{createTime},</if>
<if test="updator != null and updator != ''">updator = #{updator},</if>
<if test="updateTime != null ">update_time = #{updateTime},</if>
</trim>
where guid = #{guid}
</update>
<update id="updateSrot" parameterType="Long">
update custom_image set srot = #{srot} where srot = #{key}
</update>
<delete id="deleteCustomImageById" parameterType="String">
delete from custom_image where guid = #{guid}
</delete>
<delete id="deleteCustomImageByIds" parameterType="String">
delete from custom_image where guid in
<foreach item="guid" collection="array" open="(" separator="," close=")">
#{guid}
</foreach>
</delete>
</mapper>