From b1722e89d9c5147d707cd44460501f34b0a70041 Mon Sep 17 00:00:00 2001 From: cjy Date: Mon, 9 Sep 2024 14:53:52 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=88=97=E8=A1=A8=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E8=A7=92=E8=89=B2=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DS.WMS.Core/Code/Entity/CodeDataRule.cs | 12 ++++ .../Code/Entity/CodeDataRuleTemplate.cs | 63 +++++++++++++++++++ .../DS.WMS.Core/Sys/Dtos/UserViewModel.cs | 5 ++ .../DS.WMS.Core/Sys/Method/UserService.cs | 14 ++++- 4 files changed, 92 insertions(+), 2 deletions(-) create mode 100644 ds-wms-service/DS.WMS.Core/Code/Entity/CodeDataRule.cs create mode 100644 ds-wms-service/DS.WMS.Core/Code/Entity/CodeDataRuleTemplate.cs diff --git a/ds-wms-service/DS.WMS.Core/Code/Entity/CodeDataRule.cs b/ds-wms-service/DS.WMS.Core/Code/Entity/CodeDataRule.cs new file mode 100644 index 00000000..41e55610 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Code/Entity/CodeDataRule.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DS.WMS.Core.Code.Entity +{ + internal class CodeDataRule + { + } +} diff --git a/ds-wms-service/DS.WMS.Core/Code/Entity/CodeDataRuleTemplate.cs b/ds-wms-service/DS.WMS.Core/Code/Entity/CodeDataRuleTemplate.cs new file mode 100644 index 00000000..30a323d1 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Code/Entity/CodeDataRuleTemplate.cs @@ -0,0 +1,63 @@ +using DS.Module.Core; +using DS.Module.Core.Data; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DS.WMS.Core.Code.Entity +{ + /// + /// 数据权限模板 + /// + [SqlSugar.SugarTable("code_data_rule_template","数据权限模板")] + public class CodeDataRuleTemplate : BaseModel + { + /// + /// 模板名称 + /// + [SqlSugar.SugarColumn(ColumnDescription = "模板名称", IsNullable = false, Length = 200)] + public string TemplateName { get; set; } + /// + /// 资源标识(权限ID) + /// + [SugarColumn(ColumnDescription = "资源标识(权限ID)")] + public long PermissionId { get; set; } + + /// + /// 权限实体 + /// + [SqlSugar.SugarColumn(ColumnDescription = "权限实体", IsNullable = false, Length = 100)] + public string PermissionEntity { get; set; } + /// + /// 中文视图名 + /// + [SqlSugar.SugarColumn(ColumnDescription = "中文视图名", IsNullable = true, Length = 50)] + public string ColumnView { get; set; } + + /// + /// 权限规则 + /// + [SugarColumn(ColumnDescription = "权限规则", IsNullable = true, ColumnDataType = StaticConfig.CodeFirst_BigString)] + public string DataRules { get; set; } + + /// + /// 数据权限描述 + /// + [SqlSugar.SugarColumn(ColumnDescription = "数据权限描述", IsNullable = true, Length = 200)] + public string Description { get; set; } + /// + /// 状态 + /// + [SqlSugar.SugarColumn(ColumnDescription = "状态")] + public StatusEnum? Status { get; set; } = StatusEnum.Enable; + + /// + /// 排序号 + /// + [SqlSugar.SugarColumn(ColumnDescription = "排序号", IsNullable = true, DefaultValue ="100")] + public int OrderNo { get; set; } + } +} diff --git a/ds-wms-service/DS.WMS.Core/Sys/Dtos/UserViewModel.cs b/ds-wms-service/DS.WMS.Core/Sys/Dtos/UserViewModel.cs index 8fa50044..44d95072 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Dtos/UserViewModel.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Dtos/UserViewModel.cs @@ -228,4 +228,9 @@ public class UserViewModel /// [Description("身份证号")] public string IdCardNo { get; set; } + + /// + /// 用户角色 + /// + public string RoleName { get; set; } } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/Sys/Method/UserService.cs b/ds-wms-service/DS.WMS.Core/Sys/Method/UserService.cs index 1df178ae..9b7bbcfa 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Method/UserService.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Method/UserService.cs @@ -50,14 +50,24 @@ public class UserService : IUserService public DataResult> GetListByPage(PageRequest request) { var query = _commonService.GetDataRuleFilter(); - - // var number =_commonService.GetSequenceNext(); + //序列化查询条件 var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition); var data = query .Where(x => x.UserCode != "admin") .Where(whereList).Select() + .Mapper(it => + { + var roleStr = string.Empty; + var roleIds = db.Queryable().Where(x => x.UserId == it.Id).Select(x => x.RoleId).ToArray(); + if (roleIds.Count()>0) + { + var roles = db.Queryable().Where(x => roleIds.Contains(x.Id)).Select(x => x.RoleName).ToArray(); + roleStr = roles.ToJoin(","); + } + it.RoleName = roleStr; + }) .ToQueryPage(request.PageCondition); return data; }