<?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.collection.mapper.BizCollectionMapper">

    <resultMap type="cn.ezhizao.project.business.collection.domain.BizCollection" id="BizCollectionResult">
        <id column="id" property="id"/>
    </resultMap>


    <select id="getList" parameterType="BizCollection" resultMap="BizCollectionResult">
        SELECT * FROM biz_collection
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            deleted = 0
            <if test="flowNo != null  and flowNo != ''"> AND flow_no = #{flowNo}</if>
            <if test="subsidiary != null  and subsidiary != ''"> AND subsidiary = #{subsidiary}</if>
            <if test="subsidiaryName != null  and subsidiaryName != ''"> AND subsidiary_name like concat('%', #{subsidiaryName}, '%')</if>
            <if test="subsidiaryBankAccount != null  and subsidiaryBankAccount != ''"> AND subsidiary_bank_account = #{subsidiaryBankAccount}</if>
            <if test="subsidiaryBankName != null  and subsidiaryBankName != ''"> AND subsidiary_bank_name like concat('%', #{subsidiaryBankName}, '%')</if>
            <if test="companyName != null  and companyName != ''"> AND company_name like concat('%', #{companyName}, '%')</if>
            <if test="amount != null "> AND amount = #{amount}</if>
            <if test="arriveAmount != null "> AND arrive_amount = #{arriveAmount}</if>
            <if test="arriveDate != null "> AND arrive_date = #{arriveDate}</if>
            <if test="contractId != null "> AND contract_id = #{contractId}</if>
            <if test="arriveTime != null  and arriveTime != ''"> AND arrive_time = #{arriveTime}</if>
            <if test="status != null "> AND status = #{status}</if>
            <if test="verifyDate != null "> AND verify_date = #{verifyDate}</if>
            <if test="verifyComment != null  and verifyComment != ''"> AND verify_comment = #{verifyComment}</if>
            <if test="arriveStatus != null "> AND arrive_status = #{arriveStatus}</if>
            <if test="applyName != null  and applyName != ''"> AND apply_name like concat('%', #{applyName}, '%')</if>
            <if test="appyAccount != null  and appyAccount != ''"> AND appy_account = #{appyAccount}</if>
            <if test="isNew != null "> AND is_new = #{isNew}</if>
            <if test="isProject != null "> AND is_project = #{isProject}</if>
            <if test="projectNo != null  and projectNo != ''"> AND project_no = #{projectNo}</if>
            <if test="projectName != null  and projectName != ''"> AND project_name like concat('%', #{projectName}, '%')</if>
            <if test="projectMainName != null  and projectMainName != ''"> AND project_main_name like concat('%', #{projectMainName}, '%')</if>
            <if test="actuallyDate != null "> AND actually_date = #{actuallyDate}</if>
        </trim>
    </select>

    <delete id="physicalDelete">
        DELETE FROM biz_collection
        <where>
            <if test="tenantId != null">
                AND  tenant_id = #{tenantId}
            </if>
        </where>

    </delete>
</mapper>
