小程序后台代码
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.
 
 
 
 
 
 

100 lines
4.4 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.SceneHomeMapper">
<resultMap type="com.zdxt.knowledge.domain.SceneHome" id="SceneHomeResult">
<result property="guid" column="guid" />
<result property="name" column="name" />
<result property="sort" column="sort" />
<result property="hide" column="hide" />
<result property="pagePath" column="page_path" />
<result property="picIcon" column="pic_icon" />
<result property="creator" column="creator" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectSceneHomeVo">
select guid, name, sort, hide, pic_icon, page_path, creator, create_time from scene_home
</sql>
<select id="selectSceneHomeList" parameterType="SceneHome" resultMap="SceneHomeResult">
<include refid="selectSceneHomeVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="creator != null and creator != ''"> and creator = #{creator}</if>
</where>
order by sort ASC
</select>
<select id="selectSceneHomeById" parameterType="String" resultMap="SceneHomeResult">
<include refid="selectSceneHomeVo"/>
where guid = #{guid}
</select>
<insert id="insertSceneHome" parameterType="SceneHome">
insert into scene_home
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="guid != null ">guid,</if>
<if test="name != null and name != ''">`name`,</if>
<if test="picIcon != null and picIcon != ''">pic_icon,</if>
<if test="pagePath != null and pagePath != ''">page_path,</if>
<if test="sort != null ">sort,</if>
<if test="hide != null and hide != ''">`hide`,</if>
<if test="creator != null and creator != ''">creator,</if>
<if test="createTime != null ">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="guid != null ">#{guid},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="picIcon != null and picIcon != ''">#{picIcon},</if>
<if test="pagePath != null and pagePath != ''">#{pagePath},</if>
<if test="sort != null ">#{sort},</if>
<if test="hide != null and hide != ''">#{hide},</if>
<if test="creator != null and creator != ''">#{creator},</if>
<if test="createTime != null ">#{createTime},</if>
</trim>
</insert>
<update id="updateSceneHome" parameterType="SceneHome">
update scene_home
<trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">name = #{name},</if>
<if test="picIcon != null and picIcon != ''">pic_icon = #{picIcon},</if>
<if test="pagePath != null and pagePath != ''">page_path = #{pagePath},</if>
<if test="sort != null ">sort = #{sort},</if>
<if test="hide != null ">hide = #{hide},</if>
<if test="creator != null and creator != ''">creator = #{creator},</if>
</trim>
where guid = #{guid}
</update>
<delete id="deleteSceneHomeById" parameterType="String">
delete from scene_home where guid = #{guid}
</delete>
<delete id="deleteSceneHomeByIds" parameterType="String">
delete from scene_home where guid in
<foreach item="guid" collection="array" open="(" separator="," close=")">
#{guid}
</foreach>
</delete>
<select id="selectMinSort" resultType="INTEGER">
select MAX(sort) as sort from scene_home
</select>
<select id="selectLastSort" parameterType="INTEGER" resultMap="SceneHomeResult">
SELECT guid, sort FROM scene_home WHERE sort = (SELECT MAX(sort) FROM scene_home where sort &lt; #{sort});
</select>
<select id="selectSceneHomeListAll" parameterType="SceneHome" resultMap="SceneHomeResult">
select cu.guid, cu.name, cu.page_path, zd.upload_path from scene_home as cu
inner join zdxt_file as zd
on cu.guid = zd.business_id
where cu.hide = 1
order by cu.sort ASC
</select>
</mapper>