| | |
| | | SET contract_amount = #{totalTaxInclusiveAmount} |
| | | WHERE id = #{id} |
| | | </update> |
| | | </mapper> |
| | | <select id="selectPurchaseStats" resultType="com.ruoyi.home.dto.IncomeExpenseAnalysisDto"> |
| | | SELECT DATE_FORMAT(entry_date, #{dateFormat}) as dateStr, IFNULL(SUM(contract_amount), 0) as amount |
| | | FROM purchase_ledger |
| | | WHERE entry_date BETWEEN #{startDate} AND #{endDate} |
| | | GROUP BY dateStr |
| | | </select> |
| | | |
| | | <select id="selectPurchaseLedgerListPage" resultType="com.ruoyi.purchase.dto.PurchaseLedgerDto"> |
| | | SELECT |
| | | pl.id, |
| | | pl.purchase_contract_number, |
| | | pl.sales_contract_no, |
| | | pl.supplier_id, |
| | | pl.supplier_name, |
| | | pl.project_name, |
| | | pl.contract_amount, |
| | | pl.entry_date, |
| | | pl.execution_date, |
| | | pl.recorder_id, |
| | | pl.recorder_name, |
| | | pl.template_name, |
| | | pl.approve_user_ids, |
| | | sm.is_white, |
| | | pl.approval_status, |
| | | pl.payment_method, |
| | | pl.remarks |
| | | FROM purchase_ledger pl |
| | | LEFT JOIN supplier_manage sm ON pl.supplier_id = sm.id |
| | | <where> |
| | | <if test="c.purchaseContractNumber != null and c.purchaseContractNumber != ''"> |
| | | AND pl.purchase_contract_number LIKE CONCAT('%', #{c.purchaseContractNumber}, '%') |
| | | </if> |
| | | <if test="c.approvalStatus != null and c.approvalStatus != ''"> |
| | | AND pl.approval_status = #{c.approvalStatus} |
| | | </if> |
| | | <if test="c.supplierName != null and c.supplierName != ''"> |
| | | AND pl.supplier_name LIKE CONCAT('%', #{c.supplierName}, '%') |
| | | </if> |
| | | <if test="c.salesContractNo != null and c.salesContractNo != ''"> |
| | | AND pl.sales_contract_no LIKE CONCAT('%', #{c.salesContractNo}, '%') |
| | | </if> |
| | | <if test="c.projectName != null and c.projectName != ''"> |
| | | AND pl.project_name LIKE CONCAT('%', #{c.projectName}, '%') |
| | | </if> |
| | | <if test="c.entryDateStart != null and c.entryDateStart != ''"> |
| | | AND pl.entry_date >= #{c.entryDateStart} |
| | | </if> |
| | | <if test="c.entryDateEnd != null and c.entryDateEnd != ''"> |
| | | AND pl.entry_date <= #{c.entryDateEnd} |
| | | </if> |
| | | <if test="c.supplierId != null"> |
| | | AND pl.supplier_id = #{c.supplierId} |
| | | </if> |
| | | <if test="c.approvalStatus != null"> |
| | | AND pl.approval_status = #{c.approvalStatus} |
| | | </if> |
| | | </where> |
| | | ORDER BY pl.entry_date DESC |
| | | </select> |
| | | |
| | | <select id="selectTotalPurchaseAmount" resultType="java.math.BigDecimal"> |
| | | SELECT IFNULL(SUM(contract_amount), 0) |
| | | FROM purchase_ledger |
| | | <where> |
| | | <if test="startDate != null and startDate != ''"> |
| | | AND entry_date >= #{startDate} |
| | | </if> |
| | | <if test="endDate != null and endDate != ''"> |
| | | AND entry_date <= #{endDate} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | </mapper> |