Commit adf8becd authored by liudong1993's avatar liudong1993
parents 3ac2892c f58f2dc9
......@@ -1097,7 +1097,7 @@ as t GROUP BY t.CreateDate desc";
{
if (!string.IsNullOrWhiteSpace(dmodel.OrderNo))
{
where += $" and a.OrderNo like'%{dmodel.OrderNo}%'";
where += $" and a.OrderNo like '%{dmodel.OrderNo}%' ";
}
......@@ -1157,7 +1157,7 @@ GROUP BY b.GoodsId,b.SupplierId,b.OrderId ";
{
if (!string.IsNullOrWhiteSpace(dmodel.OrderNo))
{
where += $" and a.OrderNo like'%{dmodel.OrderNo}%'";
where += $" and a.OrderNo like '%{dmodel.OrderNo}%' ";
}
if (dmodel.TenantId > 0)
{
......@@ -1337,12 +1337,13 @@ GROUP BY b.Id order by b.Id asc";
public List<OrderStatistics_Query> GetFXAllOrderProfitLossList(OrderStatistics_Query dmodel)
{
string where = "where 1=1 and a.OrderStatus in(2,3,4,5,6) ";
DynamicParameters parameters = new DynamicParameters();
if (dmodel != null)
{
if (!string.IsNullOrWhiteSpace(dmodel.OrderNo))
{
where += $" and a.OrderNo like'%{dmodel.OrderNo}%'";
where += $" and a.OrderNo like @OrderNo ";
parameters.Add("OrderNo", "%" + dmodel.OrderNo.Trim() + "%");
}
if (dmodel.TenantId > 0)
{
......@@ -1405,7 +1406,7 @@ LEFT JOIN rb_member_user as muser on muser.id=b.CompanyId
left join rb_goods_orderaftersale oa on b.ID= oa.OrderDetialId and oa.Type=1 and oa.Status=0 and oa.ReOrderStatus in (2,3,4,5) {where}
GROUP BY b.Id order by b.Id asc ";
return Get<OrderStatistics_Query>(sql).ToList();
return Get<OrderStatistics_Query>(sql, parameters).ToList();
}
......
......@@ -293,12 +293,28 @@ GROUP BY A.GoodsId,A.GoodsName) as a ORDER BY a.{query.OrderBy} LIMIT 100 ");
{
query.OrderBy = "Income desc";
}
builder.AppendFormat($@"SELECT * from (SELECT C.`Name` AS UserName,C.Photo,COUNT(1) SaleCount,SUM(A.Final_Price) AS Income
FROM rb_goods_orderdetail AS A LEFT JOIN rb_goods_order AS B ON A.OrderId=B.OrderId
LEFT JOIN rb_member_user AS C ON B.UserId=C.Id
WHERE 1=1 AND A.GoodsId>0 {where}
GROUP BY B.UserId,C.`Name`
) as t ORDER BY t.{query.OrderBy} LIMIT 100");
// builder.AppendFormat($@"
//SELECT *
//FROM
// (
// SELECT C.`Name` AS UserName,C.Photo,COUNT(1) SaleCount,SUM(A.Final_Price) AS Income
// FROM rb_goods_orderdetail AS A LEFT JOIN rb_goods_order AS B ON A.OrderId=B.OrderId
// LEFT JOIN rb_member_user AS C ON B.UserId=C.Id
// WHERE 1=1 AND A.GoodsId>0 {where}
// GROUP BY B.UserId,C.`Name`
// ) as t ORDER BY t.{query.OrderBy} LIMIT 100");
builder.AppendFormat($@"
SELECT *
FROM
(
SELECT B.UserId, C.`Name` AS UserName,C.Photo,COUNT(1) SaleCount,SUM(A.Final_Price) AS Income
FROM rb_goods_orderdetail AS A INNER JOIN RB_Goods_OrderCommission AS oc ON A.Id=oc.OrderDetailId AND A.OrderId=oc.OrderId
INNER JOIN rb_goods_order AS B ON A.OrderId=B.OrderId
LEFT JOIN rb_member_user AS C ON oc.UserId=C.Id
WHERE 1=1 AND A.GoodsId>0 {where}
GROUP BY oc.UserId,C.`Name`
) as t ORDER BY t.{query.OrderBy} LIMIT 100");
var list = Get<MallSalesUserTop>(builder.ToString()).ToList();
if (list != null && list.Count > 0)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment