236 lines
8.7 KiB
XML
236 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.xinelu.manage.mapper.questionsubjectoption.QuestionSubjectOptionMapper">
|
|
|
|
<resultMap type="QuestionSubjectOption" id="QuestionSubjectOptionResult">
|
|
<result property="id" column="id"/>
|
|
<result property="questionnaireSubjectId" column="questionnaire_subject_id"/>
|
|
<result property="questionName" column="question_name"/>
|
|
<result property="optionName" column="option_name"/>
|
|
<result property="optionAnswer" column="option_answer"/>
|
|
<result property="optionScore" column="option_score"/>
|
|
<result property="optionSort" column="option_sort"/>
|
|
<result property="optionRemark" column="option_remark"/>
|
|
<result property="createBy" column="create_by"/>
|
|
<result property="createTime" column="create_time"/>
|
|
<result property="updateBy" column="update_by"/>
|
|
<result property="updateTime" column="update_time"/>
|
|
</resultMap>
|
|
|
|
<sql id="selectQuestionSubjectOptionVo">
|
|
select id,
|
|
questionnaire_subject_id,
|
|
question_name,
|
|
option_name,
|
|
option_answer,
|
|
option_score,
|
|
option_sort,
|
|
option_remark,
|
|
create_by,
|
|
create_time,
|
|
update_by,
|
|
update_time
|
|
from question_subject_option
|
|
</sql>
|
|
|
|
<select id="selectQuestionSubjectOptionList" parameterType="QuestionSubjectOption"
|
|
resultMap="QuestionSubjectOptionResult">
|
|
<include refid="selectQuestionSubjectOptionVo"/>
|
|
<where>
|
|
<if test="questionnaireSubjectId != null ">
|
|
and questionnaire_subject_id = #{questionnaireSubjectId}
|
|
</if>
|
|
<if test="questionName != null and questionName != ''">
|
|
and question_name like concat('%', #{questionName}, '%')
|
|
</if>
|
|
<if test="optionName != null and optionName != ''">
|
|
and option_name like concat('%', #{optionName}, '%')
|
|
</if>
|
|
<if test="optionAnswer != null and optionAnswer != ''">
|
|
and option_answer = #{optionAnswer}
|
|
</if>
|
|
<if test="optionScore != null ">
|
|
and option_score = #{optionScore}
|
|
</if>
|
|
<if test="optionSort != null ">
|
|
and option_sort = #{optionSort}
|
|
</if>
|
|
<if test="optionRemark != null and optionRemark != ''">
|
|
and option_remark = #{optionRemark}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectQuestionSubjectOptionById" parameterType="Long"
|
|
resultMap="QuestionSubjectOptionResult">
|
|
<include refid="selectQuestionSubjectOptionVo"/>
|
|
where id = #{id}
|
|
</select>
|
|
|
|
<insert id="insertQuestionSubjectOption" parameterType="QuestionSubjectOption" useGeneratedKeys="true"
|
|
keyProperty="id">
|
|
insert into question_subject_option
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="questionnaireSubjectId != null">questionnaire_subject_id,
|
|
</if>
|
|
<if test="questionName != null">question_name,
|
|
</if>
|
|
<if test="optionName != null">option_name,
|
|
</if>
|
|
<if test="optionAnswer != null">option_answer,
|
|
</if>
|
|
<if test="optionScore != null">option_score,
|
|
</if>
|
|
<if test="optionSort != null">option_sort,
|
|
</if>
|
|
<if test="optionRemark != null">option_remark,
|
|
</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>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="questionnaireSubjectId != null">#{questionnaireSubjectId},
|
|
</if>
|
|
<if test="questionName != null">#{questionName},
|
|
</if>
|
|
<if test="optionName != null">#{optionName},
|
|
</if>
|
|
<if test="optionAnswer != null">#{optionAnswer},
|
|
</if>
|
|
<if test="optionScore != null">#{optionScore},
|
|
</if>
|
|
<if test="optionSort != null">#{optionSort},
|
|
</if>
|
|
<if test="optionRemark != null">#{optionRemark},
|
|
</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>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateQuestionSubjectOption" parameterType="QuestionSubjectOption">
|
|
update question_subject_option
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="questionnaireSubjectId != null">questionnaire_subject_id =
|
|
#{questionnaireSubjectId},
|
|
</if>
|
|
<if test="questionName != null">question_name =
|
|
#{questionName},
|
|
</if>
|
|
<if test="optionName != null">option_name =
|
|
#{optionName},
|
|
</if>
|
|
<if test="optionAnswer != null">option_answer =
|
|
#{optionAnswer},
|
|
</if>
|
|
<if test="optionScore != null">option_score =
|
|
#{optionScore},
|
|
</if>
|
|
<if test="optionSort != null">option_sort =
|
|
#{optionSort},
|
|
</if>
|
|
<if test="optionRemark != null">option_remark =
|
|
#{optionRemark},
|
|
</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>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteQuestionSubjectOptionById" parameterType="Long">
|
|
delete
|
|
from question_subject_option
|
|
where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteQuestionSubjectOptionByIds" parameterType="String">
|
|
delete from question_subject_option where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<insert id="insertQuestionSubjectOptionList">
|
|
insert into question_subject_option(
|
|
questionnaire_subject_id,
|
|
question_name,
|
|
option_name,
|
|
option_answer,
|
|
option_score,
|
|
option_sort,
|
|
option_remark,
|
|
create_by,
|
|
create_time
|
|
) values
|
|
<foreach item="QuestionSubjectOption" index="index" collection="list" separator=",">
|
|
(
|
|
#{QuestionSubjectOption.questionnaireSubjectId},
|
|
#{QuestionSubjectOption.questionName},
|
|
#{QuestionSubjectOption.optionName},
|
|
#{QuestionSubjectOption.optionAnswer},
|
|
#{QuestionSubjectOption.optionScore},
|
|
#{QuestionSubjectOption.optionSort},
|
|
#{QuestionSubjectOption.optionRemark},
|
|
#{QuestionSubjectOption.createBy},
|
|
#{QuestionSubjectOption.createTime}
|
|
)
|
|
</foreach>
|
|
</insert>
|
|
|
|
<select id="selectQuestionSubjectOptions"
|
|
resultType="com.xinelu.manage.vo.questionsubjectoption.QuestionSubjectOptionVO">
|
|
select id,
|
|
questionnaire_subject_id,
|
|
question_name,
|
|
option_name,
|
|
option_answer,
|
|
option_score,
|
|
option_sort,
|
|
option_remark,
|
|
create_by,
|
|
create_time,
|
|
update_by,
|
|
update_time
|
|
from question_subject_option
|
|
<where>
|
|
<if test="questionSubjectIds != null and questionSubjectIds.size() > 0">
|
|
questionnaire_subject_id in
|
|
<foreach item="questionSubjectIds" collection="questionSubjectIds" open="(" separator="," close=")">
|
|
#{questionSubjectIds}
|
|
</foreach>
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<delete id="deleteOptionByQuestionSubjectIds">
|
|
delete from question_subject_option where questionnaire_subject_id in
|
|
<foreach item="id" collection="list" open="(" separator="," close=")">
|
|
#{questionSubjectIds}
|
|
</foreach>
|
|
</delete>
|
|
</mapper> |