8 天以前 f0efc10af370936b4db47b8428eb1ca4686431f9
src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
@@ -240,6 +240,23 @@
        LIMIT 5
    </select>
    <select id="selectProductSalesAnalysisByDate" resultType="java.util.Map">
        SELECT
            product_category as name,
            SUM( tax_inclusive_total_price ) AS value
        FROM
            sales_ledger_product
        WHERE
            type = 1
            AND register_date &gt;= #{startDate}
            AND register_date &lt;= #{endDate}
        GROUP BY
            product_category
        ORDER BY
            value DESC
        LIMIT 5
    </select>
    <select id="selectRawMaterialPurchaseAnalysis" resultType="java.util.Map">
        SELECT
            pr.product_name AS name,
@@ -258,6 +275,26 @@
        LIMIT 5
    </select>
    <select id="selectRawMaterialPurchaseAnalysisByDate" resultType="java.util.Map">
        SELECT
            pr.product_name AS name,
            SUM( slp.tax_inclusive_total_price ) AS value
        FROM
            sales_ledger_product slp
            JOIN product pr ON slp.product_id = pr.id
        WHERE
            slp.type = 2
            AND slp.register_date &gt;= #{startDate}
            AND slp.register_date &lt;= #{endDate}
            AND pr.parent_id = ( SELECT id FROM product WHERE product_name = '原材料' )
        GROUP BY
            pr.id,
            pr.product_name
        ORDER BY
            value DESC
        LIMIT 5
    </select>
    <select id="selectProductCountByTypeAndDate" resultType="int">
        SELECT IFNULL(COUNT(*), 0)
        FROM sales_ledger_product