新增选择题

This commit is contained in:
flower 2018-12-10 05:08:00 +08:00
parent 598e1fb575
commit 2fef55463f
2 changed files with 130 additions and 8 deletions

View File

@ -18,12 +18,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectExamQuestionItemVo">
id, content, number, exam_question_id, create_by, create_date, update_by, update_date, remarks, del_flag </sql>
select id, content, number, exam_question_id, create_by, create_date, update_by, update_date, remarks, del_flag from exam_question_item
</sql>
<select id="selectExamQuestionItemList" parameterType="ExamQuestionItem" resultMap="ExamQuestionItemResult">
select
<include refid="selectExamQuestionItemVo"/>
from exam_question_item
<where>
<if test="id != null and id != '' "> and id = #{id}</if>
<if test="content != null and content != '' "> and content = #{content}</if>
@ -37,6 +36,65 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="delFlag != null and delFlag != '' "> and del_flag = #{delFlag}</if>
</where>
</select>
<select id="selectExamQuestionItemById" parameterType="String" resultMap="ExamQuestionItemResult">
<include refid="selectExamQuestionItemVo"/>
where id = #{id}
</select>
<insert id="insertExamQuestionItem" parameterType="ExamQuestionItem">
insert into exam_question_item
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null and id != '' ">id,</if>
<if test="content != null and content != '' ">content,</if>
<if test="number != null and number != '' ">number,</if>
<if test="examQuestionId != null and examQuestionId != '' ">exam_question_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="content != null and content != '' ">#{content},</if>
<if test="number != null and number != '' ">#{number},</if>
<if test="examQuestionId != null and examQuestionId != '' ">#{examQuestionId},</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="updateExamQuestionItem" parameterType="ExamQuestionItem">
update exam_question_item
<trim prefix="SET" suffixOverrides=",">
<if test="content != null and content != '' ">content = #{content},</if>
<if test="number != null and number != '' ">number = #{number},</if>
<if test="examQuestionId != null and examQuestionId != '' ">exam_question_id = #{examQuestionId},</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="deleteExamQuestionItemById" parameterType="String">
delete from exam_question_item where id = #{id}
</delete>
<delete id="deleteExamQuestionItemByIds" parameterType="String">
delete from exam_question_item where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -3,7 +3,7 @@
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" />
@ -20,12 +20,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectExamQuestionVo">
id, title, answer, type, label, category_id, create_by, create_date, update_by, update_date, remarks, del_flag </sql>
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">
select
<include refid="selectExamQuestionVo"/>
from exam_question
<where>
<if test="id != null and id != '' "> and id = #{id}</if>
<if test="title != null and title != '' "> and title = #{title}</if>
@ -42,5 +41,70 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</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>