数据统计
This commit is contained in:
@@ -7,22 +7,22 @@
|
||||
<select id="getTradeData" resultType="com.czg.order.entity.ShopOrderStatistic">
|
||||
select
|
||||
sum(sale_amount) as sale_amount,
|
||||
count(sale_count) as sale_count,
|
||||
sum(sale_count) as sale_count,
|
||||
sum(discount_amount) as discount_amount,
|
||||
count(discount_count) as discount_count,
|
||||
sum(discount_count) as discount_count,
|
||||
sum(refund_amount) as refund_amount,
|
||||
count(refund_count) as refund_count,
|
||||
count(wechat_pay_count) as wechat_pay_count,
|
||||
sum(refund_count) as refund_count,
|
||||
sum(wechat_pay_count) as wechat_pay_count,
|
||||
sum(wechat_pay_amount) as wechat_pay_amount,
|
||||
count(ali_pay_count) as ali_pay_count,
|
||||
sum(ali_pay_count) as ali_pay_count,
|
||||
sum(ali_pay_amount) as ali_pay_amount,
|
||||
count(credit_pay_count) as credit_pay_count,
|
||||
sum(credit_pay_count) as credit_pay_count,
|
||||
sum(credit_pay_amount) as credit_pay_amount,
|
||||
count(member_pay_count) as member_pay_count,
|
||||
sum(member_pay_count) as member_pay_count,
|
||||
sum(member_pay_amount) as member_pay_amount,
|
||||
count(scan_pay_count) as scan_pay_count,
|
||||
sum(scan_pay_count) as scan_pay_count,
|
||||
sum(scan_pay_amount) as scan_pay_amount,
|
||||
count(cash_pay_count) as cash_pay_count,
|
||||
sum(cash_pay_count) as cash_pay_count,
|
||||
sum(cash_pay_amount) as cash_pay_amount,
|
||||
sum(recharge_amount) as recharge_amount,
|
||||
avg(customer_unit_price) as customer_unit_price,
|
||||
|
||||
@@ -4,4 +4,43 @@
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.czg.service.order.mapper.ShopProdStatisticMapper">
|
||||
|
||||
<select id="findProdRandingSummaryPage" resultType="com.czg.order.vo.DataSummaryProductSaleRankingVo">
|
||||
select
|
||||
t1.prod_id,
|
||||
t2.name as product_name,
|
||||
sum(t1.sale_count) as number,
|
||||
sum(t1.sale_amount) as amount
|
||||
from tb_shop_prod_statistic t1
|
||||
left join tb_product t2 on t1.prod_id = t2.id
|
||||
where t1.shop_id = #{shopId}
|
||||
and t1.create_day in
|
||||
<foreach item="day" collection="days" open="(" separator="," close=")">
|
||||
#{day}
|
||||
</foreach>
|
||||
group by t1.prod_id
|
||||
</select>
|
||||
<select id="getSaleSummaryCount" resultType="com.czg.order.vo.SaleSummaryCountVo">
|
||||
select
|
||||
sum(t1.sale_count) as sale_count,
|
||||
sum(t1.sale_amount) as total_amount,
|
||||
sum(t1.refund_count) as refund_count,
|
||||
sum(t1.refund_amount) as refund_amount
|
||||
from tb_shop_prod_statistic t1
|
||||
left join tb_product t2 on t1.prod_id = t2.id
|
||||
where t1.shop_id = #{shopId}
|
||||
<if test="productName != null and productName != ''">
|
||||
and t2.name like concat('%', #{productName}, '%')
|
||||
</if>
|
||||
<if test="prodCategoryId != null">
|
||||
and t2.category_id = #{prodCategoryId}
|
||||
</if>
|
||||
<if test="beginDate != null and beginDate != ''">
|
||||
and t1.create_day >= str_to_date(#{beginDate}, '%Y-%m-%d')
|
||||
</if>
|
||||
<if test="endDate != null and endDate != ''">
|
||||
<![CDATA[
|
||||
and t1.create_day <= str_to_date(#{endDate}, '%Y-%m-%d')
|
||||
]]>
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user