<?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.system.mapper.InvoiceAllYhdjMapper">
    
    <resultMap type="InvoiceAllYhdj" id="InvoiceAllYhdjResult">
        <result property="id"    column="id"    />
        <result property="bsryxm"    column="bsryxm"    />
        <result property="dlsf"    column="dlsf"    />
        <result property="dlsfmm"    column="dlsfmm"    />
        <result property="dlfs"    column="dlfs"    />
        <result property="dlmm"    column="dlmm"    />
        <result property="dlzh"    column="dlzh"    />
        <result property="nsrmc"    column="nsrmc"    />
        <result property="nsrsbh"    column="nsrsbh"    />
        <result property="bsrysfzjhm"    column="bsrysfzjhm"    />
        <result property="bsrysjhm"    column="bsrysjhm"    />
        <result property="zjh"    column="zjh"    />
        <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"    />
        <result property="identity"    column="identity"    />
        <result property="dqbm"    column="dqbm"    />
    </resultMap>

    <sql id="selectInvoiceAllYhdjVo">
        select id, bsryxm, dlsf, dlsfmm, dlfs, dlmm, dlzh, nsrmc, nsrsbh, bsrysfzjhm, bsrysjhm, zjh, create_by, create_time, update_by, update_time, remark,identity,dqbm from invoice_all_yhdj
    </sql>

    <select id="selectInvoiceAllYhdjList" parameterType="InvoiceAllYhdj" resultMap="InvoiceAllYhdjResult">
        <include refid="selectInvoiceAllYhdjVo"/>
        <where>  
            <if test="bsryxm != null  and bsryxm != ''"> and bsryxm = #{bsryxm}</if>
            <if test="dlsf != null  and dlsf != ''"> and dlsf = #{dlsf}</if>
            <if test="dlsfmm != null  and dlsfmm != ''"> and dlsfmm = #{dlsfmm}</if>
            <if test="dlfs != null  and dlfs != ''"> and dlfs = #{dlfs}</if>
            <if test="dlmm != null  and dlmm != ''"> and dlmm = #{dlmm}</if>
            <if test="dlzh != null  and dlzh != ''"> and dlzh = #{dlzh}</if>
            <if test="nsrmc != null  and nsrmc != ''"> and nsrmc = #{nsrmc}</if>
            <if test="nsrsbh != null  and nsrsbh != ''"> and nsrsbh = #{nsrsbh}</if>
            <if test="bsrysfzjhm != null  and bsrysfzjhm != ''"> and bsrysfzjhm = #{bsrysfzjhm}</if>
            <if test="bsrysjhm != null  and bsrysjhm != ''"> and bsrysjhm = #{bsrysjhm}</if>
            <if test="zjh != null  and zjh != ''"> and zjh = #{zjh}</if>
            <if test="identity != null  and identity != ''"> and identity = #{identity}</if>
            <if test="dqbm != null  and dqbm != ''"> and dqbm = #{dqbm}</if>
        </where>
    </select>
    
    <select id="selectInvoiceAllYhdjById" parameterType="Long" resultMap="InvoiceAllYhdjResult">
        <include refid="selectInvoiceAllYhdjVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertInvoiceAllYhdj" parameterType="InvoiceAllYhdj">
        insert into invoice_all_yhdj
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="bsryxm != null">bsryxm,</if>
            <if test="dlsf != null">dlsf,</if>
            <if test="dlsfmm != null">dlsfmm,</if>
            <if test="dlfs != null">dlfs,</if>
            <if test="dlmm != null">dlmm,</if>
            <if test="dlzh != null">dlzh,</if>
            <if test="nsrmc != null">nsrmc,</if>
            <if test="nsrsbh != null">nsrsbh,</if>
            <if test="bsrysfzjhm != null">bsrysfzjhm,</if>
            <if test="bsrysjhm != null">bsrysjhm,</if>
            <if test="zjh != null">zjh,</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>
            <if test="identity != null">identity,</if>
            <if test="dqbm != null">dqbm,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="bsryxm != null">#{bsryxm},</if>
            <if test="dlsf != null">#{dlsf},</if>
            <if test="dlsfmm != null">#{dlsfmm},</if>
            <if test="dlfs != null">#{dlfs},</if>
            <if test="dlmm != null">#{dlmm},</if>
            <if test="dlzh != null">#{dlzh},</if>
            <if test="nsrmc != null">#{nsrmc},</if>
            <if test="nsrsbh != null">#{nsrsbh},</if>
            <if test="bsrysfzjhm != null">#{bsrysfzjhm},</if>
            <if test="bsrysjhm != null">#{bsrysjhm},</if>
            <if test="zjh != null">#{zjh},</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>
            <if test="identity != null">#{identity},</if>
            <if test="dqbm != null">#{dqbm},</if>
         </trim>
    </insert>

    <update id="updateInvoiceAllYhdj" parameterType="InvoiceAllYhdj">
        update invoice_all_yhdj
        <trim prefix="SET" suffixOverrides=",">
            <if test="bsryxm != null">bsryxm = #{bsryxm},</if>
            <if test="dlsf != null">dlsf = #{dlsf},</if>
            <if test="dlsfmm != null">dlsfmm = #{dlsfmm},</if>
            <if test="dlfs != null">dlfs = #{dlfs},</if>
            <if test="dlmm != null">dlmm = #{dlmm},</if>
            <if test="dlzh != null">dlzh = #{dlzh},</if>
            <if test="nsrmc != null">nsrmc = #{nsrmc},</if>
            <if test="nsrsbh != null">nsrsbh = #{nsrsbh},</if>
            <if test="bsrysfzjhm != null">bsrysfzjhm = #{bsrysfzjhm},</if>
            <if test="bsrysjhm != null">bsrysjhm = #{bsrysjhm},</if>
            <if test="zjh != null">zjh = #{zjh},</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>
            <if test="identity != null">identity = #{identity},</if>
            <if test="dqbm != null">dqbm = #{dqbm},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteInvoiceAllYhdjById" parameterType="Long">
        delete from invoice_all_yhdj where id = #{id}
    </delete>

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