Newer
Older
huludao / src / main / resources / mapper / Assessment / AssessmentSubItemDao.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.newfiber.api.pc.dao.Assessment.AssessmentSubItemDao" >

	<resultMap type="com.newfiber.api.pc.model.Assessment.AssessmentSubItem" id="BaseResultMap">
		<id column="Serial" property="serial" jdbcType="BIGINT"/>
		<result column="Sub_Item_No" property="subItemNo" jdbcType="VARCHAR"/>
		<result column="Sub_Item_Name" property="subItemName" jdbcType="NVARCHAR"/>
		<result column="Sub_Item_Score" property="subItemScore" jdbcType="NUMERIC"/>
		<result column="Item_No" property="itemNo" jdbcType="VARCHAR"/>
		<result column="Self_Assessment" property="selfAssessment" jdbcType="NUMERIC"/>
		<result column="Leader_Grade" property="leaderGrade" jdbcType="NUMERIC"/>
	</resultMap>


   <select id="getAssessmentSubItemList" parameterType="com.newfiber.api.pc.model.Assessment.AssessmentSubItem" resultMap="BaseResultMap">
   SELECT * FROM assessment_subitem where Item_No=#{itemNo}
   </select>


  <delete id="deleteSubItem" parameterType="com.newfiber.api.pc.model.Assessment.AssessmentSubItem" >
    delete from assessment_subitem where Item_No =#{itemNo}
  </delete>
  
  <delete id="deleteSubItemByItemNo" parameterType="java.util.List" >
    delete from assessment_subitem
    where Item_No IN
    <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
    #{item}
    </foreach>
  </delete>
  

  <insert id="insertAssessmentSubItem" parameterType="com.newfiber.api.pc.model.Assessment.AssessmentSubItem" >
    insert into assessment_subitem
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="subItemNo != null" >
        Sub_Item_No,
      </if>
      <if test="subItemName != null" >
        Sub_Item_Name,
      </if>
      <if test="subItemScore != null" >
        Sub_Item_Score,
      </if>
      <if test=" itemNo != null" >
        Item_No,
      </if>
      <if test="selfAssessment != null" >
        Self_Assessment,
      </if>  
      <if test="leaderGrade != null" >
        Leader_Grade,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="subItemNo != null" >
        #{subItemNo,jdbcType=VARCHAR},
      </if>
      <if test="subItemName != null" >
        #{subItemName,jdbcType=NVARCHAR},
      </if>
      <if test="subItemScore != null" >
        #{subItemScore,jdbcType=NUMERIC},
      </if>
      <if test="itemNo != null" >
        #{itemNo,jdbcType=VARCHAR},
      </if>
      <if test="selfAssessment != null" >
        #{selfAssessment,jdbcType=NUMERIC},
      </if>
      <if test="leaderGrade != null" >
        #{leaderGrade,jdbcType=NUMERIC},
      </if>
    </trim>
  </insert>
  
  <update id="updateAssessmentSubItem" parameterType="com.newfiber.api.pc.model.Assessment.AssessmentSubItem" >
    update assessment_subitem
    <set >
      <if test="subItemName != null" >
        Sub_Item_Name = #{subItemName,jdbcType=NVARCHAR},
      </if>
      <if test="subItemScore">
      	Sub_Item_Score = #{subItemScore,jdbcType=NUMERIC},
      </if>
      <if test="selfAssessment != null" >
      	Self_Assessment = #{selfAssessment,jdbcType=NUMERIC},
      </if>
      <if test="leaderGrade != null">
      	Leader_Grade = #{leaderGrade,jdbcType=NUMERIC},
      </if>
    </set>
    where Sub_Item_No = #{subItemNo,jdbcType=VARCHAR}
  </update>
  
  
</mapper>