huminmin
3 天以前 441dfbd1908affc1accc52006a2fe81a5067052d
src/main/resources/mapper/sales/SalesLedgerMapper.xml
@@ -62,6 +62,7 @@
        T1.payment_method,
        T1.delivery_date,
        DATEDIFF(T1.delivery_date, CURDATE()) AS delivery_days_diff,
        COALESCE(T1.stock_type, 'qualified') AS stock_type,
        IFNULL(shipping_status_counts.is_all_shipped, FALSE) AS is_fh
        FROM sales_ledger T1
        LEFT JOIN sys_user T2 ON T1.entry_person = T2.user_id
@@ -94,6 +95,10 @@
            <if test="salesLedgerDto.entryDateEnd != null and salesLedgerDto.entryDateEnd != '' ">
                AND T1.entry_date &lt;= DATE_FORMAT(#{salesLedgerDto.entryDateEnd},'%Y-%m-%d')
            </if>
            <if test="salesLedgerDto.stockType != null and salesLedgerDto.stockType != '' ">
                AND COALESCE(T1.stock_type, 'qualified') = #{salesLedgerDto.stockType}
            </if>
        </where>
        order by T1.entry_date desc
    </select>
@@ -121,5 +126,23 @@
        </if>
        order by sl.execution_date desc
    </select>
    <select id="selectPurchaseReportVoPage" resultType="com.ruoyi.purchase.vo.PurchaseReportVo">
        select sl.sales_contract_no customerContractNo,
               c.customer_name,
               sl.project_name,
               sl.contract_amount contractAmount,
               pl.contract_amount purchaseAmount,
               sl.contract_amount-pl.contract_amount balance,
               (sl.contract_amount-pl.contract_amount)/sl.contract_amount balanceRatio
        from sales_ledger sl
        left join purchase_ledger pl on sl.id = pl.sales_ledger_id
        left join customer c on sl.customer_id = c.id
        <where>
            <if test="customerName != null and customerName != '' ">
                and c.customer_name like concat('%',#{customerName},'%')
            </if>
        </where>
        order by sl.entry_date desc
    </select>
</mapper>