<?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.cirs.biz.mapper.TVerificationTaskDetailMapper">
    
    <resultMap type="TVerificationTaskDetail" id="TVerificationTaskDetailResult">
        <result property="id"    column="id"    />
        <result property="taskId"    column="task_id"    />
        <result property="useScene" column="use_scene"/>
        <result property="searchCondition"    column="search_condition"    />
        <result property="result1"    column="result1"    />
        <result property="result2"    column="result2"    />
        <result property="result3"    column="result3"    />
        <result property="result4"    column="result4"    />
        <result property="result5"    column="result5"    />
        <result property="calculate1"    column="calculate1"    />
        <result property="calculate2"    column="calculate2"    />
        <result property="calculate3"    column="calculate3"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="remark"    column="remark"    />
    </resultMap>

    <sql id="selectTVerificationTaskDetailVo">
        select id, task_id, use_scene,search_condition, result1, result2, result3, result4, result5, calculate1, calculate2, calculate3, create_by, create_time, update_by, update_time, remark from t_verification_task_detail
    </sql>

    <select id="selectTVerificationTaskDetailList" parameterType="TVerificationTaskDetail" resultMap="TVerificationTaskDetailResult">
        <include refid="selectTVerificationTaskDetailVo"/>
        <where>  
            <if test="taskId != null  and taskId != ''"> and task_id = #{taskId}</if>
             <if test="useScene != null and useScene != ''"> and use_scene = #{useScene}</if>
            <if test="searchCondition != null  and searchCondition != ''"> and search_condition = #{searchCondition}</if>
            <if test="result1 != null  and result1 != ''"> and result1 = #{result1}</if>
            <if test="result2 != null  and result2 != ''"> and result2 = #{result2}</if>
            <if test="result3 != null  and result3 != ''"> and result3 = #{result3}</if>
            <if test="result4 != null  and result4 != ''"> and result4 = #{result4}</if>
            <if test="result5 != null  and result5 != ''"> and result5 = #{result5}</if>
            <if test="calculate1 != null  and calculate1 != ''"> and calculate1 = #{calculate1}</if>
            <if test="calculate2 != null  and calculate2 != ''"> and calculate2 = #{calculate2}</if>
            <if test="calculate3 != null  and calculate3 != ''"> and calculate3 = #{calculate3}</if>

        </where>
    </select>
    
    <select id="selectTVerificationTaskDetailById" parameterType="Long" resultMap="TVerificationTaskDetailResult">
        <include refid="selectTVerificationTaskDetailVo"/>
        where id = #{id}
    </select>
    <select id="selectTVerificationTaskDetailByTaskIds"
            resultType="com.cirs.biz.domain.TVerificationTaskDetail" resultMap="TVerificationTaskDetailResult">
        select task_id, use_scene,search_condition, result1, result2, result3, result4, result5, calculate1, calculate2, calculate3, create_by, create_time, update_by, update_time, remark from t_verification_task_detail
            where task_id in
        <foreach item="item" collection="taskids" index="index" open="(" separator="," close=")">
            #{item}
        </foreach>
    </select>

    <insert id="insertTVerificationTaskDetail" parameterType="TVerificationTaskDetail" useGeneratedKeys="true" keyProperty="id">
        insert into t_verification_task_detail
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="taskId != null">task_id,</if>
            <if test="useScene != null">use_scene,</if>
            <if test="searchCondition != null">search_condition,</if>
            <if test="result1 != null">result1,</if>
            <if test="result2 != null">result2,</if>
            <if test="result3 != null">result3,</if>
            <if test="result4 != null">result4,</if>
            <if test="result5 != null">result5,</if>
            <if test="calculate1 != null">calculate1,</if>
            <if test="calculate2 != null">calculate2,</if>
            <if test="calculate3 != null">calculate3,</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>
            <if test="remark != null">remark,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="taskId != null">#{taskId},</if>
            <if test="useScene != null">#{useScene},</if>
            <if test="searchCondition != null">#{searchCondition},</if>
            <if test="result1 != null">#{result1},</if>
            <if test="result2 != null">#{result2},</if>
            <if test="result3 != null">#{result3},</if>
            <if test="result4 != null">#{result4},</if>
            <if test="result5 != null">#{result5},</if>
            <if test="calculate1 != null">#{calculate1},</if>
            <if test="calculate2 != null">#{calculate2},</if>
            <if test="calculate3 != null">#{calculate3},</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>
            <if test="remark != null">#{remark},</if>
         </trim>
    </insert>

    <update id="updateTVerificationTaskDetail" parameterType="TVerificationTaskDetail">
        update t_verification_task_detail
        <trim prefix="SET" suffixOverrides=",">
            <if test="taskId != null">task_id = #{taskId},</if>
            <if test="useScene != null">use_scene = #{useScene},</if>
            <if test="searchCondition != null">search_condition = #{searchCondition},</if>
            <if test="result1 != null">result1 = #{result1},</if>
            <if test="result2 != null">result2 = #{result2},</if>
            <if test="result3 != null">result3 = #{result3},</if>
            <if test="result4 != null">result4 = #{result4},</if>
            <if test="result5 != null">result5 = #{result5},</if>
            <if test="calculate1 != null">calculate1 = #{calculate1},</if>
            <if test="calculate2 != null">calculate2 = #{calculate2},</if>
            <if test="calculate3 != null">calculate3 = #{calculate3},</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>
            <if test="remark != null">remark = #{remark},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTVerificationTaskDetailById" parameterType="Long">
        delete from t_verification_task_detail where id = #{id}
    </delete>

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