<?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.TLpgAirChargeFilesMapper">
    
    <resultMap type="TLpgAirChargeFiles" id="TLpgAirChargeFilesResult">
        <result property="fGasAirChargeId"    column="f_gas_air_charge_id"    />
        <result property="fGzId"    column="f_gz_id"    />
        <result property="fStationName"    column="f_station_name"    />
        <result property="fBarCode"    column="f_bar_code"    />
        <result property="fVaseCode"    column="f_vase_code"    />
        <result property="fScaleNum"    column="f_scale_num"    />
        <result property="fFillStatrTime"    column="f_fill_statr_time"    />
        <result property="fFillEndTime"    column="f_fill_end_time"    />
        <result property="fSetWeight"    column="f_set_weight"    />
        <result property="fWtNet"    column="f_wt_net"    />
        <result property="fSetBottleWeight"    column="f_set_bottle_weight"    />
        <result property="fBottleWeight"    column="f_bottle_weight"    />
        <result property="fWtGross"    column="f_wt_gross"    />
        <result property="fOprateName"    column="f_oprate_name"    />
    </resultMap>

    <sql id="selectTLpgAirChargeFilesVo">
        select f_gas_air_charge_id, f_gz_id, f_station_name, f_bar_code, f_vase_code, f_scale_num, f_fill_statr_time, f_fill_end_time, f_set_weight, f_wt_net, f_set_bottle_weight, f_bottle_weight, f_wt_gross, f_oprate_name from t_lpg_air_charge_files
    </sql>

    <select id="selectTLpgAirChargeFilesList" parameterType="TLpgAirChargeFiles" resultMap="TLpgAirChargeFilesResult">
        <include refid="selectTLpgAirChargeFilesVo"/>
        <where>  
            <if test="fVaseCode != null  and fVaseCode != ''"> and f_vase_code like concat('%', #{fVaseCode}, '%') </if>
        </where>
    </select>
    
    <select id="selectTLpgAirChargeFilesById" parameterType="Long" resultMap="TLpgAirChargeFilesResult">
        <include refid="selectTLpgAirChargeFilesVo"/>
        where f_gas_air_charge_id = #{fGasAirChargeId}
    </select>

    <select id="selectTLpgAirChargeFilesTotal" resultType="int">
        SELECT COUNT(*) FROM t_lpg_air_charge_files
    </select>
        
    <insert id="insertTLpgAirChargeFiles" parameterType="TLpgAirChargeFiles" useGeneratedKeys="true" keyProperty="fGasAirChargeId">
        insert into t_lpg_air_charge_files
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="fGzId != null">f_gz_id,</if>
            <if test="fStationName != null">f_station_name,</if>
            <if test="fBarCode != null">f_bar_code,</if>
            <if test="fVaseCode != null">f_vase_code,</if>
            <if test="fScaleNum != null">f_scale_num,</if>
            <if test="fFillStatrTime != null">f_fill_statr_time,</if>
            <if test="fFillEndTime != null">f_fill_end_time,</if>
            <if test="fSetWeight != null">f_set_weight,</if>
            <if test="fWtNet != null">f_wt_net,</if>
            <if test="fSetBottleWeight != null">f_set_bottle_weight,</if>
            <if test="fBottleWeight != null">f_bottle_weight,</if>
            <if test="fWtGross != null">f_wt_gross,</if>
            <if test="fOprateName != null">f_oprate_name,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="fGzId != null">#{fGzId},</if>
            <if test="fStationName != null">#{fStationName},</if>
            <if test="fBarCode != null">#{fBarCode},</if>
            <if test="fVaseCode != null">#{fVaseCode},</if>
            <if test="fScaleNum != null">#{fScaleNum},</if>
            <if test="fFillStatrTime != null">#{fFillStatrTime},</if>
            <if test="fFillEndTime != null">#{fFillEndTime},</if>
            <if test="fSetWeight != null">#{fSetWeight},</if>
            <if test="fWtNet != null">#{fWtNet},</if>
            <if test="fSetBottleWeight != null">#{fSetBottleWeight},</if>
            <if test="fBottleWeight != null">#{fBottleWeight},</if>
            <if test="fWtGross != null">#{fWtGross},</if>
            <if test="fOprateName != null">#{fOprateName},</if>
         </trim>
    </insert>

    <update id="updateTLpgAirChargeFiles" parameterType="TLpgAirChargeFiles">
        update t_lpg_air_charge_files
        <trim prefix="SET" suffixOverrides=",">
            <if test="fGzId != null">f_gz_id = #{fGzId},</if>
            <if test="fStationName != null">f_station_name = #{fStationName},</if>
            <if test="fBarCode != null">f_bar_code = #{fBarCode},</if>
            <if test="fVaseCode != null">f_vase_code = #{fVaseCode},</if>
            <if test="fScaleNum != null">f_scale_num = #{fScaleNum},</if>
            <if test="fFillStatrTime != null">f_fill_statr_time = #{fFillStatrTime},</if>
            <if test="fFillEndTime != null">f_fill_end_time = #{fFillEndTime},</if>
            <if test="fSetWeight != null">f_set_weight = #{fSetWeight},</if>
            <if test="fWtNet != null">f_wt_net = #{fWtNet},</if>
            <if test="fSetBottleWeight != null">f_set_bottle_weight = #{fSetBottleWeight},</if>
            <if test="fBottleWeight != null">f_bottle_weight = #{fBottleWeight},</if>
            <if test="fWtGross != null">f_wt_gross = #{fWtGross},</if>
            <if test="fOprateName != null">f_oprate_name = #{fOprateName},</if>
        </trim>
        where f_gas_air_charge_id = #{fGasAirChargeId}
    </update>

    <delete id="deleteTLpgAirChargeFilesById" parameterType="Long">
        delete from t_lpg_air_charge_files where f_gas_air_charge_id = #{fGasAirChargeId}
    </delete>

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