|
@@ -9,7 +9,7 @@
|
|
m.merch_name AS merchName,
|
|
m.merch_name AS merchName,
|
|
sum( o.order_price ) AS totalSales,
|
|
sum( o.order_price ) AS totalSales,
|
|
sum( og.number) as totalNumber,
|
|
sum( og.number) as totalNumber,
|
|
- count(DISTINCT o.id) as totalCustomers,
|
|
|
|
|
|
+ count(DISTINCT o.pay_mobile) as totalCustomers,
|
|
DATE_FORMAT(o.pay_time,'%Y-%m') as yearAndMonth
|
|
DATE_FORMAT(o.pay_time,'%Y-%m') as yearAndMonth
|
|
FROM
|
|
FROM
|
|
mall_order o
|
|
mall_order o
|
|
@@ -55,20 +55,27 @@
|
|
|
|
|
|
<select id="top10ForProduct" resultType="com.kmall.admin.entity.MonthlySalesGrowthEntity" >
|
|
<select id="top10ForProduct" resultType="com.kmall.admin.entity.MonthlySalesGrowthEntity" >
|
|
SELECT
|
|
SELECT
|
|
|
|
+ m.merch_name AS merchName,
|
|
og.goods_name as goodsName,
|
|
og.goods_name as goodsName,
|
|
og.goods_specification_name_value as goodsSpecificationNameValue,
|
|
og.goods_specification_name_value as goodsSpecificationNameValue,
|
|
sum( og.number ) AS sales
|
|
sum( og.number ) AS sales
|
|
FROM
|
|
FROM
|
|
mall_order o
|
|
mall_order o
|
|
|
|
+ LEFT JOIN mall_merch m ON o.merch_sn = m.merch_sn
|
|
LEFT JOIN mall_order_goods og ON o.id = og.order_id
|
|
LEFT JOIN mall_order_goods og ON o.id = og.order_id
|
|
<where>
|
|
<where>
|
|
- 1 = 1
|
|
|
|
|
|
+ o.is_onffline_order = '1'
|
|
|
|
+ AND o.order_biz_type = '10'
|
|
|
|
+ AND o.pay_status = '2'
|
|
<if test="month != null and month.trim() != ''">
|
|
<if test="month != null and month.trim() != ''">
|
|
and DATE_FORMAT(o.pay_time,'%Y-%m') = #{month}
|
|
and DATE_FORMAT(o.pay_time,'%Y-%m') = #{month}
|
|
</if>
|
|
</if>
|
|
<if test="week != null and week.trim() != ''">
|
|
<if test="week != null and week.trim() != ''">
|
|
and weekofyear(o.pay_time) = #{week}
|
|
and weekofyear(o.pay_time) = #{week}
|
|
</if>
|
|
</if>
|
|
|
|
+ <if test="merchSn != null">
|
|
|
|
+ and m.merch_sn = #{merchSn}
|
|
|
|
+ </if>
|
|
</where>
|
|
</where>
|
|
GROUP BY
|
|
GROUP BY
|
|
og.sku
|
|
og.sku
|
|
@@ -79,21 +86,28 @@
|
|
|
|
|
|
<select id="top10ByBrand" resultType="com.kmall.admin.entity.MonthlySalesGrowthEntity" >
|
|
<select id="top10ByBrand" resultType="com.kmall.admin.entity.MonthlySalesGrowthEntity" >
|
|
SELECT
|
|
SELECT
|
|
|
|
+ m.merch_name AS merchName,
|
|
g.brand as brand,
|
|
g.brand as brand,
|
|
og.goods_specification_name_value as goodsSpecificationNameValue,
|
|
og.goods_specification_name_value as goodsSpecificationNameValue,
|
|
sum( og.number ) AS sales
|
|
sum( og.number ) AS sales
|
|
FROM
|
|
FROM
|
|
mall_order o
|
|
mall_order o
|
|
|
|
+ LEFT JOIN mall_merch m ON o.merch_sn = m.merch_sn
|
|
LEFT JOIN mall_order_goods og ON o.id = og.order_id
|
|
LEFT JOIN mall_order_goods og ON o.id = og.order_id
|
|
LEFT JOIN mall_goods g ON g.id = og.goods_id
|
|
LEFT JOIN mall_goods g ON g.id = og.goods_id
|
|
<where>
|
|
<where>
|
|
- 1 = 1
|
|
|
|
|
|
+ o.is_onffline_order = '1'
|
|
|
|
+ AND o.order_biz_type = '10'
|
|
|
|
+ AND o.pay_status = '2'
|
|
<if test="startDate != null and startDate.trim() != ''">
|
|
<if test="startDate != null and startDate.trim() != ''">
|
|
and DATE_FORMAT(o.pay_time,'%Y-%m-%d') >= #{startDate}
|
|
and DATE_FORMAT(o.pay_time,'%Y-%m-%d') >= #{startDate}
|
|
</if>
|
|
</if>
|
|
<if test="endDate != null and endDate.trim() != ''">
|
|
<if test="endDate != null and endDate.trim() != ''">
|
|
and DATE_FORMAT(o.pay_time,'%Y-%m-%d') <= #{endDate}
|
|
and DATE_FORMAT(o.pay_time,'%Y-%m-%d') <= #{endDate}
|
|
</if>
|
|
</if>
|
|
|
|
+ <if test="merchSn != null">
|
|
|
|
+ and m.merch_sn = #{merchSn}
|
|
|
|
+ </if>
|
|
</where>
|
|
</where>
|
|
GROUP BY
|
|
GROUP BY
|
|
g.brand
|
|
g.brand
|
|
@@ -104,22 +118,29 @@
|
|
|
|
|
|
<select id="top10BySupplier" resultType="com.kmall.admin.entity.MonthlySalesGrowthEntity" >
|
|
<select id="top10BySupplier" resultType="com.kmall.admin.entity.MonthlySalesGrowthEntity" >
|
|
SELECT
|
|
SELECT
|
|
|
|
+ m.merch_name AS merchName,
|
|
s.child_supplier_name as supplier,
|
|
s.child_supplier_name as supplier,
|
|
og.goods_specification_name_value as goodsSpecificationNameValue,
|
|
og.goods_specification_name_value as goodsSpecificationNameValue,
|
|
sum( og.number ) AS sales
|
|
sum( og.number ) AS sales
|
|
FROM
|
|
FROM
|
|
mall_order o
|
|
mall_order o
|
|
|
|
+ LEFT JOIN mall_merch m ON o.merch_sn = m.merch_sn
|
|
LEFT JOIN mall_order_goods og ON o.id = og.order_id
|
|
LEFT JOIN mall_order_goods og ON o.id = og.order_id
|
|
LEFT JOIN mall_goods g ON g.id = og.goods_id
|
|
LEFT JOIN mall_goods g ON g.id = og.goods_id
|
|
LEFT JOIN mall_supplier s ON g.supplier_id = s.id
|
|
LEFT JOIN mall_supplier s ON g.supplier_id = s.id
|
|
<where>
|
|
<where>
|
|
- 1 = 1
|
|
|
|
|
|
+ o.is_onffline_order = '1'
|
|
|
|
+ AND o.order_biz_type = '10'
|
|
|
|
+ AND o.pay_status = '2'
|
|
<if test="startDate != null and startDate.trim() != ''">
|
|
<if test="startDate != null and startDate.trim() != ''">
|
|
and DATE_FORMAT(o.pay_time,'%Y-%m') >= #{startDate}
|
|
and DATE_FORMAT(o.pay_time,'%Y-%m') >= #{startDate}
|
|
</if>
|
|
</if>
|
|
<if test="endDate != null and endDate.trim() != ''">
|
|
<if test="endDate != null and endDate.trim() != ''">
|
|
and DATE_FORMAT(o.pay_time,'%Y-%m') <= #{endDate}
|
|
and DATE_FORMAT(o.pay_time,'%Y-%m') <= #{endDate}
|
|
</if>
|
|
</if>
|
|
|
|
+ <if test="merchSn != null">
|
|
|
|
+ and m.merch_sn = #{merchSn}
|
|
|
|
+ </if>
|
|
</where>
|
|
</where>
|
|
GROUP BY
|
|
GROUP BY
|
|
s.id
|
|
s.id
|
|
@@ -127,4 +148,32 @@
|
|
sales desc
|
|
sales desc
|
|
LIMIT 10
|
|
LIMIT 10
|
|
</select>
|
|
</select>
|
|
|
|
+
|
|
|
|
+ <select id="salesByCategory" resultType="com.kmall.admin.entity.MonthlySalesGrowthEntity">
|
|
|
|
+ SELECT
|
|
|
|
+ sum( og.number ) AS sales,
|
|
|
|
+ cg.NAME AS cgname
|
|
|
|
+ FROM
|
|
|
|
+ mall_order o
|
|
|
|
+ LEFT JOIN mall_merch m ON o.merch_sn = m.merch_sn
|
|
|
|
+ LEFT JOIN mall_order_goods og ON o.id = og.order_id
|
|
|
|
+ LEFT JOIN mall_product_store_rela a ON a.goods_id = og.goods_id
|
|
|
|
+ LEFT JOIN mall_category cg ON a.category_id = cg.id
|
|
|
|
+ <where>
|
|
|
|
+ <if test="startDate != null and startDate.trim() != ''">
|
|
|
|
+ and DATE_FORMAT(o.pay_time,'%Y-%m') >= #{startDate}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="endDate != null and endDate.trim() != ''">
|
|
|
|
+ and DATE_FORMAT(o.pay_time,'%Y-%m') <= #{endDate}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="merchSn != null">
|
|
|
|
+ and m.merch_sn = #{merchSn}
|
|
|
|
+ </if>
|
|
|
|
+ </where>
|
|
|
|
+ GROUP BY
|
|
|
|
+ cg.parent_id
|
|
|
|
+
|
|
|
|
+ limit 20
|
|
|
|
+ </select>
|
|
|
|
+
|
|
</mapper>
|
|
</mapper>
|