|
@@ -658,20 +658,20 @@
|
|
|
<!-- 日统计 -->
|
|
|
<select id="getDayStatistics" resultMap="chartBean" parameterType="com.shawn.model.param.StatisticsParam">
|
|
|
select concat(DATE_FORMAT( a.create_date,'%H'),'点') as categorie,count(1) as saleNum,sum(a.price) as salePrice
|
|
|
- <if test="ifForeign != null and ifForeign =='0'"> -- 国内用户
|
|
|
+ <if test="ifForeign != null and ifForeign ==0"> -- 国内用户
|
|
|
from t_order a where a.status='1' -- 支付成功
|
|
|
</if>
|
|
|
- <if test="ifForeign != null and ifForeign =='1'"> -- 国外用户
|
|
|
+ <if test="ifForeign != null and ifForeign ==1"> -- 国外用户
|
|
|
from t_coin_order a left join t_equipment b on a.client_id = b.client_id where 1=1
|
|
|
</if>
|
|
|
<if test="adminId != null and adminId !=''">
|
|
|
and a.admin_id= #{adminId} -- 所属商家id
|
|
|
</if>
|
|
|
<if test="equipmentId != null and equipmentId !=''">
|
|
|
- <if test="ifForeign != null and ifForeign =='0'"> -- 国内用户
|
|
|
+ <if test="ifForeign != null and ifForeign ==0"> -- 国内用户
|
|
|
and a.equipment_id= #{equipmentId} -- 设备id
|
|
|
</if>
|
|
|
- <if test="ifForeign != null and ifForeign =='1'"> -- 国外用户
|
|
|
+ <if test="ifForeign != null and ifForeign ==1"> -- 国外用户
|
|
|
and b.id= #{equipmentId} -- 设备id
|
|
|
</if>
|
|
|
</if>
|
|
@@ -693,20 +693,20 @@
|
|
|
left join (
|
|
|
select case DATE_FORMAT( a.create_date,'%w') when 0 then '周日' else CONCAT('周',DATE_FORMAT( a.create_date,'%w')) end as categorie,
|
|
|
count(1) as saleNum,sum(a.price) as salePrice
|
|
|
- <if test="ifForeign != null and ifForeign =='0'"> -- 国内用户
|
|
|
+ <if test="ifForeign != null and ifForeign ==0"> -- 国内用户
|
|
|
from t_order a where a.status='1' -- 支付成功
|
|
|
</if>
|
|
|
- <if test="ifForeign != null and ifForeign =='1'"> -- 国外用户
|
|
|
+ <if test="ifForeign != null and ifForeign ==1"> -- 国外用户
|
|
|
from t_coin_order a left join t_equipment b on a.client_id = b.client_id where 1=1
|
|
|
</if>
|
|
|
<if test="adminId != null and adminId !=''">
|
|
|
and a.admin_id= #{adminId} -- 所属商家id
|
|
|
</if>
|
|
|
<if test="equipmentId != null and equipmentId !=''">
|
|
|
- <if test="ifForeign != null and ifForeign =='0'"> -- 国内用户
|
|
|
+ <if test="ifForeign != null and ifForeign ==0"> -- 国内用户
|
|
|
and a.equipment_id= #{equipmentId} -- 设备id
|
|
|
</if>
|
|
|
- <if test="ifForeign != null and ifForeign =='1'"> -- 国外用户
|
|
|
+ <if test="ifForeign != null and ifForeign ==1"> -- 国外用户
|
|
|
and b.id= #{equipmentId} -- 设备id
|
|
|
</if>
|
|
|
</if>
|
|
@@ -719,20 +719,20 @@
|
|
|
<!-- 月统计 -->
|
|
|
<select id="getMonthStatistics" resultMap="chartBean" parameterType="com.shawn.model.param.StatisticsParam">
|
|
|
select DATE_FORMAT( a.create_date,'%m月%d') as categorie,count(1) as saleNum,sum(a.price) as salePrice
|
|
|
- <if test="ifForeign != null and ifForeign =='0'"> -- 国内用户
|
|
|
+ <if test="ifForeign != null and ifForeign ==0"> -- 国内用户
|
|
|
from t_order a where a.status='1' -- 支付成功
|
|
|
</if>
|
|
|
- <if test="ifForeign != null and ifForeign =='1'"> -- 国外用户
|
|
|
+ <if test="ifForeign != null and ifForeign ==1"> -- 国外用户
|
|
|
from t_coin_order a left join t_equipment b on a.client_id = b.client_id where 1=1
|
|
|
</if>
|
|
|
<if test="adminId != null and adminId !=''">
|
|
|
and a.admin_id= #{adminId} -- 所属商家id
|
|
|
</if>
|
|
|
<if test="equipmentId != null and equipmentId !=''">
|
|
|
- <if test="ifForeign != null and ifForeign =='0'"> -- 国内用户
|
|
|
+ <if test="ifForeign != null and ifForeign ==0"> -- 国内用户
|
|
|
and a.equipment_id= #{equipmentId} -- 设备id
|
|
|
</if>
|
|
|
- <if test="ifForeign != null and ifForeign =='1'"> -- 国外用户
|
|
|
+ <if test="ifForeign != null and ifForeign ==1"> -- 国外用户
|
|
|
and b.id= #{equipmentId} -- 设备id
|
|
|
</if>
|
|
|
</if>
|
|
@@ -758,20 +758,20 @@
|
|
|
select '12月' as categorie from dual) tab1
|
|
|
left join (
|
|
|
select concat(DATE_FORMAT( a.create_date,'%m'),'月') as categorie,count(1) as saleNum,sum(a.price) as salePrice
|
|
|
- <if test="ifForeign != null and ifForeign =='0'"> -- 国内用户
|
|
|
+ <if test="ifForeign != null and ifForeign ==0"> -- 国内用户
|
|
|
from t_order a where a.status='1' -- 支付成功
|
|
|
</if>
|
|
|
- <if test="ifForeign != null and ifForeign =='1'"> -- 国外用户
|
|
|
+ <if test="ifForeign != null and ifForeign ==1"> -- 国外用户
|
|
|
from t_coin_order a left join t_equipment b on a.client_id = b.client_id where 1=1
|
|
|
</if>
|
|
|
<if test="adminId != null and adminId !=''">
|
|
|
and a.admin_id= #{adminId} -- 所属商家id
|
|
|
</if>
|
|
|
<if test="equipmentId != null and equipmentId !=''">
|
|
|
- <if test="ifForeign != null and ifForeign =='0'"> -- 国内用户
|
|
|
+ <if test="ifForeign != null and ifForeign ==0"> -- 国内用户
|
|
|
and a.equipment_id= #{equipmentId} -- 设备id
|
|
|
</if>
|
|
|
- <if test="ifForeign != null and ifForeign =='1'"> -- 国外用户
|
|
|
+ <if test="ifForeign != null and ifForeign ==1"> -- 国外用户
|
|
|
and b.id= #{equipmentId} -- 设备id
|
|
|
</if>
|
|
|
</if>
|
|
@@ -784,80 +784,80 @@
|
|
|
<!-- 汇总统计-->
|
|
|
<select id="getMainStatistics" resultMap="chartBean">
|
|
|
select 'day' as categorie, count(1) as saleNum,ifnull(sum(a.price),0) as salePrice
|
|
|
- <if test="ifForeign != null and ifForeign =='0'"> -- 国内用户
|
|
|
+ <if test="ifForeign != null and ifForeign ==0"> -- 国内用户
|
|
|
from t_order a where a.status='1' -- 支付成功
|
|
|
</if>
|
|
|
- <if test="ifForeign != null and ifForeign =='1'"> -- 国外用户
|
|
|
+ <if test="ifForeign != null and ifForeign ==1"> -- 国外用户
|
|
|
from t_coin_order a left join t_equipment b on a.client_id = b.client_id where 1=1
|
|
|
</if>
|
|
|
<if test="adminId != null and adminId !=''">
|
|
|
and a.admin_id= #{adminId} -- 所属商家id
|
|
|
</if>
|
|
|
<if test="equipmentId != null and equipmentId !=''">
|
|
|
- <if test="ifForeign != null and ifForeign =='0'"> -- 国内用户
|
|
|
+ <if test="ifForeign != null and ifForeign ==0"> -- 国内用户
|
|
|
and a.equipment_id= #{equipmentId} -- 设备id
|
|
|
</if>
|
|
|
- <if test="ifForeign != null and ifForeign =='1'"> -- 国外用户
|
|
|
+ <if test="ifForeign != null and ifForeign ==1"> -- 国外用户
|
|
|
and b.id= #{equipmentId} -- 设备id
|
|
|
</if>
|
|
|
</if>
|
|
|
and date_format(a.create_date,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d')
|
|
|
UNION all
|
|
|
select 'week' as categorie, count(1) as saleNum,ifnull(sum(a.price),0) as salePrice
|
|
|
- <if test="ifForeign != null and ifForeign =='0'"> -- 国内用户
|
|
|
+ <if test="ifForeign != null and ifForeign ==0"> -- 国内用户
|
|
|
from t_order a where a.status='1' -- 支付成功
|
|
|
</if>
|
|
|
- <if test="ifForeign != null and ifForeign =='1'"> -- 国外用户
|
|
|
+ <if test="ifForeign != null and ifForeign ==1"> -- 国外用户
|
|
|
from t_coin_order a left join t_equipment b on a.client_id = b.client_id where 1=1
|
|
|
</if>
|
|
|
<if test="adminId != null and adminId !=''">
|
|
|
and a.admin_id= #{adminId} -- 所属商家id
|
|
|
</if>
|
|
|
<if test="equipmentId != null and equipmentId !=''">
|
|
|
- <if test="ifForeign != null and ifForeign =='0'"> -- 国内用户
|
|
|
+ <if test="ifForeign != null and ifForeign ==0"> -- 国内用户
|
|
|
and a.equipment_id= #{equipmentId} -- 设备id
|
|
|
</if>
|
|
|
- <if test="ifForeign != null and ifForeign =='1'"> -- 国外用户
|
|
|
+ <if test="ifForeign != null and ifForeign ==1"> -- 国外用户
|
|
|
and b.id= #{equipmentId} -- 设备id
|
|
|
</if>
|
|
|
</if>
|
|
|
and YEARWEEK(date_format(a.create_date,'%Y-%m-%d'),1) = YEARWEEK(now(),1)
|
|
|
UNION all
|
|
|
select 'month' as categorie, count(1) as saleNum,ifnull(sum(a.price),0) as salePrice
|
|
|
- <if test="ifForeign != null and ifForeign =='0'"> -- 国内用户
|
|
|
+ <if test="ifForeign != null and ifForeign ==0"> -- 国内用户
|
|
|
from t_order a where a.status='1' -- 支付成功
|
|
|
</if>
|
|
|
- <if test="ifForeign != null and ifForeign =='1'"> -- 国外用户
|
|
|
+ <if test="ifForeign != null and ifForeign ==1"> -- 国外用户
|
|
|
from t_coin_order a left join t_equipment b on a.client_id = b.client_id where 1=1
|
|
|
</if>
|
|
|
<if test="adminId != null and adminId !=''">
|
|
|
and a.admin_id= #{adminId} -- 所属商家id
|
|
|
</if>
|
|
|
<if test="equipmentId != null and equipmentId !=''">
|
|
|
- <if test="ifForeign != null and ifForeign =='0'"> -- 国内用户
|
|
|
+ <if test="ifForeign != null and ifForeign ==0"> -- 国内用户
|
|
|
and a.equipment_id= #{equipmentId} -- 设备id
|
|
|
</if>
|
|
|
- <if test="ifForeign != null and ifForeign =='1'"> -- 国外用户
|
|
|
+ <if test="ifForeign != null and ifForeign ==1"> -- 国外用户
|
|
|
and b.id= #{equipmentId} -- 设备id
|
|
|
</if>
|
|
|
</if>
|
|
|
and date_format(a.create_date,'%Y-%m') = date_format(now(),'%Y-%m')
|
|
|
UNION all
|
|
|
select 'year' as categorie, count(1) as saleNum,ifnull(sum(a.price),0) as salePrice
|
|
|
- <if test="ifForeign != null and ifForeign =='0'"> -- 国内用户
|
|
|
+ <if test="ifForeign != null and ifForeign ==0"> -- 国内用户
|
|
|
from t_order a where a.status='1' -- 支付成功
|
|
|
</if>
|
|
|
- <if test="ifForeign != null and ifForeign =='1'"> -- 国外用户
|
|
|
+ <if test="ifForeign != null and ifForeign ==1"> -- 国外用户
|
|
|
from t_coin_order a left join t_equipment b on a.client_id = b.client_id where 1=1
|
|
|
</if>
|
|
|
<if test="adminId != null and adminId !=''">
|
|
|
and a.admin_id= #{adminId} -- 所属商家id
|
|
|
</if>
|
|
|
<if test="equipmentId != null and equipmentId !=''">
|
|
|
- <if test="ifForeign != null and ifForeign =='0'"> -- 国内用户
|
|
|
+ <if test="ifForeign != null and ifForeign ==0"> -- 国内用户
|
|
|
and a.equipment_id= #{equipmentId} -- 设备id
|
|
|
</if>
|
|
|
- <if test="ifForeign != null and ifForeign =='1'"> -- 国外用户
|
|
|
+ <if test="ifForeign != null and ifForeign ==1"> -- 国外用户
|
|
|
and b.id= #{equipmentId} -- 设备id
|
|
|
</if>
|
|
|
</if>
|
|
@@ -867,11 +867,11 @@ select 'year' as categorie, count(1) as saleNum,ifnull(sum(a.price),0) as salePr
|
|
|
<!-- 统计 机器销售-->
|
|
|
<select id="getEquipmentStatistics" resultMap="chartBean" parameterType="com.shawn.model.param.StatisticsParam">
|
|
|
select ifnull(b.name,SUBSTRING(a.client_id,1,4)) as categorie,count(1) as saleNum,sum(a.price) as salePrice
|
|
|
- <if test="ifForeign != null and ifForeign =='0'"> -- 国内用户
|
|
|
+ <if test="ifForeign != null and ifForeign ==0"> -- 国内用户
|
|
|
from t_order a,t_equipment b
|
|
|
where b.id = a.equipment_id and a.status='1'
|
|
|
</if>
|
|
|
- <if test="ifForeign != null and ifForeign =='1'"> -- 国外用户
|
|
|
+ <if test="ifForeign != null and ifForeign ==1"> -- 国外用户
|
|
|
from t_coin_order a,t_equipment b
|
|
|
where a.client_id = b.client_id
|
|
|
</if>
|