FundLedgerMapper.xml 9.62 KB
<?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="com.lframework.xingyun.sc.procurement.mappers.fundledger.FundLedgerMapper">

    <resultMap id="FundLedgerResult"
               type="com.lframework.xingyun.sc.procurement.entity.fundledger.FundLedger">
        <id column="id" property="id"/>
        <result column="plan_id" property="planId"/>
        <result column="apply_date" property="applyDate"/>
        <result column="plan_code" property="planCode"/>
        <result column="supplier_name" property="supplierName"/>
        <result column="purchase_department" property="purchaseDepartment"/>
        <result column="purchase_department_name" property="purchaseDepartmentName"/>
        <result column="region" property="region"/>
        <result column="region_name" property="regionName"/>
        <result column="delivery_date" property="deliveryDate"/>
        <result column="plan_quantity" property="planQuantity"/>
        <result column="product_names" property="productNames"/>
        <result column="plan_remark" property="planRemark"/>
        <result column="first_arrival_date" property="firstArrivalDate"/>
        <result column="first_arrival_quantity" property="firstArrivalQuantity"/>
        <result column="second_arrival_date" property="secondArrivalDate"/>
        <result column="second_arrival_quantity" property="secondArrivalQuantity"/>
        <result column="third_arrival_date" property="thirdArrivalDate"/>
        <result column="third_arrival_quantity" property="thirdArrivalQuantity"/>
        <result column="total_arrival_quantity" property="totalArrivalQuantity"/>
        <result column="min_invoice_price" property="minInvoicePrice"/>
        <result column="first_invoice_prepay_amount" property="firstInvoicePrepayAmount"/>
        <result column="first_prepay_limit" property="firstPrepayLimit"/>
        <result column="second_invoice_prepay_amount" property="secondInvoicePrepayAmount"/>
        <result column="second_prepay_limit" property="secondPrepayLimit"/>
        <result column="third_invoice_prepay_amount" property="thirdInvoicePrepayAmount"/>
        <result column="third_prepay_limit" property="thirdPrepayLimit"/>
        <result column="total_prepay_limit" property="totalPrepayLimit"/>
        <result column="first_prepay_date" property="firstPrepayDate"/>
        <result column="first_prepay_paid" property="firstPrepayPaid"/>
        <result column="second_prepay_date" property="secondPrepayDate"/>
        <result column="second_prepay_paid" property="secondPrepayPaid"/>
        <result column="third_prepay_date" property="thirdPrepayDate"/>
        <result column="third_prepay_paid" property="thirdPrepayPaid"/>
        <result column="total_prepay_paid" property="totalPrepayPaid"/>
        <result column="available_prepay_amount" property="availablePrepayAmount"/>
        <result column="red_amount" property="redAmount"/>
        <result column="first_receive_date" property="firstReceiveDate"/>
        <result column="first_receive_quantity" property="firstReceiveQuantity"/>
        <result column="first_receive_amount" property="firstReceiveAmount"/>
        <result column="second_receive_date" property="secondReceiveDate"/>
        <result column="second_receive_quantity" property="secondReceiveQuantity"/>
        <result column="second_receive_amount" property="secondReceiveAmount"/>
        <result column="third_receive_date" property="thirdReceiveDate"/>
        <result column="third_receive_quantity" property="thirdReceiveQuantity"/>
        <result column="third_receive_amount" property="thirdReceiveAmount"/>
        <result column="total_receive_quantity" property="totalReceiveQuantity"/>
        <result column="total_receive_amount" property="totalReceiveAmount"/>
        <result column="invoice_date" property="invoiceDate"/>
        <result column="invoice_quantity" property="invoiceQuantity"/>
        <result column="invoice_amount" property="invoiceAmount"/>
        <result column="owed_invoice_amount" property="owedInvoiceAmount"/>
        <result column="outstock_quantity" property="outstockQuantity"/>
        <result column="owed_order_amount" property="owedOrderAmount"/>
        <result column="invoice_balance_amount" property="invoiceBalanceAmount"/>
        <result column="stock_complete_diff" property="stockCompleteDiff"/>
        <result column="final_payment_date" property="finalPaymentDate"/>
        <result column="final_payment_amount" property="finalPaymentAmount"/>
        <result column="compare_amount" property="compareAmount"/>
        <result column="clear_debt" property="clearDebt"/>
        <result column="remark" property="remark"/>
        <result column="red_remark" property="redRemark"/>
        <result column="red_file_ids" property="redFileIds"/>
        <result column="red_file_names" property="redFileNames"/>
        <result column="balance_remark" property="balanceRemark"/>
        <result column="balance_file_ids" property="balanceFileIds"/>
        <result column="balance_file_names" property="balanceFileNames"/>
        <result column="create_by_id" property="createById"/>
        <result column="create_by" property="createBy"/>
        <result column="update_by_id" property="updateById"/>
        <result column="update_by" property="updateBy"/>
        <result column="create_time" property="createTime"/>
        <result column="update_time" property="updateTime"/>
    </resultMap>

    <sql id="FL_sql">
        SELECT
            tb.id,
            tb.plan_id,
            tb.apply_date,
            tb.plan_code,
            tb.supplier_name,
            tb.purchase_department,
            tb.purchase_department_name,
            tb.region,
            tb.region_name,
            tb.delivery_date,
            tb.plan_quantity,
            tb.product_names,
            tb.plan_remark,
            tb.first_arrival_date,
            tb.first_arrival_quantity,
            tb.second_arrival_date,
            tb.second_arrival_quantity,
            tb.third_arrival_date,
            tb.third_arrival_quantity,
            tb.total_arrival_quantity,
            tb.min_invoice_price,
            tb.first_invoice_prepay_amount,
            tb.first_prepay_limit,
            tb.second_invoice_prepay_amount,
            tb.second_prepay_limit,
            tb.third_invoice_prepay_amount,
            tb.third_prepay_limit,
            tb.total_prepay_limit,
            tb.first_prepay_date,
            tb.first_prepay_paid,
            tb.second_prepay_date,
            tb.second_prepay_paid,
            tb.third_prepay_date,
            tb.third_prepay_paid,
            tb.total_prepay_paid,
            tb.available_prepay_amount,
            tb.red_amount,
            tb.first_receive_date,
            tb.first_receive_quantity,
            tb.first_receive_amount,
            tb.second_receive_date,
            tb.second_receive_quantity,
            tb.second_receive_amount,
            tb.third_receive_date,
            tb.third_receive_quantity,
            tb.third_receive_amount,
            tb.total_receive_quantity,
            tb.total_receive_amount,
            tb.invoice_date,
            tb.invoice_quantity,
            tb.invoice_amount,
            tb.owed_invoice_amount,
            tb.outstock_quantity,
            tb.owed_order_amount,
            tb.invoice_balance_amount,
            tb.stock_complete_diff,
            tb.final_payment_date,
            tb.final_payment_amount,
            tb.compare_amount,
            tb.clear_debt,
            tb.remark,
            tb.red_remark,
            tb.red_file_ids,
            tb.red_file_names,
            tb.balance_remark,
            tb.balance_file_ids,
            tb.balance_file_names,
            tb.create_by_id,
            tb.create_by,
            tb.update_by_id,
            tb.update_by,
            tb.create_time,
            tb.update_time
        FROM fund_ledger AS tb
    </sql>

    <select id="query" resultMap="FundLedgerResult">
        <include refid="FL_sql"/>
        <where>
            <if test="vo.applyDateStart != null">
                AND tb.apply_date &gt;= #{vo.applyDateStart}
            </if>
            <if test="vo.applyDateEnd != null">
                AND tb.apply_date &lt;= #{vo.applyDateEnd}
            </if>
            <if test="vo.planCode != null and vo.planCode != ''">
                AND tb.plan_code LIKE CONCAT('%', #{vo.planCode}, '%')
            </if>
            <if test="vo.supplierName != null and vo.supplierName != ''">
                AND tb.supplier_name LIKE CONCAT('%', #{vo.supplierName}, '%')
            </if>
            <if test="vo.purchaseDepartment != null and vo.purchaseDepartment != ''">
                AND tb.purchase_department = #{vo.purchaseDepartment}
            </if>
            <if test="vo.purchaseDepartmentName != null and vo.purchaseDepartmentName != ''">
                AND tb.purchase_department_name LIKE CONCAT('%', #{vo.purchaseDepartmentName}, '%')
            </if>
            <if test="vo.region != null and vo.region != ''">
                AND tb.region = #{vo.region}
            </if>
            <if test="vo.regionName != null and vo.regionName != ''">
                AND tb.region_name LIKE CONCAT('%', #{vo.regionName}, '%')
            </if>
            <if test="vo.clearDebt != null">
                AND tb.clear_debt = #{vo.clearDebt}
            </if>
        </where>
        ORDER BY tb.apply_date DESC, tb.create_time DESC
    </select>

    <select id="findById" resultMap="FundLedgerResult">
        <include refid="FL_sql"/>
        <where>
            AND tb.id = #{id}
        </where>
    </select>
</mapper>