mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2026-02-04 22:49:49 +08:00
【修复】修复mysql下报表统计异常问题,优化显示数量问题。
This commit is contained in:
@@ -19,6 +19,7 @@ using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.ViewModels.Basics;
|
||||
using CoreCms.Net.Model.ViewModels.Echarts;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using CoreCms.Net.Utility.Helper;
|
||||
using SqlSugar;
|
||||
|
||||
|
||||
@@ -73,22 +74,21 @@ namespace CoreCms.Net.Services
|
||||
else if (dbTypeString == DbType.MySql.ToString())
|
||||
{
|
||||
sqlStr = @"select tmp_x.x,ifnull(sum(o.orderAmount),0) as val,count(o.orderId) as num
|
||||
from
|
||||
(SELECT @xi:=@xi+1 as x from
|
||||
(SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9 UNION SELECT 10) x1,
|
||||
(SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9 UNION SELECT 10) x2,
|
||||
(SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9 UNION SELECT 10) x3,
|
||||
(SELECT @xi:=-1) x0 limit 0," + num + @") tmp_x
|
||||
left join (
|
||||
select * from CoreCmsOrder
|
||||
where 1 = 1
|
||||
" + where + @"
|
||||
) o on tmp_x.x = ((cast(date(o." + joinVal + @") as signed) - " + sTime.ToString("yyyyMMdd") + @") div(" + section + @"))
|
||||
group by tmp_x.x
|
||||
";
|
||||
from
|
||||
(SELECT @xi:=@xi+1 as x from
|
||||
(SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9 UNION SELECT 10) x1,
|
||||
(SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9 UNION SELECT 10) x2,
|
||||
(SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9 UNION SELECT 10) x3,
|
||||
(SELECT @xi:=-1) x0 limit 0," + num + @") tmp_x
|
||||
left join (
|
||||
select * from CoreCmsOrder
|
||||
where 1 = 1
|
||||
" + where + @"
|
||||
) o on tmp_x.x = ((unix_timestamp(o." + joinVal + @") - " + CommonHelper.ConvertDateTimeToInt(sTime) + @") div(" + section + @"))
|
||||
group by tmp_x.x
|
||||
";
|
||||
}
|
||||
|
||||
|
||||
Console.WriteLine(sqlStr);
|
||||
var sp = new List<SugarParameter>();
|
||||
|
||||
var list = _dal.SqlQuery(sqlStr, sp);
|
||||
@@ -141,7 +141,7 @@ namespace CoreCms.Net.Services
|
||||
select * from CoreCmsBillPayments
|
||||
where 1 = 1
|
||||
" + where + @"
|
||||
) o on tmp_x.x = ((cast(date(o." + joinVal + @") as signed) - " + sTime.ToString("yyyy-MM-dd") + @") div(" + section + @"))
|
||||
) o on tmp_x.x = ((unix_timestamp(o." + joinVal + @") - " + CommonHelper.ConvertDateTimeToInt(sTime) + @") div(" + section + @"))
|
||||
group by tmp_x.x
|
||||
";
|
||||
}
|
||||
@@ -201,7 +201,7 @@ namespace CoreCms.Net.Services
|
||||
select* from CoreCmsBillRefund
|
||||
where 1 = 1
|
||||
" + where + @"
|
||||
) o on tmp_x.x = ((cast(date(o." + joinVal + @") as signed) - " + sTime.ToString("yyyy-MM-dd") + @") div(" + section + @"))
|
||||
) o on tmp_x.x = ((unix_timestamp(o." + joinVal + @") - " + CommonHelper.ConvertDateTimeToInt(sTime) + @") div(" + section + @"))
|
||||
group by tmp_x.x
|
||||
";
|
||||
}
|
||||
@@ -258,7 +258,7 @@ namespace CoreCms.Net.Services
|
||||
select * from CoreCmsUserTocash
|
||||
where 1 = 1
|
||||
" + where + @"
|
||||
) o on tmp_x.x = ((cast(date(o." + joinVal + @") as signed) - " + sTime.ToString("yyyy-MM-dd") + @") div(" + section + @"))
|
||||
) o on tmp_x.x = ((unix_timestamp(o." + joinVal + @") - " + CommonHelper.ConvertDateTimeToInt(sTime) + @") div(" + section + @"))
|
||||
group by tmp_x.x
|
||||
";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user