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

107 lines
5.2 KiB

<?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.AnswerBankMapper">
<resultMap type="com.zdxt.knowledge.domain.AnswerBank" id="AnswerBankResult">
<result property="guid" column="guid" />
<result property="questionBankId" column="question_bank_id" />
<result property="title" column="title" />
<result property="content" column="content" />
<result property="status" column="status" />
<result property="sort" column="sort" />
<result property="creator" column="creator" />
<result property="createTime" column="create_time" />
<result property="updator" column="updator" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectAnswerBankVo">
select guid, question_bank_id, title, content, status, sort, creator, create_time, updator, update_time from answer_bank
</sql>
<select id="selectAnswerBankList" parameterType="AnswerBank" resultMap="AnswerBankResult">
<include refid="selectAnswerBankVo"/>
<where>
<if test="questionBankId != null and questionBankId != ''"> and question_bank_id = #{questionBankId}</if>
<if test="title != null and title != ''"> and title = #{title}</if>
<if test="content != null and content != ''"> and content = #{content}</if>
<if test="status != null "> and status = #{status}</if>
<if test="creator != null and creator != ''"> and creator = #{creator}</if>
<if test="updator != null and updator != ''"> and updator = #{updator}</if>
</where>
</select>
<select id="selectAnswerBankById" parameterType="String" resultMap="AnswerBankResult">
<include refid="selectAnswerBankVo"/>
where guid = #{guid}
</select>
<insert id="insertAnswerBank" parameterType="AnswerBank">
insert into answer_bank
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="guid != null and guid != ''">guid,</if>
<if test="questionBankId != null and questionBankId != ''">question_bank_id,</if>
<if test="title != null and title != ''">title,</if>
<if test="content != null and content != ''">content,</if>
<if test="status != null ">status,</if>
<if test="creator != null and creator != ''">creator,</if>
<if test="createTime != null ">create_time,</if>
<if test="updator != null and updator != ''">updator,</if>
<if test="updateTime != null ">update_time,</if>
sort,
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="guid != null and guid != ''">#{guid},</if>
<if test="questionBankId != null and questionBankId != ''">#{questionBankId},</if>
<if test="title != null and title != ''">#{title},</if>
<if test="content != null and content != ''">#{content},</if>
<if test="status != null ">#{status},</if>
<if test="creator != null and creator != ''">#{creator},</if>
<if test="createTime != null ">#{createTime},</if>
<if test="updator != null and updator != ''">#{updator},</if>
<if test="updateTime != null ">#{updateTime},</if>
(select IFNULL((max(srot)+1), 1) as srot from answer_bank tmp),
</trim>
</insert>
<update id="updateAnswerBank" parameterType="AnswerBank">
update answer_bank
<trim prefix="SET" suffixOverrides=",">
<if test="questionBankId != null and questionBankId != ''">question_bank_id = #{questionBankId},</if>
<if test="title != null and title != ''">title = #{title},</if>
<if test="content != null and content != ''">content = #{content},</if>
<if test="status != null ">status = #{status},</if>
<if test="sort != null ">sort = #{sort},</if>
<if test="creator != null and creator != ''">creator = #{creator},</if>
<if test="createTime != null ">create_time = #{createTime},</if>
<if test="updator != null and updator != ''">updator = #{updator},</if>
<if test="updateTime != null ">update_time = #{updateTime},</if>
</trim>
where guid = #{guid}
</update>
<update id="updateSrot" parameterType="Long">
update answer_bank set sort = #{srot} where sort = #{key}
</update>
<delete id="deleteAnswerBankById" parameterType="String">
delete from answer_bank where guid = #{guid}
</delete>
<delete id="deleteAnswerBankByIds" parameterType="String">
delete from answer_bank where guid in
<foreach item="guid" collection="array" open="(" separator="," close=")">
#{guid}
</foreach>
</delete>
<delete id="deleteAnswerBankByQusetionIds" parameterType="String">
delete from answer_bank where question_bank_id in
<foreach item="guid" collection="array" open="(" separator="," close=")">
#{guid}
</foreach>
</delete>
</mapper>