<?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.AssessmentItemDao" > <resultMap type="com.newfiber.api.pc.model.Assessment.AssessmentItem" id="BaseResultMap"> <id column="Serial" property="serial" jdbcType="BIGINT"/> <result column="Item_No" property="itemNo" jdbcType="VARCHAR"/> <result column="Item_Name" property="itemName" jdbcType="NVARCHAR"/> <result column="Item_Score" property="itemScore" jdbcType="NUMERIC"/> <result column="Template_No" property="templateNo" jdbcType="VARCHAR"/> <result column="Assessment_No" property="assessmentNo" jdbcType="VARCHAR"/> <result column="Self_Assessment" property="selfAssessment" jdbcType="NUMERIC"/> <result column="Leader_Grade" property="leaderGrade" jdbcType="NUMERIC"/> <collection column="Item_No" property="subList" ofType="com.newfiber.api.pc.model.Assessment.AssessmentSubItem" select="com.newfiber.api.pc.dao.Assessment.AssessmentSubItemDao.getAssessmentSubItemList"> </collection> </resultMap> <select id="getAssessmentItemList" parameterType="com.newfiber.api.pc.model.Assessment.AssessmentItem" resultMap="BaseResultMap"> SELECT * FROM assessment_item where Template_No=#{templateNo} </select> <select id="getAssessmentItemList2" parameterType="com.newfiber.api.pc.model.Assessment.AssessmentItem" resultMap="BaseResultMap"> SELECT * FROM assessment_item where Assessment_No=#{assessmentNo} </select> <select id="getItemNoByAssessmentNo" parameterType="java.util.List" resultType="java.lang.String"> select Item_No from assessment_item where Assessment_No IN <foreach collection="list" index="index" item="item" open="(" separator="," close=")"> #{item} </foreach> </select> <delete id="deleteAssessmentItem" parameterType="com.newfiber.api.pc.model.Assessment.AssessmentItem" > delete from assessment_item where Template_No=#{templateNo} </delete> <delete id="deleteByAssessmentNo" parameterType="java.util.List" > delete from assessment_item where Assessment_No IN <foreach collection="list" index="index" item="item" open="(" separator="," close=")"> #{item} </foreach> </delete> <insert id="insertAssessmentItem" parameterType="com.newfiber.api.pc.model.Assessment.AssessmentItem" > insert into assessment_item <trim prefix="(" suffix=")" suffixOverrides="," > <if test="itemNo != null" > Item_No, </if> <if test="itemName != null" > Item_Name, </if> <if test="itemScore != null" > Item_Score, </if> <if test=" assessmentNo != null" > Assessment_No, </if> <if test=" templateNo != null" > Template_No, </if> <if test="selfAssessment != null" > Self_Assessment, </if> <if test="leaderGrade != null" > Leader_Grade, </if> </trim> <trim prefix="values (" suffix=")" suffixOverrides="," > <if test="itemNo != null" > #{itemNo,jdbcType=VARCHAR}, </if> <if test="itemName != null" > #{itemName,jdbcType=NVARCHAR}, </if> <if test="itemScore != null" > #{itemScore,jdbcType=NUMERIC}, </if> <if test="assessmentNo != null" > #{assessmentNo,jdbcType=VARCHAR}, </if> <if test="templateNo != null" > #{templateNo,jdbcType=VARCHAR}, </if> <if test="selfAssessment != null" > #{selfAssessment,jdbcType=NUMERIC}, </if> <if test="leaderGrade != null" > #{leaderGrade,jdbcType=NUMERIC}, </if> </trim> </insert> <update id="updateAssessmentItem" parameterType="com.newfiber.api.pc.model.Assessment.AssessmentItem" > update assessment_item <set > <if test="itemName != null" > Item_Name = #{itemName,jdbcType=NVARCHAR}, </if> <if test="itemScore"> Item_Score = #{itemScore,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 Item_No = #{itemNo,jdbcType=VARCHAR} </update> </mapper>