Commit 836260c6 by wilse

周转表查询优化

parent dde3b10e
......@@ -32,7 +32,7 @@ namespace AutoTurnOver.DB
/// <param name="order">排序类型</param>
/// <param name="sort">排序字段</param>
/// <returns></returns>
public static List<Models.dc_auto_turnover_list_dto> List(Condition_AutoTurnOver m, int offset, int limit, ref int total, string order = "", string sort = "", bool isSum = false)
public static List<Models.dc_auto_turnover_list_dto> List(Condition_AutoTurnOver m, int offset, int limit, ref int total, string order = "", string sort = "", bool isSum = false, bool isSumAndData = false)
{
try
{
......@@ -397,12 +397,16 @@ from dc_auto_turnover as dat
var limit_sql = "";
if (isSum)
{
total = 0;
total = _connection.QuerySingleOrDefault<int>(sqlCount, parameters, commandTimeout: 0);
return null;
}
else
{
total = _connection.QuerySingleOrDefault<int>(sqlCount, parameters, commandTimeout: 0);
total = 0;// _connection.QuerySingleOrDefault<int>(sqlCount, parameters, commandTimeout: 0);
if (isSumAndData)
{
_connection.QuerySingleOrDefault<int>(sqlCount, parameters, commandTimeout: 0);
}
//Console.WriteLine(sqlCount);
//设置默认排序字段
if (string.IsNullOrWhiteSpace(sort)) sort = "dat.id";
......
......@@ -27,13 +27,13 @@ namespace AutoTurnOver.Services
/// <param name = "order" > 排序类型 </ param >
/// <param name="sort">排序字段</param>
/// <returns></returns>
public List<dc_auto_turnover_list_dto> List(Condition_AutoTurnOver m, int offset, int limit, ref int total, string order = "", string sort = "", bool isSum = false)
public List<dc_auto_turnover_list_dto> List(Condition_AutoTurnOver m, int offset, int limit, ref int total, string order = "", string sort = "", bool isSum = false, bool isSumAndData = false)
{
if (!string.IsNullOrWhiteSpace(m.categoryIds))
{
m.categoryModels = ApiServices.GetNewClientNodesByIds(m.categoryIds.Split(',').Select(s => int.Parse(s)).ToList());
}
return DB.dc_auto_turnover.List(m, offset, limit, ref total, order, sort, isSum);
return DB.dc_auto_turnover.List(m, offset, limit, ref total, order, sort, isSum, isSumAndData);
}
public List<dc_base_order_data_source_dto> GetOrderDataSource(dc_base_order_data_source_search_dto m, int offset, int limit, ref int total)
......
......@@ -196,7 +196,10 @@ namespace AutoTurnOver.Controllers
var service = new Services.SkuAutoTurnServices();
var list = service.List(m, offset, limit, ref total, order, sort, true);
return new JsonResult(list == null || list.Count <= 0 ? new dc_auto_turnover_list_dto() : list[0]);
return new JsonResult(new
{
total = total
});
}
/// <summary>
......@@ -390,7 +393,7 @@ namespace AutoTurnOver.Controllers
var total = 0;
var service = new Services.SkuAutoTurnServices();
var list = service.List(m, offset, limit, ref total, "", "short_supply_time").Select(p => new
var list = service.List(m, offset, limit, ref total, "", "short_supply_time", false, true).Select(p => new
{
gmt_modified = p.gmt_modified.ToString("yyyy-MM-dd HH:mm:ss"),
p.bailun_sku,
......
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