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,