| @@ -86,62 +86,62 @@ | |||
| round( | |||
| (select if(sum(mtd.trade_amt) is null,0,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} and m.status = 1) | |||
| 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 ) | |||
| /100,2) volume, | |||
| round( | |||
| (select if(sum(mtd.trade_amt) is null,0,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} and m.status = 1) | |||
| 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 ) | |||
| / | |||
| (select if(sum(ws.operation_area) is null,0,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} and m.status = 1) | |||
| where m.business_id = b.id and m.tenant_id=#{tenantId} and m.status = 1 and m.is_del = 0 ) | |||
| /100,2) sale, | |||
| round( | |||
| (select | |||
| (select if(sum(br.receive_pay) is null,0,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} and m.status = 1) | |||
| 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} and m.status = 1 and m.is_del = 0 ) | |||
| + | |||
| (select if(sum(br.receive_pay) is null,0,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} and m.status = 1) | |||
| 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} and m.status = 1 and m.is_del = 0 ) | |||
| from dual) / | |||
| (select if(sum(ws.operation_area) is null,0,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} and m.status = 1) | |||
| where m.business_id = b.id and m.tenant_id=#{tenantId} and m.status = 1 and m.is_del = 0 ) | |||
| /100,2) rent, | |||
| round( | |||
| round( | |||
| (select if(sum(mtd.trade_amt) is null,0,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} and m.status = 1) | |||
| 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 ) | |||
| / | |||
| (select if(sum(ws.operation_area) is null,0,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} and m.status = 1) | |||
| where m.business_id = b.id and m.tenant_id=#{tenantId} and m.status = 1 and m.is_del = 0 ) | |||
| /100,2) | |||
| / | |||
| round( | |||
| (select | |||
| (select if(sum(br.receive_pay) is null,0,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} and m.status = 1) | |||
| 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} and m.status = 1 and m.is_del = 0 ) | |||
| + | |||
| (select if(sum(br.receive_pay) is null,0,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} and m.status = 1) | |||
| 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} and m.status = 1 and m.is_del = 0 ) | |||
| from dual) / | |||
| (select if(sum(ws.operation_area) is null,0,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.status = 1) | |||
| where m.business_id = b.id and m.status = 1 and m.is_del = 0 ) | |||
| /100,2) | |||
| ,4) | |||
| rentSaleRate, | |||
| @@ -149,10 +149,10 @@ | |||
| round( | |||
| (select if(sum(mtd.trade_amt) is null,0,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} and m.status = 1) / | |||
| (select count(mtd.id) | |||
| 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 ) / | |||
| (select sum(mtd.trade_count) | |||
| 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) | |||
| 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) comPrice | |||
| from wx_business b | |||
| @@ -169,7 +169,7 @@ | |||
| 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.status = 1 and m.business_id = #{id} and m.tenant_id=#{tenantId}) | |||
| where m.status = 1 and m.is_del = 0 and m.business_id = #{id} and m.tenant_id=#{tenantId}) | |||
| /100,2) saleRate, | |||
| round( | |||
| @@ -184,7 +184,7 @@ | |||
| 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.status = 1 and m.business_id = #{id} and m.tenant_id=#{tenantId}) | |||
| where m.status = 1 and m.is_del = 0 and m.business_id = #{id} and m.tenant_id=#{tenantId}) | |||
| /100,2) | |||
| ) | |||
| ,2) devoteRate | |||
| @@ -194,7 +194,7 @@ | |||
| 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} | |||
| and m.status = 1 | |||
| and m.status = 1 and m.is_del = 0 | |||
| and mtd.create_date between #{startdate} and #{enddate} | |||
| group by m.id | |||
| order by devoteRate desc | |||