|
|
|
@ -5,14 +5,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
|
<mapper namespace="com.zdxt.knowledge.mapper.SceneManageMapper"> |
|
|
|
|
|
|
|
<resultMap type="com.zdxt.knowledge.domain.SceneManage" id="SceneManageResult"> |
|
|
|
<result property="id" column="id" /> |
|
|
|
<result property="guid" column="guid" /> |
|
|
|
<result property="code" column="code" /> |
|
|
|
<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" /> |
|
|
|
@ -22,13 +22,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
|
</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 |
|
|
|
select guid, code, name, type, url, source_unit, is_open, status, creator, create_time, scene_background, `describe`, sort, use_total from scene_manage |
|
|
|
</sql> |
|
|
|
|
|
|
|
<select id="selectSceneManageList" parameterType="com.zdxt.knowledge.domain.SceneManage" resultMap="SceneManageResult"> |
|
|
|
<include refid="selectSceneManageVo"/> |
|
|
|
<where> |
|
|
|
and is_delete = 1 |
|
|
|
<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> |
|
|
|
@ -43,23 +42,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
|
and create_time <![CDATA[<=]]> #{createTimeEnd} |
|
|
|
</if> |
|
|
|
</where> |
|
|
|
order by sort ASC |
|
|
|
</select> |
|
|
|
|
|
|
|
<select id="selectSceneManageById" parameterType="Long" resultMap="SceneManageResult"> |
|
|
|
<select id="selectSceneManageById" parameterType="String" resultMap="SceneManageResult"> |
|
|
|
<include refid="selectSceneManageVo"/> |
|
|
|
where id = #{id} |
|
|
|
where guid = #{guid} |
|
|
|
</select> |
|
|
|
|
|
|
|
<insert id="insertSceneManage" parameterType="SceneManage" useGeneratedKeys="true" keyProperty="id"> |
|
|
|
<insert id="insertSceneManage" parameterType="SceneManage" > |
|
|
|
insert into scene_manage |
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=","> |
|
|
|
<if test="guid != null and guid != ''">guid,</if> |
|
|
|
<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> |
|
|
|
@ -67,13 +67,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
|
<if test="sort != null and sort != '' ">`sort`,</if> |
|
|
|
</trim> |
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=","> |
|
|
|
<if test="guid != null and guid != ''">#{guid},</if> |
|
|
|
<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> |
|
|
|
@ -91,47 +91,50 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
|
<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> |
|
|
|
</trim> |
|
|
|
where id = #{id} |
|
|
|
where guid = #{guid} |
|
|
|
</update> |
|
|
|
|
|
|
|
<delete id="deleteSceneManageById" parameterType="Long"> |
|
|
|
delete from scene_manage where id = #{id} |
|
|
|
<delete id="deleteSceneManageById" parameterType="String"> |
|
|
|
delete from scene_manage where guid = #{guid} |
|
|
|
</delete> |
|
|
|
|
|
|
|
<update id="deleteSceneManageByIds" parameterType="String"> |
|
|
|
update scene_manage set is_delete = 0 where id in |
|
|
|
<foreach item="id" collection="array" open="(" separator="," close=")"> |
|
|
|
#{id} |
|
|
|
<delete id="deleteSceneManageByIds" parameterType="String"> |
|
|
|
delete from scene_manage where guid in |
|
|
|
<foreach item="guid" collection="array" open="(" separator="," close=")"> |
|
|
|
#{guid} |
|
|
|
</foreach> |
|
|
|
</update> |
|
|
|
</delete> |
|
|
|
|
|
|
|
<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} |
|
|
|
and guid in |
|
|
|
<foreach item="guid" collection="array" open="(" separator="," close=")"> |
|
|
|
#{guid} |
|
|
|
</foreach> |
|
|
|
</where> |
|
|
|
</select> |
|
|
|
|
|
|
|
<insert id="batchInsertSceneManage"> |
|
|
|
insert into scene_manage |
|
|
|
(`name`, `type`, source_unit, is_open, creator, create_time,scene_background, `describe`, `sort`) values |
|
|
|
(`guid`,`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}) |
|
|
|
(#{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 < #{sort}); |
|
|
|
</select> |
|
|
|
<!-- <delete id="deleteSceneManageByIds" parameterType="String">--> |
|
|
|
<!-- delete from scene_manage where id in --> |
|
|
|
<!-- <foreach item="id" collection="array" open="(" separator="," close=")">--> |
|
|
|
|