<?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.sooka.system.gas.zenner_gas_purchase_infor.mapper.TGuijiZennerGasPurchaseMapper">

    <sql id="selectVo">
        select id, GUID, VC_SG_USERGUID, N_SG_BEFOREAMOUNT, N_SG_SHOULDAMOUNT, N_SG_FACTAMOUNT, N_SG_LASTAMOUNT, VC_SG_IVNO, VC_SG_OPCODE, D_SG_SALEDATE, VC_SG_SALEORBACK from t_guiji_gas_zenner_gas_purchase_infor
    </sql>

    <select id="selectList" parameterType="TGuijiZennerGasPurchaseInfor" resultType="TGuijiZennerGasPurchaseInfor">
        <include refid="selectVo"/>
        <where>
            <if test="GUID != null  and GUID != ''"> and GUID like concat('%', #{GUID}, '%')</if>
            <if test="VC_SG_USERGUID != null  and VC_SG_USERGUID != ''"> and VC_SG_USERGUID like concat('%', #{VC_SG_USERGUID}, '%')</if>
            <if test="N_SG_BEFOREAMOUNT != null  and N_SG_BEFOREAMOUNT != ''"> and N_SG_BEFOREAMOUNT like concat('%', #{N_SG_BEFOREAMOUNT}, '%')</if>
            <if test="N_SG_SHOULDAMOUNT != null  and N_SG_SHOULDAMOUNT != ''"> and N_SG_SHOULDAMOUNT like concat('%', #{N_SG_SHOULDAMOUNT}, '%')</if>
            <if test="N_SG_FACTAMOUNT != null  and N_SG_FACTAMOUNT != ''"> and N_SG_FACTAMOUNT like concat('%', #{N_SG_FACTAMOUNT}, '%')</if>
            <if test="N_SG_LASTAMOUNT != null  and N_SG_LASTAMOUNT != ''"> and N_SG_LASTAMOUNT like concat('%', #{N_SG_LASTAMOUNT}, '%')</if>
            <if test="VC_SG_IVNO != null  and VC_SG_IVNO != ''"> and VC_SG_IVNO like concat('%', #{VC_SG_IVNO}, '%')</if>
            <if test="VC_SG_OPCODE != null  and VC_SG_OPCODE != ''"> and VC_SG_OPCODE like concat('%', #{VC_SG_OPCODE}, '%')</if>
            <if test="D_SG_SALEDATE != null  and D_SG_SALEDATE != ''"> and D_SG_SALEDATE like concat('%', #{D_SG_SALEDATE}, '%')</if>
            <if test="VC_SG_SALEORBACK != null  and VC_SG_SALEORBACK != ''"> and VC_SG_SALEORBACK like concat('%', #{VC_SG_SALEORBACK}, '%')</if>
        </where>
    </select>

    <select id="selectById" parameterType="String" resultType="TGuijiZennerGasPurchaseInfor">
        <include refid="selectVo"/>
        where id = #{id}
    </select>

    <insert id="insert" parameterType="TGuijiZennerGasPurchaseInfor">
        insert into t_guiji_gas_zenner_gas_purchase_infor
        <trim prefix="(" suffix=")" suffixOverrides=",">
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
         </trim>
    </insert>

    <update id="update" parameterType="TGuijiZennerGasPurchaseInfor">
        update t_guiji_gas_zenner_gas_purchase_infor
        <trim prefix="SET" suffixOverrides=",">
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteById" parameterType="String">
        delete from t_guiji_gas_zenner_gas_purchase_infor where id = #{id}
    </delete>

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

</mapper>
