RuoYi/ruoyi-exam/src/main/resources/mapper/exam/ExamQuestionMapper.xml

110 lines
5.8 KiB
XML

<?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.ruoyi.exam.mapper.ExamQuestionMapper">
<resultMap type="ExamQuestion" id="ExamQuestionResult">
<result property="id" column="id" />
<result property="title" column="title" />
<result property="answer" column="answer" />
<result property="type" column="type" />
<result property="label" column="label" />
<result property="categoryId" column="category_id" />
<result property="createBy" column="create_by" />
<result property="createDate" column="create_date" />
<result property="updateBy" column="update_by" />
<result property="updateDate" column="update_date" />
<result property="remarks" column="remarks" />
<result property="delFlag" column="del_flag" />
</resultMap>
<sql id="selectExamQuestionVo">
select id, title, answer, type, label, category_id, create_by, create_date, update_by, update_date, remarks, del_flag from exam_question
</sql>
<select id="selectExamQuestionList" parameterType="ExamQuestion" resultMap="ExamQuestionResult">
<include refid="selectExamQuestionVo"/>
<where>
<if test="id != null and id != '' "> and id = #{id}</if>
<if test="title != null and title != '' "> and title = #{title}</if>
<if test="answer != null and answer != '' "> and answer = #{answer}</if>
<if test="type != null and type != '' "> and type = #{type}</if>
<if test="label != null and label != '' "> and label = #{label}</if>
<if test="categoryId != null and categoryId != '' "> and category_id = #{categoryId}</if>
<if test="createBy != null and createBy != '' "> and create_by = #{createBy}</if>
<if test="createDate != null "> and create_date = #{createDate}</if>
<if test="updateBy != null and updateBy != '' "> and update_by = #{updateBy}</if>
<if test="updateDate != null "> and update_date = #{updateDate}</if>
<if test="remarks != null and remarks != '' "> and remarks = #{remarks}</if>
<if test="delFlag != null and delFlag != '' "> and del_flag = #{delFlag}</if>
</where>
</select>
<select id="selectExamQuestionById" parameterType="String" resultMap="ExamQuestionResult">
<include refid="selectExamQuestionVo"/>
where id = #{id}
</select>
<insert id="insertExamQuestion" parameterType="ExamQuestion">
insert into exam_question
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null and id != '' ">id,</if>
<if test="title != null and title != '' ">title,</if>
<if test="answer != null and answer != '' ">answer,</if>
<if test="type != null and type != '' ">type,</if>
<if test="label != null and label != '' ">label,</if>
<if test="categoryId != null and categoryId != '' ">category_id,</if>
<if test="createBy != null and createBy != '' ">create_by,</if>
<if test="createDate != null ">create_date,</if>
<if test="updateBy != null and updateBy != '' ">update_by,</if>
<if test="updateDate != null ">update_date,</if>
<if test="remarks != null and remarks != '' ">remarks,</if>
<if test="delFlag != null and delFlag != '' ">del_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null and id != '' ">#{id},</if>
<if test="title != null and title != '' ">#{title},</if>
<if test="answer != null and answer != '' ">#{answer},</if>
<if test="type != null and type != '' ">#{type},</if>
<if test="label != null and label != '' ">#{label},</if>
<if test="categoryId != null and categoryId != '' ">#{categoryId},</if>
<if test="createBy != null and createBy != '' ">#{createBy},</if>
<if test="createDate != null ">#{createDate},</if>
<if test="updateBy != null and updateBy != '' ">#{updateBy},</if>
<if test="updateDate != null ">#{updateDate},</if>
<if test="remarks != null and remarks != '' ">#{remarks},</if>
<if test="delFlag != null and delFlag != '' ">#{delFlag},</if>
</trim>
</insert>
<update id="updateExamQuestion" parameterType="ExamQuestion">
update exam_question
<trim prefix="SET" suffixOverrides=",">
<if test="title != null and title != '' ">title = #{title},</if>
<if test="answer != null and answer != '' ">answer = #{answer},</if>
<if test="type != null and type != '' ">type = #{type},</if>
<if test="label != null and label != '' ">label = #{label},</if>
<if test="categoryId != null and categoryId != '' ">category_id = #{categoryId},</if>
<if test="createBy != null and createBy != '' ">create_by = #{createBy},</if>
<if test="createDate != null ">create_date = #{createDate},</if>
<if test="updateBy != null and updateBy != '' ">update_by = #{updateBy},</if>
<if test="updateDate != null ">update_date = #{updateDate},</if>
<if test="remarks != null and remarks != '' ">remarks = #{remarks},</if>
<if test="delFlag != null and delFlag != '' ">del_flag = #{delFlag},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteExamQuestionById" parameterType="String">
delete from exam_question where id = #{id}
</delete>
<delete id="deleteExamQuestionByIds" parameterType="String">
delete from exam_question where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>