<?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="cn.ezhizao.project.business.invoice.mapper.BizInvoiceRecordMapper">

    <resultMap type="cn.ezhizao.project.business.invoice.domain.BizInvoiceRecord" id="BizInvoiceRecordResult">
        <id column="id" property="id"/>
    </resultMap>


    <select id="getList" parameterType="BizInvoiceRecord" resultMap="BizInvoiceRecordResult">
        SELECT *,user1.nick_name as nick_name FROM biz_invoice_record record
        left join sys_user user1 on user1.user_id = record.user_id
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            deleted = 0
            <if test="invoiceId != null "> AND record.invoice_id = #{invoiceId}</if>
        </trim>
        order by record.create_time desc
    </select>

    <delete id="physicalDelete">
        DELETE FROM biz_invoice_record
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            <if test="id != null">
                id = #{id} AND
            </if>
       <!-- 删除条件为其他外键可以在这里加 -->
        </trim>
    </delete>
</mapper>
