`id`,`title`,`type`,`create_date`,`update_date`
where 1 = 1
and `id` = #{id}
and `title` like concat('%', #{title},'%')
and `type` = #{type}
and `create_date` = #{createDate}
and `update_date` = #{updateDate}
and id in
#{idItem}
order by ${sortColumns}
select from wx_business
select from wx_business
order by create_date asc
select
from wx_business b
where
(select count(*) from wx_merchant m
where
m.tenant_id = #{tenantId}
and b.id = m.business_id
and m.status = 1
and m.is_public = 1) > 0
order by create_date asc
select
from wx_business b
where
(select count(*) from wx_coupon_channel cc
where
cc.tenant_id = #{tenantId}
and b.id = cc.business
and cc.status = 0
and cc.target_ad = 1) > 0
order by create_date asc
select b.id,b.title,
round(
(select sum(mtd.trade_amt)
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})
/100,2) volume,
round(
(select sum(mtd.trade_amt)
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})
/
(select sum(ws.operation_area)
from wx_merchant m
left join wx_merchant_shop mtd on mtd.merchant_id = m.id
left join wx_shop ws on(mtd.shop_id = ws.id)
where m.business_id = b.id and m.tenant_id=#{tenantId})
/100,2) sale,
round(
(select
(select sum(br.receive_pay) receive_pay from wx_merchant m
left join wx_bill_rent br on(br.merchant_id=m.id) where m.business_id = b.id and m.tenant_id=#{tenantId} and br.receive_date between #{startdate} and #{enddate})
+
(select sum(br.receive_pay) receive_pay from wx_merchant m
left join wx_bill_property br on(br.merchant_id=m.id) where m.business_id = b.id and m.tenant_id=#{tenantId} and br.receive_date between #{startdate} and #{enddate})
from dual) /
(select sum(ws.operation_area)
from wx_merchant m
left join wx_merchant_shop mtd on mtd.merchant_id = m.id
left join wx_shop ws on(mtd.shop_id = ws.id)
where m.business_id = b.id and m.tenant_id=#{tenantId} )
/100,2) rent,
round(
round(
(select sum(mtd.trade_amt)
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})
/
(select sum(ws.operation_area)
from wx_merchant m
left join wx_merchant_shop mtd on mtd.merchant_id = m.id
left join wx_shop ws on(mtd.shop_id = ws.id)
where m.business_id = b.id and m.tenant_id=#{tenantId})
/100,2)
/
round(
(select
(select sum(br.receive_pay) receive_pay from wx_merchant m
left join wx_bill_rent br on(br.merchant_id=m.id) where m.business_id = b.id and m.tenant_id=#{tenantId} and br.receive_date between #{startdate} and #{enddate})
+
(select sum(br.receive_pay) receive_pay from wx_merchant m
left join wx_bill_property br on(br.merchant_id=m.id) where m.business_id = b.id and m.tenant_id=#{tenantId} and br.receive_date between #{startdate} and #{enddate})
from dual) /
(select sum(ws.operation_area)
from wx_merchant m
left join wx_merchant_shop mtd on mtd.merchant_id = m.id
left join wx_shop ws on(mtd.shop_id = ws.id)
where m.business_id = b.id)
/100,2)
,4)
rentSaleRate,
round(
(select sum(mtd.trade_amt)
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}) /
(select count(mtd.id)
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})
/100,2) comPrice
from wx_business b
select m.name merchantName,round(sum(mtd.trade_amt)/sum(ws.operation_area) /100,2) sale,
round(
round(sum(mtd.trade_amt)/sum(ws.operation_area) /100,2)/
(select round(sum(mtd.trade_amt)/sum(ws.operation_area) /100,2)
from wx_merchant m
left join wx_merchant_trade_daily mtd on mtd.merchant_id = m.id
left join wx_merchant_shop wmt on wmt.merchant_id = m.id
left join wx_shop ws on(wmt.shop_id = ws.id)
where m.business_id=#{id} and m.tenant_id=#{tenantId})
,2) devoteRate
from wx_merchant m
left join wx_merchant_trade_daily mtd on mtd.merchant_id = m.id
left join wx_merchant_shop wmt on wmt.merchant_id = m.id
left join wx_shop ws on(wmt.shop_id = ws.id)
where m.business_id=#{id} and m.tenant_id=#{tenantId}
group by m.id
order by devoteRate desc