<?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_center_infor.mapper.TGuijiZennerGasPurchaseCenterMapper">

    <sql id="selectVo">
        select id, GUID, VC_JFD_USERGUID, N_JFD_BEFORENUM, N_JFD_LASTNUM, N_JFD_BEFOREAMOUNT, N_JFD_AMOUNT, N_JFD_LASTAMOUNT, VC_JFD_INVOICE, VC_JFH_SKPERSON, D_JFH_SKDATE, VC_JFD_SKTYPE from t_guiji_gas_zenner_gas_purchase_center_infor
    </sql>

    <select id="selectList" parameterType="TGuijiZennerGasPurchaseCenterInfor" resultType="TGuijiZennerGasPurchaseCenterInfor">
        <include refid="selectVo"/>
        <where>
            <if test="GUID != null  and GUID != ''"> and GUID like concat('%', #{GUID}, '%')</if>
            <if test="VC_JFD_USERGUID != null  and VC_JFD_USERGUID != ''"> and VC_JFD_USERGUID like concat('%', #{VC_JFD_USERGUID}, '%')</if>
            <if test="N_JFD_BEFORENUM != null  and N_JFD_BEFORENUM != ''"> and N_JFD_BEFORENUM like concat('%', #{N_JFD_BEFORENUM}, '%')</if>
            <if test="N_JFD_LASTNUM != null  and N_JFD_LASTNUM != ''"> and N_JFD_LASTNUM like concat('%', #{N_JFD_LASTNUM}, '%')</if>
            <if test="N_JFD_BEFOREAMOUNT != null  and N_JFD_BEFOREAMOUNT != ''"> and N_JFD_BEFOREAMOUNT like concat('%', #{N_JFD_BEFOREAMOUNT}, '%')</if>
            <if test="N_JFD_AMOUNT != null  and N_JFD_AMOUNT != ''"> and N_JFD_AMOUNT like concat('%', #{N_JFD_AMOUNT}, '%')</if>
            <if test="N_JFD_LASTAMOUNT != null  and N_JFD_LASTAMOUNT != ''"> and N_JFD_LASTAMOUNT like concat('%', #{N_JFD_LASTAMOUNT}, '%')</if>
            <if test="VC_JFD_INVOICE != null  and VC_JFD_INVOICE != ''"> and VC_JFD_INVOICE like concat('%', #{VC_JFD_INVOICE}, '%')</if>
            <if test="VC_JFH_SKPERSON != null  and VC_JFH_SKPERSON != ''"> and VC_JFH_SKPERSON like concat('%', #{VC_JFH_SKPERSON}, '%')</if>
            <if test="D_JFH_SKDATE != null  and D_JFH_SKDATE != ''"> and D_JFH_SKDATE like concat('%', #{D_JFH_SKDATE}, '%')</if>
            <if test="VC_JFD_SKTYPE != null  and VC_JFD_SKTYPE != ''"> and VC_JFD_SKTYPE like concat('%', #{VC_JFD_SKTYPE}, '%')</if>
        </where>
    </select>

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

    <select id="selectListbyIds" parameterType="java.util.Map" resultType="TGuijiZennerGasPurchaseCenterInfor">
        <include refid="selectVo"/>
        where id in (${ids})
    </select>

    <select id="selectIds" parameterType="TGuijiZennerGasPurchaseCenterInfor" resultType="TGuijiZennerGasPurchaseCenterInfor">
        select id from t_guiji_gas_zenner_gas_purchase_center_infor
        where 1 = 1
        <if test="GUID != null  and GUID != ''"> and GUID like concat('%', #{GUID}, '%')</if>
        <if test="VC_JFD_USERGUID != null  and VC_JFD_USERGUID != ''"> and VC_JFD_USERGUID like concat('%', #{VC_JFD_USERGUID}, '%')</if>
        <if test="N_JFD_BEFORENUM != null  and N_JFD_BEFORENUM != ''"> and N_JFD_BEFORENUM like concat('%', #{N_JFD_BEFORENUM}, '%')</if>
        <if test="N_JFD_LASTNUM != null  and N_JFD_LASTNUM != ''"> and N_JFD_LASTNUM like concat('%', #{N_JFD_LASTNUM}, '%')</if>
        <if test="N_JFD_BEFOREAMOUNT != null  and N_JFD_BEFOREAMOUNT != ''"> and N_JFD_BEFOREAMOUNT like concat('%', #{N_JFD_BEFOREAMOUNT}, '%')</if>
        <if test="N_JFD_AMOUNT != null  and N_JFD_AMOUNT != ''"> and N_JFD_AMOUNT like concat('%', #{N_JFD_AMOUNT}, '%')</if>
        <if test="N_JFD_LASTAMOUNT != null  and N_JFD_LASTAMOUNT != ''"> and N_JFD_LASTAMOUNT like concat('%', #{N_JFD_LASTAMOUNT}, '%')</if>
        <if test="VC_JFD_INVOICE != null  and VC_JFD_INVOICE != ''"> and VC_JFD_INVOICE like concat('%', #{VC_JFD_INVOICE}, '%')</if>
        <if test="VC_JFH_SKPERSON != null  and VC_JFH_SKPERSON != ''"> and VC_JFH_SKPERSON like concat('%', #{VC_JFH_SKPERSON}, '%')</if>
        <if test="D_JFH_SKDATE != null  and D_JFH_SKDATE != ''"> and D_JFH_SKDATE like concat('%', #{D_JFH_SKDATE}, '%')</if>
        <if test="VC_JFD_SKTYPE != null  and VC_JFD_SKTYPE != ''"> and VC_JFD_SKTYPE like concat('%', #{VC_JFD_SKTYPE}, '%')</if>
        <!-- 数据分页过滤 -->
        ${params.limit}
    </select>

    <select id="getDataCount" parameterType="java.util.Map" resultType="java.lang.Long">
        select count(id) from ${tableName}
    </select>

    <insert id="createCache" parameterType="java.util.Map">
        insert into t_cache_guiji (cache_name, total, update_time) values (#{cacheName}, #{total}, #{updateTime})
    </insert>
    <update id="refreshCache" parameterType="java.util.Map">
        update t_cache_guiji set update_time = #{updateTime}, total = #{total} where cache_name = #{cacheName}
    </update>
    <update id="updateCache" parameterType="java.util.Map">
        update t_cache_guiji set update_time = #{updateTime} where cache_name = #{cacheName}
    </update>
    <select id="getCache" parameterType="java.lang.String" resultType="java.util.Map">
        select total, update_time updateTime from t_cache_guiji where cache_name = #{cacheName}
    </select>

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

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

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

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

</mapper>
