| | |
| | | left join product p on pm.product_id = p.id |
| | | </select> |
| | | |
| | | <select id="selectProductSalesAnalysis" resultType="java.util.LinkedHashMap"> |
| | | <select id="selectProductSalesAnalysis" resultType="java.util.Map"> |
| | | SELECT |
| | | product_category as name, |
| | | SUM( tax_inclusive_total_price ) AS value |
| | |
| | | LIMIT 5 |
| | | </select> |
| | | |
| | | <select id="selectRawMaterialPurchaseAnalysis" resultType="java.util.LinkedHashMap"> |
| | | <select id="selectRawMaterialPurchaseAnalysis" resultType="java.util.Map"> |
| | | SELECT |
| | | pr.product_name AS name, |
| | | SUM( slp.tax_inclusive_total_price ) AS value |
| | |
| | | AND register_date <= #{endDate} |
| | | </select> |
| | | |
| | | <select id="selectRawMaterialExpense" resultType="java.math.BigDecimal"> |
| | | WITH RECURSIVE product_tree AS (SELECT id |
| | | FROM product |
| | | WHERE product_name = '原材料' |
| | | |
| | | UNION ALL |
| | | |
| | | SELECT p.id |
| | | FROM product p |
| | | INNER JOIN product_tree pt ON p.parent_id = pt.id) |
| | | SELECT IFNULL(SUM(slp.tax_inclusive_total_price), 0) |
| | | FROM sales_ledger_product slp |
| | | WHERE slp.type = 2 |
| | | AND slp.product_id IN (SELECT id |
| | | FROM product_tree); |
| | | |
| | | </select> |
| | | </mapper> |