From 10037b4f7a561d049af74227aa90408619bce495 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E4=BC=9F?= <421281095@qq.com> Date: Thu, 21 Nov 2024 15:03:17 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=84=E5=91=98=E4=BB=BB=E5=8A=A1=E4=BC=98?= =?UTF-8?q?=E6=83=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OpenAuth.App/ServiceApp/Task/PersonTaskApp.cs | 26 ++++++++++++------- .../Task/Request/PersonTaskQuery.cs | 1 + 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/OpenAuth.App/ServiceApp/Task/PersonTaskApp.cs b/OpenAuth.App/ServiceApp/Task/PersonTaskApp.cs index 758e504..e5dc893 100644 --- a/OpenAuth.App/ServiceApp/Task/PersonTaskApp.cs +++ b/OpenAuth.App/ServiceApp/Task/PersonTaskApp.cs @@ -30,21 +30,27 @@ public class PersonTaskApp : SqlSugarBaseApp throw new Exception("登录失效"); } + List userIds; + if (string.IsNullOrEmpty(req.UserId)) + { + userIds = await Repository.ChangeRepository>() + .AsQueryable().InnerJoin((a, b) => a.Id == b.GroupId) + .Where(a => a.GroupLeaderId == userId) + .Select((a, b) => b.UserId) + .ToListAsync(); + } + else + { + userIds = new List(1) { userId }; + } - var userIds = await Repository.ChangeRepository>() - .AsQueryable().InnerJoin((a, b) => a.Id == b.GroupId) - .Where(a => a.GroupLeaderId == userId) - .Select((a, b) => b.UserId) - .ToListAsync(); - - userIds.Add(userId); RefAsync total = 0; var result = await Repository.AsQueryable() .RightJoin((a, b) => a.Id == b.TaskId) .Where((a, b) => userIds.Contains(b.ReciveUserId)) - .WhereIF(!string.IsNullOrEmpty(req.key),(a,b)=>a.TaskName.Contains(req.key)) - .OrderBy((a,b)=> b.CreateTime,OrderByType.Desc) + .WhereIF(!string.IsNullOrEmpty(req.key), (a, b) => a.TaskName.Contains(req.key)) + .OrderBy((a, b) => b.CreateTime, OrderByType.Desc) .Select((a, b) => new InsTaskExtend { RowNumber = SqlSugar.SqlFunc.RowNumber(b.Id), @@ -84,7 +90,7 @@ public class PersonTaskApp : SqlSugarBaseApp .RightJoin((a, b) => a.Id == b.TaskId) .InnerJoin((a, b, c) => a.ShpId == c.Id) .Where((a, b) => b.Id == taskGroupId) - .Select((a, b,c) => new InsTaskExtend + .Select((a, b, c) => new InsTaskExtend { TaskName = a.TaskName, // 任务名称 GroupName = b.GroupName, // 任务分组包 diff --git a/OpenAuth.App/ServiceApp/Task/Request/PersonTaskQuery.cs b/OpenAuth.App/ServiceApp/Task/Request/PersonTaskQuery.cs index 5a360bc..e56997e 100644 --- a/OpenAuth.App/ServiceApp/Task/Request/PersonTaskQuery.cs +++ b/OpenAuth.App/ServiceApp/Task/Request/PersonTaskQuery.cs @@ -4,4 +4,5 @@ namespace OpenAuth.App.ServiceApp.Task.Request; public class PersonTaskQuery : PageReq { + public string UserId { get; set; } } \ No newline at end of file