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

112 lines
5.5 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.SceneQuestionMapper">
<resultMap type="com.zdxt.knowledge.domain.SceneQuestion" id="SceneQuestionResult">
<result property="guid" column="guid" />
<result property="code" column="code" />
3 years ago
<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" />
3 years ago
<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
3 years ago
</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>
3 years ago
</where>
order by create_time desc
3 years ago
</select>
<select id="selectSceneQuestionById" parameterType="String" resultMap="SceneQuestionResult">
3 years ago
<include refid="selectSceneQuestionVo"/>
where guid = #{guid}
3 years ago
</select>
<insert id="insertSceneQuestion" parameterType="SceneQuestion">
3 years ago
insert into scene_question
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="guid != null ">guid,</if>
<if test="name != null and name != ''">`name`,</if>
3 years ago
<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>
3 years ago
<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>
3 years ago
<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>
3 years ago
<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>
3 years ago
<if test="creator != null and creator != ''">creator = #{creator},</if>
<if test="updateTime != null ">update_time = #{updateTime},</if>
</trim>
where guid = #{guid}
3 years ago
</update>
<delete id="deleteSceneQuestionById" parameterType="String">
delete from scene_question where guid = #{guid}
3 years ago
</delete>
<delete id="deleteSceneQuestionByIds" parameterType="String">
delete from scene_question where guid in
<foreach item="guid" collection="array" open="(" separator="," close=")">
#{guid}
3 years ago
</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>
3 years ago
</mapper>