|
|
@@ -3217,10 +3217,12 @@ OPTION (MAXRECURSION 0); -- 允许无限递归 ";
|
|
|
|
|
|
List<int> userIds = new List<int>();
|
|
|
|
|
|
+ var mainId = 396;
|
|
|
+
|
|
|
try
|
|
|
{
|
|
|
Dictionary<int, int[]> result = JsonConvert.DeserializeObject<Dictionary<int, int[]>>(options.Remark);
|
|
|
- userIds = result[396].ToList();
|
|
|
+ userIds = result[mainId].ToList();
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
@@ -3228,19 +3230,45 @@ OPTION (MAXRECURSION 0); -- 允许无限递归 ";
|
|
|
return Ok(jw);
|
|
|
}
|
|
|
|
|
|
+ var UserCount = await _sqlSugar.Queryable<Sys_Users>()
|
|
|
+ .Where(x => x.IsDel == 0 && userIds.Contains(x.Id) && x.Id != mainId)
|
|
|
+ .CountAsync();
|
|
|
+
|
|
|
var dbQuery = _sqlSugar.Queryable<Pm_PerformanceAnalysis>()
|
|
|
- .LeftJoin<Sys_Users>((x, y) => x.UserId == y.Id && y.IsDel == 0)
|
|
|
- .Where((x, y) => x.IsDel == 0 && userIds.Contains(x.UserId)
|
|
|
- && x.StartDate == start && x.EndDate == end)
|
|
|
- .Select((x, y) => new { x.Id, x.JsonResult, x.UserId, x.StartDate, x.EndDate, y.CnName });
|
|
|
+ .LeftJoin<Sys_Users>((x, y) => x.UserId == y.Id && y.IsDel == 0)
|
|
|
+ .Where((x, y) => x.IsDel == 0
|
|
|
+ && userIds.Contains(x.UserId)
|
|
|
+ && x.UserId != mainId
|
|
|
+ && x.StartDate == start
|
|
|
+ && x.EndDate == end)
|
|
|
+ .Select((x, y) => new
|
|
|
+ {
|
|
|
+ x.Id,
|
|
|
+ x.UserId,
|
|
|
+ x.JsonResult,
|
|
|
+ x.StartDate,
|
|
|
+ x.EndDate,
|
|
|
+ x.CreateTime,
|
|
|
+ y.CnName,
|
|
|
+ rn = SqlFunc.RowNumber(
|
|
|
+ SqlFunc.Desc(x.CreateTime),
|
|
|
+ x.UserId
|
|
|
+ )
|
|
|
+ })
|
|
|
+ .MergeTable()
|
|
|
+ .Where(x => x.rn == 1);
|
|
|
+
|
|
|
|
|
|
var data = await dbQuery.ToListAsync();
|
|
|
|
|
|
- if (data.Count != userIds.Count)
|
|
|
+ var sql = dbQuery.ToSql();
|
|
|
+ Console.WriteLine(sql.Key);
|
|
|
+
|
|
|
+ if (data.Count != UserCount)
|
|
|
{
|
|
|
jw.Data = new { };
|
|
|
jw.Code = 203;
|
|
|
- jw.Msg = "还有" + (userIds.Count - data.Count) + "个用户未生成绩效数据!";
|
|
|
+ jw.Msg = "还有" + (UserCount - data.Count) + "个用户未生成绩效数据!";
|
|
|
}
|
|
|
else
|
|
|
{
|