|
|
|
|
<?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.SceneQuestionMapper">
|
|
|
|
|
|
|
|
|
|
<resultMap type="com.zdxt.knowledge.domain.SceneQuestion" id="SceneQuestionResult">
|
|
|
|
|
<result property="guid" column="guid" />
|
|
|
|
|
<result property="code" column="code" />
|
|
|
|
|
<result property="name" column="name" />
|
|
|
|
|
<result property="parentId" column="parent_id" />
|
|
|
|
|
<result property="roleId" column="role_id" />
|
|
|
|
|
<result property="status" column="status" />
|
|
|
|
|
<result property="creator" column="creator" />
|
|
|
|
|
<result property="option" column="option" />
|
|
|
|
|
<result property="answer" column="answer" />
|
|
|
|
|
<result property="nextQuestionId" column="next_question_id" />
|
|
|
|
|
<result property="createTime" column="create_time" />
|
|
|
|
|
<result property="updateTime" column="update_time" />
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<sql id="selectSceneQuestionVo">
|
|
|
|
|
select guid, code, name, parent_id, role_id, status, creator, create_time, answer, `option`, next_question_id, update_time from scene_question
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<select id="selectSceneQuestionList" parameterType="SceneQuestion" resultMap="SceneQuestionResult">
|
|
|
|
|
<include refid="selectSceneQuestionVo"/>
|
|
|
|
|
<where>
|
|
|
|
|
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
|
|
|
|
<if test="parentId != null and parentId != ''"> and parent_id = #{parentId}</if>
|
|
|
|
|
<if test="roleId != null and roleId != ''"> and role_id = #{roleId}</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>
|
|
|
|
|
</where>
|
|
|
|
|
order by create_time desc
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectSceneQuestionById" parameterType="String" resultMap="SceneQuestionResult">
|
|
|
|
|
<include refid="selectSceneQuestionVo"/>
|
|
|
|
|
where guid = #{guid}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<insert id="insertSceneQuestion" parameterType="SceneQuestion">
|
|
|
|
|
insert into scene_question
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="guid != null ">guid,</if>
|
|
|
|
|
<if test="name != null and name != ''">`name`,</if>
|
|
|
|
|
<if test="parentId != null and parentId != ''">parent_id,</if>
|
|
|
|
|
<if test="roleId != null and roleId != ''">role_id,</if>
|
|
|
|
|
<if test="status != null ">status,</if>
|
|
|
|
|
<if test="option != null and option != ''">`option`,</if>
|
|
|
|
|
<if test="answer != null and answer != ''">answer,</if>
|
|
|
|
|
<if test="creator != null and creator != ''">creator,</if>
|
|
|
|
|
<if test="createTime != null ">create_time,</if>
|
|
|
|
|
<if test="updateTime != null ">update_time,</if>
|
|
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="guid != null ">#{guid},</if>
|
|
|
|
|
<if test="name != null and name != ''">#{name},</if>
|
|
|
|
|
<if test="parentId != null and parentId != ''">#{parentId},</if>
|
|
|
|
|
<if test="roleId != null and roleId != ''">#{roleId},</if>
|
|
|
|
|
<if test="status != null ">#{status},</if>
|
|
|
|
|
<if test="option != null and option != ''">#{option},</if>
|
|
|
|
|
<if test="answer != null and creator != ''">#{answer},</if>
|
|
|
|
|
<if test="creator != null and creator != ''">#{creator},</if>
|
|
|
|
|
<if test="createTime != null ">#{createTime},</if>
|
|
|
|
|
<if test="updateTime != null ">#{updateTime},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<update id="updateSceneQuestion" parameterType="SceneQuestion">
|
|
|
|
|
update scene_question
|
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
|
<if test="name != null and name != ''">name = #{name},</if>
|
|
|
|
|
<if test="parentId != null and parentId != ''">parent_id = #{parentId},</if>
|
|
|
|
|
<if test="roleId != null and roleId != ''">role_id = #{roleId},</if>
|
|
|
|
|
<if test="status != null ">status = #{status},</if>
|
|
|
|
|
<if test="option != null and option != ''">`option` = #{option},</if>
|
|
|
|
|
<if test="answer != null and answer != ''">answer = #{answer},</if>
|
|
|
|
|
<if test="creator != null and creator != ''">creator = #{creator},</if>
|
|
|
|
|
<if test="updateTime != null ">update_time = #{updateTime},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
where guid = #{guid}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteSceneQuestionById" parameterType="String">
|
|
|
|
|
delete from scene_question where guid = #{guid}
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteSceneQuestionByIds" parameterType="String">
|
|
|
|
|
delete from scene_question where guid in
|
|
|
|
|
<foreach item="guid" collection="array" open="(" separator="," close=")">
|
|
|
|
|
#{guid}
|
|
|
|
|
</foreach>
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<update id="bindAnswer" parameterType="SceneQuestion">
|
|
|
|
|
update scene_question
|
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
|
<if test="answer != null and answer != ''">answer = #{answer},</if>
|
|
|
|
|
<if test="nextQuestionId != null and nextQuestionId != ''">next_question_id = #{nextQuestionId},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
where guid = #{guid}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
</mapper>
|