<?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.outsourceBalanceAccount.mapper.BizOutsourceBalanceAccountMapper">

    <resultMap type="cn.ezhizao.project.business.outsourceBalanceAccount.domain.BizOutsourceBalanceAccount" id="BizOutsourceBalanceAccountResult">
        <id column="id" property="id"/>
    </resultMap>


    <select id="getList" parameterType="BizOutsourceBalanceAccount" resultMap="BizOutsourceBalanceAccountResult">
        SELECT * FROM biz_outsource_balance_account
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            deleted = 0
            <if test="supplierName != null  and supplierName != ''"> AND supplier_name like concat('%', #{supplierName}, '%')</if>
            <if test="supplierCode != null  and supplierCode != ''"> AND supplier_code = #{supplierCode}</if>
            <if test="settlementType != null  and settlementType != ''"> AND settlement_type = #{settlementType}</if>
            <if test="lotCode != null  and lotCode != ''"> AND lot_code = #{lotCode}</if>
            <if test="productCode != null  and productCode != ''"> AND product_code = #{productCode}</if>
            <if test="productDescription != null  and productDescription != ''"> AND product_description = #{productDescription}</if>
            <if test="technologyVersion != null  and technologyVersion != ''"> AND technology_version = #{technologyVersion}</if>
            <if test="processAlias != null  and processAlias != ''"> AND process_alias = #{processAlias}</if>
            <if test="processCode != null  and processCode != ''"> AND process_code = #{processCode}</if>
            <if test="processStepNumber != null  and processStepNumber != ''"> AND process_step_number = #{processStepNumber}</if>
            <if test="productNum != null "> AND product_num = #{productNum}</if>
            <if test="productionNum != null "> AND production_num = #{productionNum}</if>
            <if test="outputNum != null "> AND output_num = #{outputNum}</if>
            <if test="receiptNum != null "> AND receipt_num = #{receiptNum}</if>
            <if test="processPrice != null "> AND process_price = #{processPrice}</if>
            <if test="fillDifferencePrice != null "> AND fill_difference_price = #{fillDifferencePrice}</if>
            <if test="otherCost != null "> AND other_cost = #{otherCost}</if>
            <if test="actualInventory != null "> AND actual_inventory = #{actualInventory}</if>
            <if test="materialLoss != null "> AND material_loss = #{materialLoss}</if>
            <if test="materialLossAmount != null "> AND material_loss_amount = #{materialLossAmount}</if>
            <if test="planAmount != null "> AND plan_amount = #{planAmount}</if>
            <if test="acutalAmount != null "> AND acutal_amount = #{acutalAmount}</if>
            <if test="taxAmount != null "> AND tax_amount = #{taxAmount}</if>
            <if test="freightAmount != null "> AND freight_amount = #{freightAmount}</if>
            <if test="materialPrice != null "> AND material_price = #{materialPrice}</if>
            <if test="salePrice != null "> AND sale_price = #{salePrice}</if>
            <if test="wastePrice != null "> AND waste_price = #{wastePrice}</if>
            <if test="carrierNum != null "> AND carrier_num = #{carrierNum}</if>
            <if test="processSort != null "> AND process_sort = #{processSort}</if>
            <if test="checkoutDate != null "> AND checkout_date = #{checkoutDate}</if>
            <if test="auditDate != null "> AND audit_date = #{auditDate}</if>
            <if test="returnDate != null "> AND return_date = #{returnDate}</if>
            <if test="returnNo != null  and returnNo != ''"> AND return_no = #{returnNo}</if>
            <if test="outsourceNo != null  and outsourceNo != ''"> AND outsource_no = #{outsourceNo}</if>
            <if test="furnaceNum != null "> AND furnace_num = #{furnaceNum}</if>
            <if test="checkDate != null "> AND check_date = #{checkDate}</if>
            <if test="inspectionNo != null  and inspectionNo != ''"> AND inspection_no = #{inspectionNo}</if>
            <if test="materialLossRatio != null "> AND material_loss_ratio = #{materialLossRatio}</if>
            <if test="surfaceTreatment != null  and surfaceTreatment != ''"> AND surface_treatment = #{surfaceTreatment}</if>
            <if test="length != null "> AND length = #{length}</if>
            <if test="materialDiameter != null "> AND material_diameter = #{materialDiameter}</if>
            <if test="tolerance != null "> AND tolerance = #{tolerance}</if>
            <if test="utilizationRatio != null "> AND utilization_ratio = #{utilizationRatio}</if>
            <if test="currency != null  and currency != ''"> AND currency = #{currency}</if>
            <if test="taxRate != null "> AND tax_rate = #{taxRate}</if>
            <if test="year != null  and year != ''"> AND year = #{year}</if>
            <if test="month != null  and month != ''"> AND month = #{month}</if>
            <if test="wastePriceCategory != null  and wastePriceCategory != ''"> AND waste_price_category = #{wastePriceCategory}</if>
            <if test="rawMaterialCode != null  and rawMaterialCode != ''"> AND raw_material_code = #{rawMaterialCode}</if>
            <if test="density != null "> AND density = #{density}</if>
            <if test="shape != null  and shape != ''"> AND shape = #{shape}</if>
            <if test="type != null  and type != ''"> AND type = #{type}</if>
            <if test="status != null "> AND status = #{status}</if>
            <if test="isWasteRecycling != null "> AND is_waste_recycling = #{isWasteRecycling}</if>
            <if test="isAmend != null "> AND is_amend = #{isAmend}</if>
        </trim>
    </select>

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