<?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.IncomeInvoiceAuthStatusMapper">
    
    <resultMap type="IncomeInvoiceAuthStatus" id="IncomeInvoiceAuthStatusResult">
        <result property="id"    column="id"    />
        <result property="invoiceId"    column="invoice_id"    />
        <result property="fpdm"    column="fpdm"    />
        <result property="fphm"    column="fphm"    />
        <result property="fpzt"    column="fpzt"    />
        <result property="rzzt"    column="rzzt"    />
        <result property="rzrq"    column="rzrq"    />
        <result property="rzsq"    column="rzsq"    />
        <result property="xxly"    column="xxly"    />
        <result property="yxse"    column="yxse"    />
        <result property="yqkgxbz"    column="yqkgxbz"    />
        <result property="glzt"    column="glzt"    />
        <result property="rzlx"    column="rzlx"    />
        <result property="dkse"    column="dkse"    />
        <result property="bdkyy"    column="bdkyy"    />
        <result property="createTime"    column="create_time"    />
    </resultMap>

    <sql id="selectIncomeInvoiceAuthStatusVo">
        select id, invoice_id, fpdm, fphm, fpzt, rzzt, rzrq, rzsq, xxly, yxse, yqkgxbz, glzt, rzlx, dkse, bdkyy, create_time from income_invoice_status
    </sql>

    <select id="selectIncomeInvoiceAuthStatusList" parameterType="IncomeInvoiceAuthStatus" resultMap="IncomeInvoiceAuthStatusResult">
        <include refid="selectIncomeInvoiceAuthStatusVo"/>
        <where>  
            <if test="invoiceId != null  and invoiceId != ''"> and invoice_id = #{invoiceId}</if>
            <if test="fpdm != null  and fpdm != ''"> and fpdm = #{fpdm}</if>
            <if test="fphm != null  and fphm != ''"> and fphm = #{fphm}</if>
            <if test="fpzt != null  and fpzt != ''"> and fpzt = #{fpzt}</if>
            <if test="rzzt != null  and rzzt != ''"> and rzzt = #{rzzt}</if>
            <if test="rzrq != null  and rzrq != ''"> and rzrq = #{rzrq}</if>
            <if test="rzsq != null  and rzsq != ''"> and rzsq = #{rzsq}</if>
            <if test="xxly != null  and xxly != ''"> and xxly = #{xxly}</if>
            <if test="yxse != null  and yxse != ''"> and yxse = #{yxse}</if>
            <if test="yqkgxbz != null  and yqkgxbz != ''"> and yqkgxbz = #{yqkgxbz}</if>
            <if test="glzt != null  and glzt != ''"> and glzt = #{glzt}</if>
            <if test="rzlx != null  and rzlx != ''"> and rzlx = #{rzlx}</if>
            <if test="dkse != null  and dkse != ''"> and dkse = #{dkse}</if>
            <if test="bdkyy != null  and bdkyy != ''"> and bdkyy = #{bdkyy}</if>
        </where>
    </select>
    
    <select id="selectIncomeInvoiceAuthStatusById" parameterType="String" resultMap="IncomeInvoiceAuthStatusResult">
        <include refid="selectIncomeInvoiceAuthStatusVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertIncomeInvoiceAuthStatus" parameterType="IncomeInvoiceAuthStatus">
        insert into income_invoice_status
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="invoiceId != null">invoice_id,</if>
            <if test="fpdm != null">fpdm,</if>
            <if test="fphm != null">fphm,</if>
            <if test="fpzt != null">fpzt,</if>
            <if test="rzzt != null">rzzt,</if>
            <if test="rzrq != null">rzrq,</if>
            <if test="rzsq != null">rzsq,</if>
            <if test="xxly != null">xxly,</if>
            <if test="yxse != null">yxse,</if>
            <if test="yqkgxbz != null">yqkgxbz,</if>
            <if test="glzt != null">glzt,</if>
            <if test="rzlx != null">rzlx,</if>
            <if test="dkse != null">dkse,</if>
            <if test="bdkyy != null">bdkyy,</if>
            <if test="createTime != null">create_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="invoiceId != null">#{invoiceId},</if>
            <if test="fpdm != null">#{fpdm},</if>
            <if test="fphm != null">#{fphm},</if>
            <if test="fpzt != null">#{fpzt},</if>
            <if test="rzzt != null">#{rzzt},</if>
            <if test="rzrq != null">#{rzrq},</if>
            <if test="rzsq != null">#{rzsq},</if>
            <if test="xxly != null">#{xxly},</if>
            <if test="yxse != null">#{yxse},</if>
            <if test="yqkgxbz != null">#{yqkgxbz},</if>
            <if test="glzt != null">#{glzt},</if>
            <if test="rzlx != null">#{rzlx},</if>
            <if test="dkse != null">#{dkse},</if>
            <if test="bdkyy != null">#{bdkyy},</if>
            <if test="createTime != null">#{createTime},</if>
         </trim>
    </insert>

    <update id="updateIncomeInvoiceAuthStatus" parameterType="IncomeInvoiceAuthStatus">
        update income_invoice_status
        <trim prefix="SET" suffixOverrides=",">
            <if test="invoiceId != null">invoice_id = #{invoiceId},</if>
            <if test="fpdm != null">fpdm = #{fpdm},</if>
            <if test="fphm != null">fphm = #{fphm},</if>
            <if test="fpzt != null">fpzt = #{fpzt},</if>
            <if test="rzzt != null">rzzt = #{rzzt},</if>
            <if test="rzrq != null">rzrq = #{rzrq},</if>
            <if test="rzsq != null">rzsq = #{rzsq},</if>
            <if test="xxly != null">xxly = #{xxly},</if>
            <if test="yxse != null">yxse = #{yxse},</if>
            <if test="yqkgxbz != null">yqkgxbz = #{yqkgxbz},</if>
            <if test="glzt != null">glzt = #{glzt},</if>
            <if test="rzlx != null">rzlx = #{rzlx},</if>
            <if test="dkse != null">dkse = #{dkse},</if>
            <if test="bdkyy != null">bdkyy = #{bdkyy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteIncomeInvoiceAuthStatusById" parameterType="String">
        delete from income_invoice_status where id = #{id}
    </delete>

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