<?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.cpms.project.process.mapper.TSifOverviewMapper">
    
    <resultMap type="TSifOverview" id="TSifOverviewResult">
        <result property="id"    column="id"    />
        <result property="sifNo"    column="sif_no"    />
        <result property="deviation"    column="deviation"    />
        <result property="sheNo"    column="she_no"    />
        <result property="cac"    column="cac"    />
        <result property="requriedSil"    column="requried_sil"    />
        <result property="sensors"    column="sensors"    />
        <result property="sVoting"    column="s_voting"    />
        <result property="finalElements"    column="final_elements"    />
        <result property="fVoting"    column="f_voting"    />
        <result property="action"    column="action"    />
        <result property="achievedSil"    column="achieved_sil"    />
        <result property="pfdCr"    column="pfd_cr"    />
        <result property="remarks"    column="remarks"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="createrCode"    column="creater_code"    />
        <result property="createdate"    column="createdate"    />
        <result property="updaterCode"    column="updater_code"    />
        <result property="updatedate"    column="updatedate"    />
        <result property="deptId"    column="dept_id"    />
    </resultMap>

    <sql id="selectTSifOverviewVo">
        select id, sif_no, deviation, she_no, cac, requried_sil, sensors, s_voting, final_elements, f_voting, action, achieved_sil, pfd_cr, remarks, del_flag, creater_code, createdate, updater_code, updatedate, dept_id from t_sif_overview
    </sql>

    <select id="selectTSifOverviewList" parameterType="TSifOverview" resultMap="TSifOverviewResult">
        <include refid="selectTSifOverviewVo"/>
        <where>  
            <if test="sifNo != null  and sifNo != ''"> and sif_no = #{sifNo}</if>
            <if test="deviation != null  and deviation != ''"> and deviation = #{deviation}</if>
            <if test="sheNo != null  and sheNo != ''"> and she_no = #{sheNo}</if>
            <if test="cac != null  and cac != ''"> and cac = #{cac}</if>
            <if test="requriedSil != null  and requriedSil != ''"> and requried_sil = #{requriedSil}</if>
            <if test="sensors != null  and sensors != ''"> and sensors = #{sensors}</if>
            <if test="sVoting != null  and sVoting != ''"> and s_voting = #{sVoting}</if>
            <if test="finalElements != null  and finalElements != ''"> and final_elements = #{finalElements}</if>
            <if test="fVoting != null  and fVoting != ''"> and f_voting = #{fVoting}</if>
            <if test="action != null  and action != ''"> and action = #{action}</if>
            <if test="achievedSil != null  and achievedSil != ''"> and achieved_sil = #{achievedSil}</if>
            <if test="pfdCr != null  and pfdCr != ''"> and pfd_cr = #{pfdCr}</if>
            <if test="remarks != null  and remarks != ''"> and remarks = #{remarks}</if>
            <if test="createrCode != null  and createrCode != ''"> and creater_code = #{createrCode}</if>
            <if test="createdate != null "> and createdate = #{createdate}</if>
            <if test="updaterCode != null  and updaterCode != ''"> and updater_code = #{updaterCode}</if>
            <if test="updatedate != null "> and updatedate = #{updatedate}</if>
            <if test="deptId != null "> and dept_id = #{deptId}</if>
        </where>
    </select>
    
    <select id="selectTSifOverviewById" parameterType="Long" resultMap="TSifOverviewResult">
        <include refid="selectTSifOverviewVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertTSifOverview" parameterType="TSifOverview" useGeneratedKeys="true" keyProperty="id">
        insert into t_sif_overview
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="sifNo != null">sif_no,</if>
            <if test="deviation != null">deviation,</if>
            <if test="sheNo != null">she_no,</if>
            <if test="cac != null">cac,</if>
            <if test="requriedSil != null">requried_sil,</if>
            <if test="sensors != null">sensors,</if>
            <if test="sVoting != null">s_voting,</if>
            <if test="finalElements != null">final_elements,</if>
            <if test="fVoting != null">f_voting,</if>
            <if test="action != null">action,</if>
            <if test="achievedSil != null">achieved_sil,</if>
            <if test="pfdCr != null">pfd_cr,</if>
            <if test="remarks != null">remarks,</if>
            <if test="delFlag != null">del_flag,</if>
            <if test="createrCode != null">creater_code,</if>
            <if test="createdate != null">createdate,</if>
            <if test="updaterCode != null">updater_code,</if>
            <if test="updatedate != null">updatedate,</if>
            <if test="deptId != null">dept_id,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="sifNo != null">#{sifNo},</if>
            <if test="deviation != null">#{deviation},</if>
            <if test="sheNo != null">#{sheNo},</if>
            <if test="cac != null">#{cac},</if>
            <if test="requriedSil != null">#{requriedSil},</if>
            <if test="sensors != null">#{sensors},</if>
            <if test="sVoting != null">#{sVoting},</if>
            <if test="finalElements != null">#{finalElements},</if>
            <if test="fVoting != null">#{fVoting},</if>
            <if test="action != null">#{action},</if>
            <if test="achievedSil != null">#{achievedSil},</if>
            <if test="pfdCr != null">#{pfdCr},</if>
            <if test="remarks != null">#{remarks},</if>
            <if test="delFlag != null">#{delFlag},</if>
            <if test="createrCode != null">#{createrCode},</if>
            <if test="createdate != null">#{createdate},</if>
            <if test="updaterCode != null">#{updaterCode},</if>
            <if test="updatedate != null">#{updatedate},</if>
            <if test="deptId != null">#{deptId},</if>
         </trim>
    </insert>

    <update id="updateTSifOverview" parameterType="TSifOverview">
        update t_sif_overview
        <trim prefix="SET" suffixOverrides=",">
            <if test="sifNo != null">sif_no = #{sifNo},</if>
            <if test="deviation != null">deviation = #{deviation},</if>
            <if test="sheNo != null">she_no = #{sheNo},</if>
            <if test="cac != null">cac = #{cac},</if>
            <if test="requriedSil != null">requried_sil = #{requriedSil},</if>
            <if test="sensors != null">sensors = #{sensors},</if>
            <if test="sVoting != null">s_voting = #{sVoting},</if>
            <if test="finalElements != null">final_elements = #{finalElements},</if>
            <if test="fVoting != null">f_voting = #{fVoting},</if>
            <if test="action != null">action = #{action},</if>
            <if test="achievedSil != null">achieved_sil = #{achievedSil},</if>
            <if test="pfdCr != null">pfd_cr = #{pfdCr},</if>
            <if test="remarks != null">remarks = #{remarks},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</if>
            <if test="createrCode != null">creater_code = #{createrCode},</if>
            <if test="createdate != null">createdate = #{createdate},</if>
            <if test="updaterCode != null">updater_code = #{updaterCode},</if>
            <if test="updatedate != null">updatedate = #{updatedate},</if>
            <if test="deptId != null">dept_id = #{deptId},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTSifOverviewById" parameterType="Long">
        delete from t_sif_overview where id = #{id}
    </delete>

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