<?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.BizStatementAccountLoopMapper">

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


    <select id="getList" parameterType="BizStatementAccountLoop" resultMap="BizStatementAccountLoopResult">
        SELECT * FROM biz_statement_account_loop
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            deleted = 0
            <if test="deductId != null "> AND deduct_id = #{deductId}</if>
            <if test="companyId != null "> AND company_id = #{companyId}</if>
            <if test="companyName != null  and companyName != ''"> AND company_name like concat('%', #{companyName}, '%')</if>
            <if test="socialCreditCode != null  and socialCreditCode != ''"> AND social_credit_code = #{socialCreditCode}</if>
            <if test="province != null  and province != ''"> AND province = #{province}</if>
            <if test="city != null  and city != ''"> AND city = #{city}</if>
            <if test="district != null  and district != ''"> AND district = #{district}</if>
            <if test="annualIncome != null  and annualIncome != ''"> AND annual_income = #{annualIncome}</if>
            <if test="isCycle != null "> AND is_cycle = #{isCycle}</if>
            <if test="isTax != null "> AND is_tax = #{isTax}</if>
            <if test="isSocialSecurity != null "> AND is_social_security = #{isSocialSecurity}</if>
            <if test="isHousingFund != null "> AND is_housing_fund = #{isHousingFund}</if>
            <if test="taxType != null  and taxType != ''"> AND tax_type = #{taxType}</if>
            <if test="collectionMethod != null  and collectionMethod != ''"> AND collection_method = #{collectionMethod}</if>
            <if test="quotaAmount != null "> AND quota_amount = #{quotaAmount}</if>
            <if test="actuallyAnnualIncome != null  and actuallyAnnualIncome != ''"> AND actually_annual_income = #{actuallyAnnualIncome}</if>
            <if test="changedSocialSecurity != null "> AND changed_social_security = #{changedSocialSecurity}</if>
            <if test="changedHousingFund != null "> AND changed_housing_fund = #{changedHousingFund}</if>
            <if test="cumulativeIncome != null "> AND cumulative_income = #{cumulativeIncome}</if>
            <if test="tenantId != null "> AND tenant_id = #{tenantId}</if>
            <if test="entrustOrderId != null "> AND entrust_order_id = #{entrustOrderId}</if>
        </trim>
    </select>

    <delete id="physicalDelete">
        DELETE FROM biz_statement_account_loop
        <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>
