yuan
10 小时以前 3fffef8da8b40bea43ec6d0f58b6b614875def68
src/main/java/com/ruoyi/sales/mapper/SalesLedgerMapper.java
@@ -6,10 +6,12 @@
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.home.dto.IncomeExpenseAnalysisDto;
import com.ruoyi.purchase.vo.PurchaseReportVo;
import com.ruoyi.sales.dto.SalesLedgerDto;
import com.ruoyi.sales.dto.SalesTrendDto;
import com.ruoyi.sales.dto.StatisticsTableDto;
import com.ruoyi.sales.pojo.SalesLedger;
import com.ruoyi.sales.vo.SalesLedgerVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
@@ -52,7 +54,7 @@
     * @param salesLedgerDto
     * @return
     */
    IPage<SalesLedger> selectSalesLedgerListPage(Page page, @Param("salesLedgerDto") SalesLedgerDto salesLedgerDto);
    IPage<SalesLedgerVo> selectSalesLedgerListPage(Page page, @Param("salesLedgerDto") SalesLedgerDto salesLedgerDto);
    /**
     * 按月份统计订单数、销售额(支持产品大类、客户名称筛选)
@@ -64,6 +66,7 @@
            "DATE_FORMAT(sl.entry_date, '%Y-%m') AS month, " +
            "COUNT(DISTINCT sl.id) AS order_count, " +  // 总订单数
            "SUM(slp.tax_inclusive_total_price) AS sales_amount, " +  // 销售额
            "SUM(IFNULL(slp.quantity, 0)) AS product_quantity, " +  // 产品销售数量
            // 发货率 = 发货订单数 * 100 / 总订单数(保留2位小数,避免除0报错)
            "ROUND(IF(COUNT(DISTINCT sl.id) = 0, 0, " +
            "SUM(CASE WHEN slp.approve_status = 2 THEN 1 ELSE 0 END) / COUNT(DISTINCT sl.id) * 100), 2) AS ship_rate " +
@@ -83,4 +86,9 @@
            "ORDER BY month" +
            "</script>")
    List<SalesTrendDto> statisticsTable(@Param("statisticsTableDto")StatisticsTableDto statisticsTableDto);
    IPage<SalesLedgerDto> listSalesLedgerAndShipped(Page page, @Param("ew") SalesLedgerDto salesLedgerDto);
    IPage<PurchaseReportVo> selectPurchaseReportVoPage(Page page, @Param("customerName") String customerName);
}