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

142 lines
7.3 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="id" column="id" />
<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="isDelete" column="is_delete" />
<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 id, name, type, url, source_unit, is_open, status, is_delete, 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>
and is_delete = 1
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>
</select>
<select id="selectSceneManageById" parameterType="Long" resultMap="SceneManageResult">
<include refid="selectSceneManageVo"/>
where id = #{id}
</select>
<insert id="insertSceneManage" parameterType="SceneManage" useGeneratedKeys="true" keyProperty="id">
insert into scene_manage
<trim prefix="(" suffix=")" suffixOverrides=",">
<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="isDelete != null ">is_delete,</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="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="isDelete != null ">#{isDelete},</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="isDelete != null ">is_delete = #{isDelete},</if>
<if test="creator != null and creator != ''">creator = #{creator},</if>
<if test="createTime != null ">create_time = #{createTime},</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 id = #{id}
</update>
<delete id="deleteSceneManageById" parameterType="Long">
delete from scene_manage where id = #{id}
</delete>
<update id="deleteSceneManageByIds" parameterType="String">
update scene_manage set is_delete = 0 where id in
3 years ago
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<select id="selectSceneManageByIds" parameterType="String" resultMap="SceneManageResult">
<include refid="selectSceneManageVo"/>
<where>
and is_delete = 1
and id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</where>
</select>
<insert id="batchInsertSceneManage">
insert into scene_manage
(`name`, `type`, source_unit, is_open, creator, create_time,scene_background, `describe`, `sort`) values
<foreach collection="sceneManageList" item="sceneObj" separator=",">
(#{sceneObj.name},#{sceneObj.type},#{sceneObj.sourceUnit},#{sceneObj.isOpen},#{sceneObj.creator},#{sceneObj.createTime},#{sceneObj.sceneBackground},#{sceneObj.describe},#{sceneObj.sort})
</foreach>
</insert>
<!-- <delete id="deleteSceneManageByIds" parameterType="String">-->
<!-- delete from scene_manage where id in -->
<!-- <foreach item="id" collection="array" open="(" separator="," close=")">-->
<!-- #{id}-->
<!-- </foreach>-->
<!-- </delete>-->
3 years ago
</mapper>