<?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.zehong.system.mapper.TPointInfoMapper">
    
    <resultMap type="TPointInfo" id="TPointInfoResult">
        <result property="fPointId"    column="f_point_id"    />
        <result property="fTrayId"    column="f_tray_id"    />
        <result property="fPointCode"    column="f_point_code"    />
        <result property="fPcbaCode"    column="f_pcba_code"    />
        <result property="fStatus"    column="f_status"    />
        <result property="fCreateTime"    column="f_create_time"    />
        <result property="fPcbaStatus"    column="f_pcba_status"    />
        <result property="fBindingTime"    column="f_binding_time"    />
        <result property="fUnbindingTime"    column="f_unbinding_time"    />
        <result property="fLoadingTime"    column="f_loading_time"    />
    </resultMap>

    <sql id="selectTPointInfoVo">
        select f_point_id, f_tray_id, f_point_code, f_pcba_code, f_status, f_create_time, f_pcba_status, f_binding_time, f_unbinding_time, f_loading_time from t_point_info
    </sql>

    <select id="selectTPointInfoList" parameterType="TPointInfo" resultMap="TPointInfoResult">
        <include refid="selectTPointInfoVo"/>
        <where>  
            <if test="fTrayId != null "> and f_tray_id = #{fTrayId}</if>
            <if test="fPointCode != null  and fPointCode != ''"> and f_point_code = #{fPointCode}</if>
            <if test="fPcbaCode != null  and fPcbaCode != ''"> and f_pcba_code = #{fPcbaCode}</if>
            <if test="fStatus != null  and fStatus != ''"> and f_status = #{fStatus}</if>
            <if test="fCreateTime != null "> and f_create_time = #{fCreateTime}</if>
            <if test="fPcbaStatus != null  and fPcbaStatus != ''"> and f_pcba_status = #{fPcbaStatus}</if>
            <if test="fBindingTime != null "> and f_binding_time = #{fBindingTime}</if>
            <if test="fUnbindingTime != null "> and f_unbinding_time = #{fUnbindingTime}</if>
            <if test="fLoadingTime != null "> and f_loading_time = #{fLoadingTime}</if>
        </where>
    </select>
    
    <select id="selectTPointInfoById" parameterType="Long" resultMap="TPointInfoResult">
        <include refid="selectTPointInfoVo"/>
        where f_point_id = #{fPointId}
    </select>
        
    <insert id="insertTPointInfo" parameterType="TPointInfo" useGeneratedKeys="true" keyProperty="fPointId">
        insert into t_point_info
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="fTrayId != null">f_tray_id,</if>
            <if test="fPointCode != null">f_point_code,</if>
            <if test="fPcbaCode != null">f_pcba_code,</if>
            <if test="fStatus != null">f_status,</if>
            <if test="fCreateTime != null">f_create_time,</if>
            <if test="fPcbaStatus != null">f_pcba_status,</if>
            <if test="fBindingTime != null">f_binding_time,</if>
            <if test="fUnbindingTime != null">f_unbinding_time,</if>
            <if test="fLoadingTime != null">f_loading_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="fTrayId != null">#{fTrayId},</if>
            <if test="fPointCode != null">#{fPointCode},</if>
            <if test="fPcbaCode != null">#{fPcbaCode},</if>
            <if test="fStatus != null">#{fStatus},</if>
            <if test="fCreateTime != null">#{fCreateTime},</if>
            <if test="fPcbaStatus != null">#{fPcbaStatus},</if>
            <if test="fBindingTime != null">#{fBindingTime},</if>
            <if test="fUnbindingTime != null">#{fUnbindingTime},</if>
            <if test="fLoadingTime != null">#{fLoadingTime},</if>
         </trim>
    </insert>

    <update id="updateTPointInfo" parameterType="TPointInfo">
        update t_point_info
        <trim prefix="SET" suffixOverrides=",">
            <if test="fTrayId != null">f_tray_id = #{fTrayId},</if>
            <if test="fPointCode != null">f_point_code = #{fPointCode},</if>
            <if test="fPcbaCode != null">f_pcba_code = #{fPcbaCode},</if>
            <if test="fStatus != null">f_status = #{fStatus},</if>
            <if test="fCreateTime != null">f_create_time = #{fCreateTime},</if>
            <if test="fPcbaStatus != null">f_pcba_status = #{fPcbaStatus},</if>
            <if test="fBindingTime != null">f_binding_time = #{fBindingTime},</if>
            <if test="fUnbindingTime != null">f_unbinding_time = #{fUnbindingTime},</if>
            <if test="fLoadingTime != null">f_loading_time = #{fLoadingTime},</if>
        </trim>
        where f_point_id = #{fPointId}
    </update>

    <delete id="deleteTPointInfoById" parameterType="Long">
        delete from t_point_info where f_point_id = #{fPointId}
    </delete>

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