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

156 lines
7.9 KiB

3 years ago
<?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.SceneManageMapper">
<resultMap type="com.zdxt.knowledge.domain.SceneManage" id="SceneManageResult">
<result property="guid" column="guid" />
<result property="code" column="code" />
3 years ago
<result property="name" column="name" />
<result property="type" column="type" />
<result property="url" column="url" />
<result property="sourceUnit" column="source_unit" />
<result property="isOpen" column="is_open" />
<result property="status" column="status" />
<result property="creator" column="creator" />
<result property="createTime" column="create_time" />
<result property="sceneBackground" column="scene_background" />
<result property="describe" column="describe" />
<result property="sort" column="sort" />
<result property="useTotal" column="use_total" />
3 years ago
</resultMap>
<sql id="selectSceneManageVo">
select guid, code, name, type, url, source_unit, is_open, status, creator, create_time, scene_background, `describe`, sort, use_total from scene_manage
3 years ago
</sql>
<select id="selectSceneManageList" parameterType="com.zdxt.knowledge.domain.SceneManage" resultMap="SceneManageResult">
3 years ago
<include refid="selectSceneManageVo"/>
<where>
3 years ago
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="type != null "> and type = #{type}</if>
<if test="url != null and url != ''"> and url = #{url}</if>
<if test="sourceUnit != null and sourceUnit != ''"> and source_unit = #{sourceUnit}</if>
<if test="isOpen != null "> and is_open = #{isOpen}</if>
<if test="status != null "> and status = #{status}</if>
<if test="creator != null and creator != ''"> and creator = #{creator}</if>
<if test="createTime != null">
and create_time <![CDATA[>=]]> #{createTime}
</if>
<if test="createTimeEnd != null">
and create_time <![CDATA[<=]]> #{createTimeEnd}
</if>
3 years ago
</where>
order by sort ASC
3 years ago
</select>
<select id="selectSceneManageById" parameterType="String" resultMap="SceneManageResult">
3 years ago
<include refid="selectSceneManageVo"/>
where guid = #{guid}
3 years ago
</select>
<insert id="insertSceneManage" parameterType="SceneManage" >
3 years ago
insert into scene_manage
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="guid != null and guid != ''">guid,</if>
3 years ago
<if test="name != null and name != ''">name,</if>
<if test="type != null ">type,</if>
<if test="url != null and url != ''">url,</if>
<if test="sourceUnit != null and sourceUnit != ''">source_unit,</if>
<if test="isOpen != null ">is_open,</if>
<if test="status != null ">status,</if>
<if test="creator != null and creator != ''">creator,</if>
<if test="createTime != null ">create_time,</if>
<if test="sceneBackground != null and sceneBackground != ''">scene_background,</if>
<if test="describe != null and describe != '' ">`describe`,</if>
<if test="sort != null and sort != '' ">`sort`,</if>
3 years ago
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="guid != null and guid != ''">#{guid},</if>
3 years ago
<if test="name != null and name != ''">#{name},</if>
<if test="type != null ">#{type},</if>
<if test="url != null and url != ''">#{url},</if>
<if test="sourceUnit != null and sourceUnit != ''">#{sourceUnit},</if>
<if test="isOpen != null ">#{isOpen},</if>
<if test="status != null ">#{status},</if>
<if test="creator != null and creator != ''">#{creator},</if>
<if test="createTime != null ">#{createTime},</if>
<if test="sceneBackground != null and sceneBackground != ''">#{sceneBackground},</if>
<if test="describe != null and describe != ''">#{describe},</if>
<if test="sort != null and sort != ''">#{sort},</if>
3 years ago
</trim>
</insert>
<update id="updateSceneManage" parameterType="SceneManage">
update scene_manage
<trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">name = #{name},</if>
<if test="type != null ">type = #{type},</if>
<if test="url != null and url != ''">url = #{url},</if>
<if test="sourceUnit != null and sourceUnit != ''">source_unit = #{sourceUnit},</if>
<if test="isOpen != null ">is_open = #{isOpen},</if>
<if test="status != null ">status = #{status},</if>
<if test="sceneBackground != null and sceneBackground != ''">scene_background = #{sceneBackground},</if>
<if test="describe != null and describe != ''">`describe` = #{describe},</if>
<if test="sort != null and sort != ''">`sort` = #{sort},</if>
<if test="useTotal != null and useTotal != ''">`use_total` = #{useTotal},</if>
3 years ago
</trim>
where guid = #{guid}
3 years ago
</update>
<delete id="deleteSceneManageById" parameterType="String">
delete from scene_manage where guid = #{guid}
3 years ago
</delete>
<delete id="deleteSceneManageByIds" parameterType="String">
delete from scene_manage where guid in
<foreach item="guid" collection="array" open="(" separator="," close=")">
#{guid}
3 years ago
</foreach>
</delete>
<select id="selectSceneManageByIds" parameterType="String" resultMap="SceneManageResult">
<include refid="selectSceneManageVo"/>
<where>
and guid in
<foreach item="guid" collection="array" open="(" separator="," close=")">
#{guid}
</foreach>
</where>
</select>
<insert id="batchInsertSceneManage">
insert into scene_manage
(`guid`,`name`, `type`, source_unit, is_open, creator, create_time,scene_background, `describe`, `sort`) values
<foreach collection="sceneManageList" item="sceneObj" separator=",">
(#{sceneObj.guid},#{sceneObj.name},#{sceneObj.type},#{sceneObj.sourceUnit},#{sceneObj.isOpen},#{sceneObj.creator},#{sceneObj.createTime},#{sceneObj.sceneBackground},#{sceneObj.describe},#{sceneObj.sort})
</foreach>
</insert>
<select id="selectMinSort" resultType="INTEGER">
select MAX(sort) as sort from scene_manage
</select>
<select id="selectLastSort" parameterType="INTEGER" resultMap="SceneManageResult">
SELECT guid, sort FROM scene_manage WHERE sort = (SELECT MAX(sort) FROM scene_manage where sort &lt; #{sort});
</select>
<!-- <delete id="deleteSceneManageByIds" parameterType="String">-->
<!-- delete from scene_manage where id in -->
<!-- <foreach item="id" collection="array" open="(" separator="," close=")">-->
<!-- #{id}-->
<!-- </foreach>-->
<!-- </delete>-->
<select id="selectSceneManageListAll" parameterType="SceneManage" resultMap="SceneManageResult">
select cu.guid, cu.name, cu.sort, cu.status, cu.is_open, zd.upload_path from scene_manage as cu
inner join zdxt_file as zd
on cu.guid = zd.business_id
<where>
<if test="name != null and name != ''"> and cu.name like concat('%', #{name}, '%')</if>
<if test="status != null "> and cu.status = #{status}</if>
</where>
order by cu.sort ASC
</select>
3 years ago
</mapper>