<?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.jianshui.income.mapper.IncomeInvoiceAuthCompanyStatisticsDetailMapper">
    
    <resultMap type="IncomeInvoiceAuthCompanyStatisticsDetail" id="IncomeInvoiceAuthCompanyStatisticsDetailResult">
        <result property="id"    column="id"    />
        <result property="statisticsId"    column="statistics_id"    />
        <result property="skssq"    column="skssq"    />
        <result property="gmdsbh"    column="gmdsbh"    />
        <result property="fplxdm"    column="fplxdm"    />
        <result property="dkfpfs"    column="dkfpfs"    />
        <result property="dkzje"    column="dkzje"    />
        <result property="dkzyxse"    column="dkzyxse"    />
        <result property="bdkfpfs"    column="bdkfpfs"    />
        <result property="bdkzje"    column="bdkzje"    />
        <result property="bdkzyxse"    column="bdkzyxse"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="remark"    column="remark"    />
    </resultMap>

    <sql id="selectIncomeInvoiceAuthCompanyStatisticsDetailVo">
        select id, statistics_id, skssq, gmdsbh, fplxdm, dkfpfs, dkzje, dkzyxse, bdkfpfs, bdkzje, bdkzyxse, create_by, create_time, update_by, update_time, remark from income_invoice_auth_company_statistics_detail
    </sql>

    <select id="selectIncomeInvoiceAuthCompanyStatisticsDetailList" parameterType="IncomeInvoiceAuthCompanyStatisticsDetail" resultMap="IncomeInvoiceAuthCompanyStatisticsDetailResult">
        <include refid="selectIncomeInvoiceAuthCompanyStatisticsDetailVo"/>
        <where>  
            <if test="statisticsId != null  and statisticsId != ''"> and statistics_id = #{statisticsId}</if>
            <if test="skssq != null  and skssq != ''"> and skssq = #{skssq}</if>
            <if test="gmdsbh != null  and gmdsbh != ''"> and gmdsbh = #{gmdsbh}</if>
            <if test="fplxdm != null  and fplxdm != ''"> and fplxdm = #{fplxdm}</if>
            <if test="dkfpfs != null  and dkfpfs != ''"> and dkfpfs = #{dkfpfs}</if>
            <if test="dkzje != null  and dkzje != ''"> and dkzje = #{dkzje}</if>
            <if test="dkzyxse != null  and dkzyxse != ''"> and dkzyxse = #{dkzyxse}</if>
            <if test="bdkfpfs != null  and bdkfpfs != ''"> and bdkfpfs = #{bdkfpfs}</if>
            <if test="bdkzje != null  and bdkzje != ''"> and bdkzje = #{bdkzje}</if>
            <if test="bdkzyxse != null  and bdkzyxse != ''"> and bdkzyxse = #{bdkzyxse}</if>
        </where>
    </select>

    <insert id="insertIncomeInvoiceCompanyStatisticsDetail" parameterType="IncomeInvoiceCompanyStatisticsDetail">
        insert into income_invoice_company_statistics_detail
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="statisticsId != null and statisticsId != ''">statistics_id,</if>
            <if test="skssq != null and skssq != ''">skssq,</if>
            <if test="gmdsbh != null">gmdsbh,</if>
            <if test="fplxdm != null">fplxdm,</if>
            <if test="dkfpfs != null">dkfpfs,</if>
            <if test="dkzje != null">dkzje,</if>
            <if test="dkzyxse != null">dkzyxse,</if>
            <if test="bdkfpfs != null">bdkfpfs,</if>
            <if test="bdkzje != null">bdkzje,</if>
            <if test="bdkzyxse != null">bdkzyxse,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="remark != null">remark,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="statisticsId != null and statisticsId != ''">#{statisticsId},</if>
            <if test="skssq != null and skssq != ''">#{skssq},</if>
            <if test="gmdsbh != null">#{gmdsbh},</if>
            <if test="fplxdm != null">#{fplxdm},</if>
            <if test="dkfpfs != null">#{dkfpfs},</if>
            <if test="dkzje != null">#{dkzje},</if>
            <if test="dkzyxse != null">#{dkzyxse},</if>
            <if test="bdkfpfs != null">#{bdkfpfs},</if>
            <if test="bdkzje != null">#{bdkzje},</if>
            <if test="bdkzyxse != null">#{bdkzyxse},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="remark != null">#{remark},</if>
        </trim>
    </insert>
    
    <select id="selectIncomeInvoiceAuthCompanyStatisticsDetailById" parameterType="String" resultMap="IncomeInvoiceAuthCompanyStatisticsDetailResult">
        <include refid="selectIncomeInvoiceAuthCompanyStatisticsDetailVo"/>
        where id = #{id}
    </select>

    <select id="selectIncomeInvoiceCompanyStatisticsDetailList" parameterType="IncomeInvoiceCompanyStatisticsDetail"
            resultMap="IncomeInvoiceAuthCompanyStatisticsDetailResult">
        <include refid="selectIncomeInvoiceAuthCompanyStatisticsDetailVo"/>
        <where>
            <if test="statisticsId != null  and statisticsId != ''">and statistics_id = #{statisticsId}</if>
            <if test="skssq != null  and skssq != ''">and skssq = #{skssq}</if>
            <if test="gmdsbh != null  and gmdsbh != ''">and gmdsbh = #{gmdsbh}</if>
            <if test="fplxdm != null  and fplxdm != ''">and fplxdm = #{fplxdm}</if>
            <if test="dkfpfs != null  and dkfpfs != ''">and dkfpfs = #{dkfpfs}</if>
            <if test="dkzje != null  and dkzje != ''">and dkzje = #{dkzje}</if>
            <if test="dkzyxse != null  and dkzyxse != ''">and dkzyxse = #{dkzyxse}</if>
            <if test="bdkfpfs != null  and bdkfpfs != ''">and bdkfpfs = #{bdkfpfs}</if>
            <if test="bdkzje != null  and bdkzje != ''">and bdkzje = #{bdkzje}</if>
            <if test="bdkzyxse != null  and bdkzyxse != ''">and bdkzyxse = #{bdkzyxse}</if>
        </where>
    </select>
        
    <insert id="insertIncomeInvoiceAuthCompanyStatisticsDetail" parameterType="IncomeInvoiceAuthCompanyStatisticsDetail">
        insert into income_invoice_auth_company_statistics_detail
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="statisticsId != null and statisticsId != ''">statistics_id,</if>
            <if test="skssq != null and skssq != ''">skssq,</if>
            <if test="gmdsbh != null">gmdsbh,</if>
            <if test="fplxdm != null">fplxdm,</if>
            <if test="dkfpfs != null">dkfpfs,</if>
            <if test="dkzje != null">dkzje,</if>
            <if test="dkzyxse != null">dkzyxse,</if>
            <if test="bdkfpfs != null">bdkfpfs,</if>
            <if test="bdkzje != null">bdkzje,</if>
            <if test="bdkzyxse != null">bdkzyxse,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="remark != null">remark,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="statisticsId != null and statisticsId != ''">#{statisticsId},</if>
            <if test="skssq != null and skssq != ''">#{skssq},</if>
            <if test="gmdsbh != null">#{gmdsbh},</if>
            <if test="fplxdm != null">#{fplxdm},</if>
            <if test="dkfpfs != null">#{dkfpfs},</if>
            <if test="dkzje != null">#{dkzje},</if>
            <if test="dkzyxse != null">#{dkzyxse},</if>
            <if test="bdkfpfs != null">#{bdkfpfs},</if>
            <if test="bdkzje != null">#{bdkzje},</if>
            <if test="bdkzyxse != null">#{bdkzyxse},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="remark != null">#{remark},</if>
         </trim>
    </insert>

    <update id="updateIncomeInvoiceAuthCompanyStatisticsDetail" parameterType="IncomeInvoiceAuthCompanyStatisticsDetail">
        update income_invoice_auth_company_statistics_detail
        <trim prefix="SET" suffixOverrides=",">
            <if test="statisticsId != null and statisticsId != ''">statistics_id = #{statisticsId},</if>
            <if test="skssq != null and skssq != ''">skssq = #{skssq},</if>
            <if test="gmdsbh != null">gmdsbh = #{gmdsbh},</if>
            <if test="fplxdm != null">fplxdm = #{fplxdm},</if>
            <if test="dkfpfs != null">dkfpfs = #{dkfpfs},</if>
            <if test="dkzje != null">dkzje = #{dkzje},</if>
            <if test="dkzyxse != null">dkzyxse = #{dkzyxse},</if>
            <if test="bdkfpfs != null">bdkfpfs = #{bdkfpfs},</if>
            <if test="bdkzje != null">bdkzje = #{bdkzje},</if>
            <if test="bdkzyxse != null">bdkzyxse = #{bdkzyxse},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="remark != null">remark = #{remark},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteIncomeInvoiceAuthCompanyStatisticsDetailById" parameterType="String">
        delete from income_invoice_auth_company_statistics_detail where id = #{id}
    </delete>

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

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