From ff85178809e452e1f912d72a55d8ef6b3fb74333 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B4=81=20=E4=BB=BB?= Date: Thu, 14 Nov 2024 16:47:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E7=BB=84=E4=BF=A1=E6=81=AF--=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=9F=A5=E7=9C=8B=E5=B0=8F=E7=BB=84=E6=88=90=E5=91=98?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BaseApp/SysGroupManager/SysGroupApp.cs | 38 ++++++++++++++++++- .../BaseControllers/SysGroupController.cs | 15 ++++++++ 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/OpenAuth.App/BaseApp/SysGroupManager/SysGroupApp.cs b/OpenAuth.App/BaseApp/SysGroupManager/SysGroupApp.cs index fc57c8b..4baf3d6 100644 --- a/OpenAuth.App/BaseApp/SysGroupManager/SysGroupApp.cs +++ b/OpenAuth.App/BaseApp/SysGroupManager/SysGroupApp.cs @@ -91,7 +91,13 @@ namespace OpenAuth.App.BaseApp.SysGroupManager }; } //更新数据 - await uwo.SysGroup.UpdateAsync(group); + await uwo.SysGroup.UpdateSetColumnsTrueAsync(a => new SysGroup + { + Name = group.Name, + GroupLeaderId = group.GroupLeaderId, + GroupLeaderName = group.GroupLeaderName, + Remark = group.Remark + }, a => a.Id == id); //将组长添加中间表 SysGroupuser gu = new SysGroupuser(); @@ -190,5 +196,35 @@ namespace OpenAuth.App.BaseApp.SysGroupManager }; } } + + /// + /// 获取小组下的成员信息 + /// + /// + /// + /// + /// + /// + public async Task>>> LoadUserListByGroupid(string groupid,string keyword, int pageindex, int pagesize) + { + //定义且实例化分页数据 + RefAsync totalCount = 0; + //数据查询并返回 + var info = await client.Queryable() + .Where(r=>r.GroupId==groupid) + .LeftJoin((r,u)=>r.UserId==u.Id.ToString()) + .WhereIF(!string.IsNullOrEmpty(keyword), (r, u) => u.Name.Contains(keyword)) + .OrderBy((r, u) => u.Name) + .Select((r,u)=>u) + .ToPageListAsync(pageindex, pagesize, totalCount); + return new Response>> + { + Result = new PageInfo> + { + Items = info, + Total = totalCount + } + }; + } } } diff --git a/OpenAuth.WebApi/Controllers/BaseControllers/SysGroupController.cs b/OpenAuth.WebApi/Controllers/BaseControllers/SysGroupController.cs index bcf2b7d..f0f7654 100644 --- a/OpenAuth.WebApi/Controllers/BaseControllers/SysGroupController.cs +++ b/OpenAuth.WebApi/Controllers/BaseControllers/SysGroupController.cs @@ -108,5 +108,20 @@ namespace OpenAuth.WebApi.Controllers.BaseControllers } return result; } + + + /// + /// 根据小组id,获取成员信息 + /// + /// 小组id + /// 用户名筛选 + /// 当前页 + /// 每页条数 + /// + [HttpGet] + public async Task>>> LoadUserListByGroupid(string groupid, string keyword, int page, int limit) + { + return await _app.LoadUserListByGroupid(groupid,keyword, page, limit); + } } }