|
@@ -96,11 +96,49 @@
|
|
<if test=' this.has("goodsName") '>and goods_name like concat('%', #{goodsName}, '%') or ve_no like upper(concat('%', #{goodsName}, '%'))</if>
|
|
<if test=' this.has("goodsName") '>and goods_name like concat('%', #{goodsName}, '%') or ve_no like upper(concat('%', #{goodsName}, '%'))</if>
|
|
</select>
|
|
</select>
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ <!--已完成和累计交易额 -->
|
|
|
|
+ <select id="totalMoney" resultType="java.util.Map">
|
|
|
|
+ SELECT
|
|
|
|
+ ( SELECT SUM( resale_price ) FROM tb_orders ) AS totalMoney,
|
|
|
|
+ ( SELECT SUM( resale_price ) FROM tb_orders WHERE order_finish=1) AS finishMoney,
|
|
|
|
+ ( SELECT COUNT(id) FROM tb_orders) AS orders
|
|
|
|
+ </select>
|
|
|
|
+ <!--查询所有统计年份 -->
|
|
|
|
+ <select id="selectYear" resultType="java.util.Map">
|
|
|
|
+ SELECT YEAR(create_time) AS year FROM tb_orders GROUP BY YEAR(create_time) ORDER BY year
|
|
|
|
+ </select>
|
|
|
|
+ <!--根据年份查询每月订单交易额和交易量统计 -->
|
|
|
|
+ <select id="orderStatistics" resultType="java.util.Map">
|
|
|
|
+ SELECT
|
|
|
|
+ months.month AS name,
|
|
|
|
+ <if test="type=='交易额'">
|
|
|
|
+ SUM(tb_orders.resale_price) AS value
|
|
|
|
+ </if>
|
|
|
|
+ <if test="type=='交易量'">
|
|
|
|
+ COUNT(tb_orders.id) AS value
|
|
|
|
+ </if>
|
|
|
|
+ FROM
|
|
|
|
+ (
|
|
|
|
+ SELECT 1 AS month UNION ALL
|
|
|
|
+ SELECT 2 AS month UNION ALL
|
|
|
|
+ SELECT 3 AS month UNION ALL
|
|
|
|
+ SELECT 4 AS month UNION ALL
|
|
|
|
+ SELECT 5 AS month UNION ALL
|
|
|
|
+ SELECT 6 AS month UNION ALL
|
|
|
|
+ SELECT 7 AS month UNION ALL
|
|
|
|
+ SELECT 8 AS month UNION ALL
|
|
|
|
+ SELECT 9 AS month UNION ALL
|
|
|
|
+ SELECT 10 AS month UNION ALL
|
|
|
|
+ SELECT 11 AS month UNION ALL
|
|
|
|
+ SELECT 12 AS month
|
|
|
|
+ ) AS months
|
|
|
|
+ LEFT JOIN
|
|
|
|
+ tb_orders ON
|
|
|
|
+ MONTH(tb_orders.create_time) = months.month AND YEAR(tb_orders.create_time) =#{year}
|
|
|
|
+ GROUP BY
|
|
|
|
+ months.month
|
|
|
|
+ ORDER BY
|
|
|
|
+ months.month
|
|
|
|
+ </select>
|
|
|
|
|
|
</mapper>
|
|
</mapper>
|