58 lines
2.4 KiB
XML
58 lines
2.4 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.familydoctor.mapper.EvaluateOptionMapper">
|
|
|
|
<resultMap id="BaseResultMap" type="com.xinelu.familydoctor.entity.EvaluateOption">
|
|
<id property="id" column="id" jdbcType="BIGINT"/>
|
|
<result property="questionId" column="question_id" jdbcType="BIGINT"/>
|
|
<result property="surveyId" column="survey_id" jdbcType="BIGINT"/>
|
|
<result property="optionName" column="option_name" jdbcType="VARCHAR"/>
|
|
<result property="optionSort" column="option_sort" jdbcType="INTEGER"/>
|
|
</resultMap>
|
|
|
|
<sql id="Base_Column_List">
|
|
id,question_id,survey_id,
|
|
option_name,option_sort
|
|
</sql>
|
|
|
|
<select id="getOptions" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="Base_Column_List" />
|
|
from evaluate_option
|
|
where question_id = #{questionId,jdbcType=BIGINT}
|
|
</select>
|
|
|
|
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.xinelu.familydoctor.entity.EvaluateOption" useGeneratedKeys="true">
|
|
insert into evaluate_option
|
|
(question_id,survey_id
|
|
,option_name,option_sort)
|
|
values (#{questionId,jdbcType=BIGINT},#{surveyId,jdbcType=BIGINT}
|
|
,#{optionName,jdbcType=VARCHAR},#{optionSort,jdbcType=INTEGER})
|
|
</insert>
|
|
<update id="update" parameterType="com.xinelu.familydoctor.entity.EvaluateOption">
|
|
update evaluate_option
|
|
<set>
|
|
<if test="questionId != null">
|
|
question_id = #{questionId,jdbcType=BIGINT},
|
|
</if>
|
|
<if test="surveyId != null">
|
|
survey_id = #{surveyId,jdbcType=BIGINT},
|
|
</if>
|
|
<if test="optionName != null">
|
|
option_name = #{optionName,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="optionSort != null">
|
|
option_sort = #{optionSort,jdbcType=INTEGER},
|
|
</if>
|
|
</set>
|
|
where id = #{id,jdbcType=BIGINT}
|
|
</update>
|
|
|
|
<update id="clearRelationId">
|
|
update evaluate_option set question_id = null, survey_id = null
|
|
where question_id = #{questionId,jdbcType=BIGINT} and survey_id = #{surveyId,jdbcType=BIGINT}
|
|
</update>
|
|
</mapper>
|