(select if(sum(mtd.trade_amt) is null,0,sum(mtd.trade_amt))
(select if(sum(mtd.trade_amt) is null,0,sum(mtd.trade_amt))
from wx_merchant m
from wx_merchant m
left join wx_merchant_trade_daily mtd on mtd.merchant_id = m.id where m.business_id = b.id and m.tenant_id=#{tenantId} and mtd.create_date between #{startdate} and #{enddate} and m.status = 1 and m.is_del = 0 )
left join wx_merchant_trade_daily mtd on mtd.merchant_id = m.id where m.business_id = b.id and m.tenant_id=#{tenantId} and mtd.report_date between #{startdate} and #{enddate} and m.status = 1 and m.is_del = 0 )
/100,2) volume,
/100,2) volume,
round(
round(
(select if(sum(mtd.trade_amt) is null,0,sum(mtd.trade_amt))
(select if(sum(mtd.trade_amt) is null,0,sum(mtd.trade_amt))
from wx_merchant m
from wx_merchant m
left join wx_merchant_trade_daily mtd on mtd.merchant_id = m.id where m.business_id = b.id and m.tenant_id=#{tenantId} and mtd.create_date between #{startdate} and #{enddate} and m.status = 1 and m.is_del = 0 )
left join wx_merchant_trade_daily mtd on mtd.merchant_id = m.id where m.business_id = b.id and m.tenant_id=#{tenantId} and mtd.report_date between #{startdate} and #{enddate} and m.status = 1 and m.is_del = 0 )
/
/
(select if(sum(ws.operation_area) is null,0,sum(ws.operation_area))
(select if(sum(ws.operation_area) is null,0,sum(ws.operation_area))
from wx_merchant m
from wx_merchant m
@@ -119,7 +119,7 @@
round(
round(
(select if(sum(mtd.trade_amt) is null,0,sum(mtd.trade_amt))
(select if(sum(mtd.trade_amt) is null,0,sum(mtd.trade_amt))
from wx_merchant m
from wx_merchant m
left join wx_merchant_trade_daily mtd on mtd.merchant_id = m.id where m.business_id = b.id and m.tenant_id=#{tenantId} and mtd.create_date between #{startdate} and #{enddate} and m.status = 1 and m.is_del = 0 ) /
left join wx_merchant_trade_daily mtd on mtd.merchant_id = m.id where m.business_id = b.id and m.tenant_id=#{tenantId} and mtd.report_date between #{startdate} and #{enddate} and m.status = 1 and m.is_del = 0 ) /
(select sum(mtd.trade_count)
(select sum(mtd.trade_count)
from wx_merchant m
from wx_merchant m
left join wx_merchant_trade_daily mtd on mtd.merchant_id = m.id where m.business_id = b.id and m.tenant_id=#{tenantId} and mtd.report_date between #{startdate} and #{enddate} and m.status = 1 and m.is_del = 0 )
left join wx_merchant_trade_daily mtd on mtd.merchant_id = m.id where m.business_id = b.id and m.tenant_id=#{tenantId} and mtd.report_date between #{startdate} and #{enddate} and m.status = 1 and m.is_del = 0 )
@@ -134,7 +134,7 @@
round(
round(
(select if(sum(mtd.trade_amt) is null,0,sum(mtd.trade_amt))
(select if(sum(mtd.trade_amt) is null,0,sum(mtd.trade_amt))
from wx_merchant m
from wx_merchant m
left join wx_merchant_trade_daily mtd on mtd.merchant_id = m.id where m.business_id = #{id} and m.tenant_id=#{tenantId} and mtd.create_date between #{startdate} and #{enddate} and m.status = 1 and m.is_del = 0 and m.id = mm.id)
left join wx_merchant_trade_daily mtd on mtd.merchant_id = m.id where m.business_id = #{id} and m.tenant_id=#{tenantId} and mtd.report_date between #{startdate} and #{enddate} and m.status = 1 and m.is_del = 0 and m.id = mm.id)
/
/
(select if(sum(ws.operation_area) is null,0,sum(ws.operation_area))
(select if(sum(ws.operation_area) is null,0,sum(ws.operation_area))
from wx_merchant m
from wx_merchant m
@@ -148,7 +148,7 @@
round(
round(
(select if(sum(mtd.trade_amt) is null,0,sum(mtd.trade_amt))
(select if(sum(mtd.trade_amt) is null,0,sum(mtd.trade_amt))
from wx_merchant m
from wx_merchant m
left join wx_merchant_trade_daily mtd on mtd.merchant_id = m.id where m.business_id = #{id} and m.tenant_id=#{tenantId} and mtd.create_date between #{startdate} and #{enddate} and m.status = 1 and m.is_del = 0 and m.id = mm.id)/
left join wx_merchant_trade_daily mtd on mtd.merchant_id = m.id where m.business_id = #{id} and m.tenant_id=#{tenantId} and mtd.report_date between #{startdate} and #{enddate} and m.status = 1 and m.is_del = 0 and m.id = mm.id)/
(select if(sum(ws.operation_area) is null,0,sum(ws.operation_area))
(select if(sum(ws.operation_area) is null,0,sum(ws.operation_area))
from wx_merchant m
from wx_merchant m
left join wx_merchant_shop mtd on mtd.merchant_id = m.id
left join wx_merchant_shop mtd on mtd.merchant_id = m.id
@@ -158,7 +158,7 @@
round(
round(
(select if(sum(mtd.trade_amt) is null,0,sum(mtd.trade_amt))
(select if(sum(mtd.trade_amt) is null,0,sum(mtd.trade_amt))
from wx_merchant m
from wx_merchant m
left join wx_merchant_trade_daily mtd on mtd.merchant_id = m.id where m.business_id = #{id} and m.tenant_id=#{tenantId} and mtd.create_date between #{startdate} and #{enddate} and m.status = 1 and m.is_del = 0 )
left join wx_merchant_trade_daily mtd on mtd.merchant_id = m.id where m.business_id = #{id} and m.tenant_id=#{tenantId} and mtd.report_date between #{startdate} and #{enddate} and m.status = 1 and m.is_del = 0 )
/
/
(select if(sum(ws.operation_area) is null,0,sum(ws.operation_area))
(select if(sum(ws.operation_area) is null,0,sum(ws.operation_area))
from wx_merchant m
from wx_merchant m
@@ -167,7 +167,7 @@
where m.business_id = #{id} and m.tenant_id=#{tenantId} and m.status = 1 and m.is_del = 0 )
where m.business_id = #{id} and m.tenant_id=#{tenantId} and m.status = 1 and m.is_del = 0 )
/100,2)
/100,2)
,2) devoteRate
*100,2) devoteRate
from wx_merchant mm
from wx_merchant mm
left join wx_merchant_trade_daily mtd on mtd.merchant_id = mm.id
left join wx_merchant_trade_daily mtd on mtd.merchant_id = mm.id
@@ -175,7 +175,7 @@
left join wx_shop ws on(wmt.shop_id = ws.id)
left join wx_shop ws on(wmt.shop_id = ws.id)
where mm.business_id=#{id} and mm.tenant_id=#{tenantId}
where mm.business_id=#{id} and mm.tenant_id=#{tenantId}
and mm.status = 1 and mm.is_del = 0
and mm.status = 1 and mm.is_del = 0
and mtd.create_date between #{startdate} and #{enddate}
and mtd.report_date between #{startdate} and #{enddate}