<?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.statementAccount.mapper.BizStatementAccountMapper">

    <resultMap type="cn.ezhizao.project.business.statementAccount.domain.BizStatementAccount" id="BizStatementAccountResult">
        <id column="id" property="id"/>
    </resultMap>


    <select id="getList" parameterType="BizStatementAccount" resultMap="BizStatementAccountResult">
        SELECT * FROM biz_statement_account
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            deleted = 0
            <if test="deductId != null "> AND deduct_id = #{deductId}</if>
            <if test="tenantId != null "> AND tenant_id = #{tenantId}</if>
            <if test="year != null  and year != ''"> AND year = #{year}</if>
            <if test="month != null  and month != ''"> AND month = #{month}</if>
            <if test="taskTypeId != null "> AND task_type_id = #{taskTypeId}</if>
            <if test="taskType != null  and taskType != ''"> AND task_type = #{taskType}</if>
            <if test="annualIncome != null  and annualIncome != ''"> AND annual_income = #{annualIncome}</if>
            <if test="haveChanged != null "> AND have_changed = #{haveChanged}</if>
            <if test="companyNum != null "> AND company_num = #{companyNum}</if>
            <if test="price != null "> AND price = #{price}</if>
            <if test="discountPrice != null "> AND discount_price = #{discountPrice}</if>
            <if test="amount != null "> AND amount = #{amount}</if>
            <if test="discountAmount != null "> AND discount_amount = #{discountAmount}</if>
            <if test="actuallyAmount != null "> AND actually_amount = #{actuallyAmount}</if>
            <if test="entrustOrderId != null "> AND entrust_order_id = #{entrustOrderId}</if>
        </trim>
    </select>

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