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

102 lines
4.8 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="id" column="id" />
<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="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectSceneQuestionVo">
select id, name, parent_id, role_id, status, creator, create_time, 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>
3 years ago
</where>
</select>
<select id="selectSceneQuestionById" parameterType="Long" resultMap="SceneQuestionResult">
<include refid="selectSceneQuestionVo"/>
where id = #{id}
</select>
<insert id="insertSceneQuestion" parameterType="SceneQuestion" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
3 years ago
insert into scene_question
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null ">id,</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="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="id != null ">#{id},</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="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="creator != null and creator != ''">creator = #{creator},</if>
<if test="createTime != null ">create_time = #{createTime},</if>
<if test="updateTime != null ">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSceneQuestionById" parameterType="Long">
delete from scene_question where id = #{id}
</delete>
<delete id="deleteSceneQuestionByIds" parameterType="String">
delete from scene_question where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</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 id = #{id}
</update>
3 years ago
</mapper>