From bca6baef6540341f990140848f7e41be47d92b08 Mon Sep 17 00:00:00 2001 From: yanghongwei Date: Sun, 15 Jun 2025 18:40:58 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=88=97=E8=A1=A8=E9=98=B2?= =?UTF-8?q?=E5=8C=BA=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Model/UserEntity.cs | 5 +++++ Service/UserService.cs | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/Model/UserEntity.cs b/Model/UserEntity.cs index 9ab48d8..91d0c75 100644 --- a/Model/UserEntity.cs +++ b/Model/UserEntity.cs @@ -46,6 +46,11 @@ namespace LY.App.Model /// [SugarColumn(ColumnName = "position_id", ColumnDescription = "阵地ids", IsJson = true)] public List positionId { get; set; } + [SugarColumn(IsIgnore = true)] + /// + /// 用户关键防区名称数组 + /// + public List positionName { get; set; } } public class AddUser { diff --git a/Service/UserService.cs b/Service/UserService.cs index 067d651..19c64fc 100644 --- a/Service/UserService.cs +++ b/Service/UserService.cs @@ -208,6 +208,13 @@ namespace LY.App.Service .WhereIF(!string.IsNullOrEmpty(key), s => s.Name.Contains(key)) .OrderBy(s => s.Id) .ToPageListAsync(pageNum, pageSize, total); + query.ForEach(s => + { + if (s.positionId is not null && s.positionId.Any()) + { + s.positionName= _db.Queryable().Where(p =>s.positionId.Contains(p.Id)).Select(p => p.Name).ToList(); + } + }); return new { total = total.Value,