154 lines
8.7 KiB
XML
154 lines
8.7 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.yanzhu.manage.mapper.BusExamQuestionMapper">
|
||
|
|
||
|
<resultMap type="BusExamQuestion" id="BusExamQuestionResult">
|
||
|
<result property="id" column="id" />
|
||
|
<result property="deptId" column="dept_id" />
|
||
|
<result property="projectId" column="project_id" />
|
||
|
<result property="craftType" column="craft_type" />
|
||
|
<result property="craftPost" column="craft_post" />
|
||
|
<result property="questionDiff" column="question_diff" />
|
||
|
<result property="questionType" column="question_type" />
|
||
|
<result property="questionDesc" column="question_desc" />
|
||
|
<result property="questionAnswer" column="question_answer" />
|
||
|
<result property="isDel" column="is_del" />
|
||
|
<result property="createBy" column="create_by" />
|
||
|
<result property="createTime" column="create_time" />
|
||
|
<result property="updateBy" column="update_by" />
|
||
|
<result property="updateTime" column="update_time" />
|
||
|
<result property="remark" column="remark" />
|
||
|
</resultMap>
|
||
|
|
||
|
<resultMap id="BusExamQuestionBusExamQuestionResultResult" type="BusExamQuestion" extends="BusExamQuestionResult">
|
||
|
<collection property="busExamQuestionResultList" notNullColumn="sub_id" javaType="java.util.List" resultMap="BusExamQuestionResultResult" />
|
||
|
</resultMap>
|
||
|
|
||
|
<resultMap type="BusExamQuestionResult" id="BusExamQuestionResultResult">
|
||
|
<result property="id" column="sub_id" />
|
||
|
<result property="questionId" column="sub_question_id" />
|
||
|
<result property="opt" column="sub_opt" />
|
||
|
<result property="result" column="sub_result" />
|
||
|
<result property="isDel" column="sub_is_del" />
|
||
|
<result property="createBy" column="sub_create_by" />
|
||
|
<result property="createTime" column="sub_create_time" />
|
||
|
<result property="updateBy" column="sub_update_by" />
|
||
|
<result property="updateTime" column="sub_update_time" />
|
||
|
<result property="remark" column="sub_remark" />
|
||
|
</resultMap>
|
||
|
|
||
|
<sql id="selectBusExamQuestionVo">
|
||
|
select id, dept_id, project_id, craft_type, craft_post, question_diff, question_type, question_desc, question_answer, is_del, create_by, create_time, update_by, update_time, remark from bus_exam_question
|
||
|
</sql>
|
||
|
|
||
|
<select id="selectBusExamQuestionList" parameterType="BusExamQuestion" resultMap="BusExamQuestionResult">
|
||
|
<include refid="selectBusExamQuestionVo"/>
|
||
|
<where>
|
||
|
<if test="deptId != null "> and dept_id = #{deptId}</if>
|
||
|
<if test="projectId != null "> and project_id = #{projectId}</if>
|
||
|
<if test="craftType != null and craftType != ''"> and craft_type = #{craftType}</if>
|
||
|
<if test="craftPost != null and craftPost != ''"> and craft_post = #{craftPost}</if>
|
||
|
<if test="questionDiff != null "> and question_diff = #{questionDiff}</if>
|
||
|
<if test="questionType != null "> and question_type = #{questionType}</if>
|
||
|
<if test="questionDesc != null and questionDesc != ''"> and question_desc = #{questionDesc}</if>
|
||
|
<if test="questionAnswer != null and questionAnswer != ''"> and question_answer = #{questionAnswer}</if>
|
||
|
<if test="isDel != null "> and is_del = #{isDel}</if>
|
||
|
</where>
|
||
|
</select>
|
||
|
|
||
|
<select id="selectBusExamQuestionById" parameterType="Long" resultMap="BusExamQuestionBusExamQuestionResultResult">
|
||
|
select a.id, a.dept_id, a.project_id, a.craft_type, a.craft_post, a.question_diff, a.question_type, a.question_desc, a.question_answer, a.is_del, a.create_by, a.create_time, a.update_by, a.update_time, a.remark,
|
||
|
b.id as sub_id, b.question_id as sub_question_id, b.opt as sub_opt, b.result as sub_result, b.is_del as sub_is_del, b.create_by as sub_create_by, b.create_time as sub_create_time, b.update_by as sub_update_by, b.update_time as sub_update_time, b.remark as sub_remark
|
||
|
from bus_exam_question a
|
||
|
left join bus_exam_question_result b on b.question_id = a.id
|
||
|
where a.id = #{id}
|
||
|
</select>
|
||
|
|
||
|
<insert id="insertBusExamQuestion" parameterType="BusExamQuestion" useGeneratedKeys="true" keyProperty="id">
|
||
|
insert into bus_exam_question
|
||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||
|
<if test="deptId != null">dept_id,</if>
|
||
|
<if test="projectId != null">project_id,</if>
|
||
|
<if test="craftType != null">craft_type,</if>
|
||
|
<if test="craftPost != null">craft_post,</if>
|
||
|
<if test="questionDiff != null">question_diff,</if>
|
||
|
<if test="questionType != null">question_type,</if>
|
||
|
<if test="questionDesc != null">question_desc,</if>
|
||
|
<if test="questionAnswer != null">question_answer,</if>
|
||
|
<if test="isDel != null">is_del,</if>
|
||
|
<if test="createBy != null">create_by,</if>
|
||
|
<if test="createTime != null">create_time,</if>
|
||
|
<if test="updateBy != null">update_by,</if>
|
||
|
<if test="updateTime != null">update_time,</if>
|
||
|
<if test="remark != null">remark,</if>
|
||
|
</trim>
|
||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||
|
<if test="deptId != null">#{deptId},</if>
|
||
|
<if test="projectId != null">#{projectId},</if>
|
||
|
<if test="craftType != null">#{craftType},</if>
|
||
|
<if test="craftPost != null">#{craftPost},</if>
|
||
|
<if test="questionDiff != null">#{questionDiff},</if>
|
||
|
<if test="questionType != null">#{questionType},</if>
|
||
|
<if test="questionDesc != null">#{questionDesc},</if>
|
||
|
<if test="questionAnswer != null">#{questionAnswer},</if>
|
||
|
<if test="isDel != null">#{isDel},</if>
|
||
|
<if test="createBy != null">#{createBy},</if>
|
||
|
<if test="createTime != null">#{createTime},</if>
|
||
|
<if test="updateBy != null">#{updateBy},</if>
|
||
|
<if test="updateTime != null">#{updateTime},</if>
|
||
|
<if test="remark != null">#{remark},</if>
|
||
|
</trim>
|
||
|
</insert>
|
||
|
|
||
|
<update id="updateBusExamQuestion" parameterType="BusExamQuestion">
|
||
|
update bus_exam_question
|
||
|
<trim prefix="SET" suffixOverrides=",">
|
||
|
<if test="deptId != null">dept_id = #{deptId},</if>
|
||
|
<if test="projectId != null">project_id = #{projectId},</if>
|
||
|
<if test="craftType != null">craft_type = #{craftType},</if>
|
||
|
<if test="craftPost != null">craft_post = #{craftPost},</if>
|
||
|
<if test="questionDiff != null">question_diff = #{questionDiff},</if>
|
||
|
<if test="questionType != null">question_type = #{questionType},</if>
|
||
|
<if test="questionDesc != null">question_desc = #{questionDesc},</if>
|
||
|
<if test="questionAnswer != null">question_answer = #{questionAnswer},</if>
|
||
|
<if test="isDel != null">is_del = #{isDel},</if>
|
||
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||
|
<if test="remark != null">remark = #{remark},</if>
|
||
|
</trim>
|
||
|
where id = #{id}
|
||
|
</update>
|
||
|
|
||
|
<delete id="deleteBusExamQuestionById" parameterType="Long">
|
||
|
delete from bus_exam_question where id = #{id}
|
||
|
</delete>
|
||
|
|
||
|
<delete id="deleteBusExamQuestionByIds" parameterType="String">
|
||
|
delete from bus_exam_question where id in
|
||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||
|
#{id}
|
||
|
</foreach>
|
||
|
</delete>
|
||
|
|
||
|
<delete id="deleteBusExamQuestionResultByQuestionIds" parameterType="String">
|
||
|
delete from bus_exam_question_result where question_id in
|
||
|
<foreach item="questionId" collection="array" open="(" separator="," close=")">
|
||
|
#{questionId}
|
||
|
</foreach>
|
||
|
</delete>
|
||
|
|
||
|
<delete id="deleteBusExamQuestionResultByQuestionId" parameterType="Long">
|
||
|
delete from bus_exam_question_result where question_id = #{questionId}
|
||
|
</delete>
|
||
|
|
||
|
<insert id="batchBusExamQuestionResult">
|
||
|
insert into bus_exam_question_result( id, question_id, opt, result, is_del, create_by, create_time, update_by, update_time, remark) values
|
||
|
<foreach item="item" index="index" collection="list" separator=",">
|
||
|
( #{item.id}, #{item.questionId}, #{item.opt}, #{item.result}, #{item.isDel}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.remark})
|
||
|
</foreach>
|
||
|
</insert>
|
||
|
</mapper>
|