<?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.cn.fdapfe.biz.mapper.PerformanceEvaluationMapper">
    
    <resultMap type="PerformanceEvaluation" id="PerformanceEvaluationResult">
        <result property="id"    column="id"    />
        <result property="name"    column="name"    />
        <result property="type"    column="type"    />
        <result property="loopCount"    column="loop_count"    />
        <result property="fdAlgorithmId"    column="fd_algorithm_id"    />
        <result property="truthLabels"    column="truth_labels"    />
        <result property="phyModelId"    column="phy_model_id"    />
        <result property="phyParams"    column="phy_params"    />
        <result property="phyDataIds"    column="phy_data_ids"    />
        <result property="noseModelId"    column="nose_model_id"    />
        <result property="noseParams"    column="nose_params"    />
        <result property="noseDataIds"    column="nose_data_ids"    />
        <result property="testModelId"    column="test_model_id"    />
        <result property="testParams"    column="test_params"    />
        <result property="testDataIds"    column="test_data_ids"    />
        <result property="resultImagePath"    column="result_image_path"    />
        <result property="resultFilePath"    column="result_file_path"    />
        <result property="resultText"    column="result_text"    />
        <result property="remark"    column="remark"    />
        <result property="startTime"    column="start_time"    />
        <result property="endTime"    column="end_time"    />
        <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="selectPerformanceEvaluationVo">
        select id, name, type, loop_count, fd_algorithm_id, truth_labels, phy_model_id, phy_params, phy_data_ids, nose_model_id, nose_params, nose_data_ids, test_model_id, test_params, test_data_ids, result_image_path, result_file_path, result_text, remark, start_time, end_time, create_by, create_time, update_by, update_time from biz_performance_evaluation
    </sql>

    <select id="selectPerformanceEvaluationList" parameterType="PerformanceEvaluation" resultMap="PerformanceEvaluationResult">
        <include refid="selectPerformanceEvaluationVo"/>
        <where>  
            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
            <if test="type != null  and type != ''"> and type = #{type}</if>
            <if test="fdAlgorithmId != null "> and fd_algorithm_id = #{fdAlgorithmId}</if>
            <if test="truthLabels != null  and truthLabels != ''"> and truth_labels = #{truthLabels}</if>
        </where>
    </select>
    
    <select id="selectPerformanceEvaluationById" parameterType="Long" resultMap="PerformanceEvaluationResult">
        <include refid="selectPerformanceEvaluationVo"/>
        where id = #{id}
    </select>

    <insert id="insertPerformanceEvaluation" parameterType="PerformanceEvaluation" useGeneratedKeys="true" keyProperty="id">
        insert into biz_performance_evaluation
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="name != null">name,</if>
            <if test="type != null">type,</if>
            <if test="loopCount != null">loop_count,</if>
            <if test="fdAlgorithmId != null">fd_algorithm_id,</if>
            <if test="truthLabels != null">truth_labels,</if>
            <if test="phyModelId != null">phy_model_id,</if>
            <if test="phyParams != null">phy_params,</if>
            <if test="phyDataIds != null">phy_data_ids,</if>
            <if test="noseModelId != null">nose_model_id,</if>
            <if test="noseParams != null">nose_params,</if>
            <if test="noseDataIds != null">nose_data_ids,</if>
            <if test="testModelId != null">test_model_id,</if>
            <if test="testParams != null">test_params,</if>
            <if test="testDataIds != null">test_data_ids,</if>
            <if test="resultImagePath != null">result_image_path,</if>
            <if test="resultFilePath != null">result_file_path,</if>
            <if test="resultText != null">result_text,</if>
            <if test="remark != null">remark,</if>
            <if test="startTime != null">start_time,</if>
            <if test="endTime != null">end_time,</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="name != null">#{name},</if>
            <if test="type != null">#{type},</if>
            <if test="loopCount != null">#{loopCount},</if>
            <if test="fdAlgorithmId != null">#{fdAlgorithmId},</if>
            <if test="truthLabels != null">#{truthLabels},</if>
            <if test="phyModelId != null">#{phyModelId},</if>
            <if test="phyParams != null">#{phyParams},</if>
            <if test="phyDataIds != null">#{phyDataIds},</if>
            <if test="noseModelId != null">#{noseModelId},</if>
            <if test="noseParams != null">#{noseParams},</if>
            <if test="noseDataIds != null">#{noseDataIds},</if>
            <if test="testModelId != null">#{testModelId},</if>
            <if test="testParams != null">#{testParams},</if>
            <if test="testDataIds != null">#{testDataIds},</if>
            <if test="resultImagePath != null">#{resultImagePath},</if>
            <if test="resultFilePath != null">#{resultFilePath},</if>
            <if test="resultText != null">#{resultText},</if>
            <if test="remark != null">#{remark},</if>
            <if test="startTime != null">#{startTime},</if>
            <if test="endTime != null">#{endTime},</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="updatePerformanceEvaluation" parameterType="PerformanceEvaluation">
        update biz_performance_evaluation
        <trim prefix="SET" suffixOverrides=",">
            <if test="name != null">name = #{name},</if>
            <if test="type != null">type = #{type},</if>
            <if test="loopCount != null">loop_count = #{loopCount},</if>
            <if test="fdAlgorithmId != null">fd_algorithm_id = #{fdAlgorithmId},</if>
            <if test="truthLabels != null">truth_labels = #{truthLabels},</if>
            <if test="phyModelId != null">phy_model_id = #{phyModelId},</if>
            <if test="phyParams != null">phy_params = #{phyParams},</if>
            <if test="phyDataIds != null">phy_data_ids = #{phyDataIds},</if>
            <if test="noseModelId != null">nose_model_id = #{noseModelId},</if>
            <if test="noseParams != null">nose_params = #{noseParams},</if>
            <if test="noseDataIds != null">nose_data_ids = #{noseDataIds},</if>
            <if test="testModelId != null">test_model_id = #{testModelId},</if>
            <if test="testParams != null">test_params = #{testParams},</if>
            <if test="testDataIds != null">test_data_ids = #{testDataIds},</if>
            <if test="resultImagePath != null">result_image_path = #{resultImagePath},</if>
            <if test="resultFilePath != null">result_file_path = #{resultFilePath},</if>
            <if test="resultText != null">result_text = #{resultText},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="startTime != null">start_time = #{startTime},</if>
            <if test="endTime != null">end_time = #{endTime},</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="deletePerformanceEvaluationById" parameterType="Long">
        delete from biz_performance_evaluation where id = #{id}
    </delete>

    <delete id="deletePerformanceEvaluationByIds" parameterType="String">
        delete from biz_performance_evaluation where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>