<?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.zcxk.evaluation.dao.EvaluationResultDetailsMapper" >


    <insert id="insertEvaluationResultDetails">
        insert sc_evaluation_result_details (TENANT_ID,EVALUATION_RESULT_ID,EVALUATION_ITEM_ID,`VALUE`,`STATUS`,DATE_CREATE,CREATE_BY,DATE_UPDATE,UPDATE_BY)
        values (#{tenantId}, #{evaluationResultId}, #{evaluationItemId}, #{value}, #{status}, #{dateCreate}, #{createBy}, #{dateUpdate}, #{updateBy})
    </insert>

    <select id="findResultDetailsIds" resultType="java.lang.Integer">
        select  d.id
        from  sc_evaluation_result r
        INNER JOIN sc_evaluation_result_details d  on d.EVALUATION_RESULT_ID = r.ID
        where
            r.id = #{evaluationResultId}
            and r.status = 1 and d.status = 1
    </select>

    <update id="updateEvaluateScore">
        update sc_evaluation_result_details
        set `VALUE` = #{score}
        where id = #{detailId}
    </update>
</mapper>