Browse Source

refactor: 😀优化字典模块
1. 移除字典类型表租户隔离特
2. 以SysFlag字段区分平台字典与业务字典
3. 保留字典值Code字段,移除Name字段
4. 移除字典多租户查询条件

喵你个旺呀 1 year ago
parent
commit
bf2bf684fb
26 changed files with 165 additions and 469 deletions
  1. 3 3
      Admin.NET/Admin.NET.Core/Attribute/DictAttribute.cs
  2. 1 10
      Admin.NET/Admin.NET.Core/Entity/SysDictData.cs
  3. 7 1
      Admin.NET/Admin.NET.Core/Entity/SysDictType.cs
  4. 5 6
      Admin.NET/Admin.NET.Core/Job/EnumToDictJob.cs
  5. 49 49
      Admin.NET/Admin.NET.Core/SeedData/SysDictDataSeedData.cs
  6. 7 7
      Admin.NET/Admin.NET.Core/SeedData/SysDictTypeSeedData.cs
  7. 0 5
      Admin.NET/Admin.NET.Core/Service/Dict/Dto/DictDataInput.cs
  8. 0 5
      Admin.NET/Admin.NET.Core/Service/Dict/Dto/DictTypeInput.cs
  9. 17 61
      Admin.NET/Admin.NET.Core/Service/Dict/SysDictDataService.cs
  10. 28 65
      Admin.NET/Admin.NET.Core/Service/Dict/SysDictTypeService.cs
  11. 0 84
      Web/src/api-services/apis/sys-dict-type-api.ts
  12. 0 6
      Web/src/api-services/models/add-dict-data-input.ts
  13. 7 6
      Web/src/api-services/models/add-dict-type-input.ts
  14. 1 1
      Web/src/api-services/models/add-user-reg-way-input.ts
  15. 0 32
      Web/src/api-services/models/dict-type-move-input.ts
  16. 0 1
      Web/src/api-services/models/index.ts
  17. 0 6
      Web/src/api-services/models/page-dict-data-input.ts
  18. 0 6
      Web/src/api-services/models/page-dict-type-input.ts
  19. 0 6
      Web/src/api-services/models/sys-dict-data.ts
  20. 7 6
      Web/src/api-services/models/sys-dict-type.ts
  21. 0 6
      Web/src/api-services/models/update-dict-data-input.ts
  22. 7 6
      Web/src/api-services/models/update-dict-type-input.ts
  23. 1 1
      Web/src/api-services/models/update-user-reg-way-input.ts
  24. 7 5
      Web/src/views/system/dict/component/editDictData.vue
  25. 17 84
      Web/src/views/system/dict/index.vue
  26. 1 1
      Web/src/views/system/user/component/editUser.vue

+ 3 - 3
Admin.NET/Admin.NET.Core/Attribute/DictAttribute.cs

@@ -69,11 +69,11 @@ public class DictAttribute : ValidationAttribute, ITransient
         }
 
         // 先尝试从 ValidationContext 的依赖注入容器中拿服务,拿不到或类型不匹配时,再从全局的 App 容器中获取
-        if (validationContext.GetService(typeof(SysDictDataService)) is not SysDictDataService sysDictDataService)
-            sysDictDataService = App.GetRequiredService<SysDictDataService>();
+        if (validationContext.GetService(typeof(SysDictTypeService)) is not SysDictTypeService sysDictDataService)
+            sysDictDataService = App.GetRequiredService<SysDictTypeService>();
 
         // 获取字典值列表
-        var dictDataList = sysDictDataService.GetDataList(DictTypeCode).GetAwaiter().GetResult();
+        var dictDataList = sysDictDataService.GetDataList(new GetDataDictTypeInput { Code = DictTypeCode}).GetAwaiter().GetResult();
 
         // 使用 HashSet 来提高查找效率
         var dictHash = new HashSet<string>(dictDataList.Select(u => u.Value));

+ 1 - 10
Admin.NET/Admin.NET.Core/Entity/SysDictData.cs

@@ -25,7 +25,7 @@ public partial class SysDictData : EntityTenant
     /// </summary>
     [SugarColumn(ColumnDescription = "显示文本", Length = 256)]
     [Required, MaxLength(256)]
-    public virtual string? Label { get; set; }
+    public virtual string Label { get; set; }
 
     /// <summary>
     /// 值
@@ -38,19 +38,10 @@ public partial class SysDictData : EntityTenant
     /// 编码
     /// </summary>
     /// <remarks>
-    /// 即将移除的字段,直接移除该字段并不会从数据库中删除,且该字段之前是必填的,容易导致不能为null的异常,建议先保留,后期再移除
     /// </remarks>
-    [Obsolete("即将移除的字段, 已引用的建议尽快移除")]
     [SugarColumn(ColumnDescription = "编码", Length = 256)]
     public virtual string? Code { get; set; }
 
-    /// <summary>
-    /// 名称
-    /// </summary>
-    [SugarColumn(ColumnDescription = "名称", Length = 256)]
-    [MaxLength(256)]
-    public virtual string? Name { get; set; }
-
     /// <summary>
     /// 显示样式-标签颜色
     /// </summary>

+ 7 - 1
Admin.NET/Admin.NET.Core/Entity/SysDictType.cs

@@ -13,7 +13,7 @@ namespace Admin.NET.Core;
 [SysTable]
 [SugarIndex("index_{table}_N", nameof(Name), OrderByType.Asc)]
 [SugarIndex("index_{table}_C", nameof(Code), OrderByType.Asc)]
-public partial class SysDictType : EntityTenant
+public partial class SysDictType : EntityBase
 {
     /// <summary>
     /// 名称
@@ -42,6 +42,12 @@ public partial class SysDictType : EntityTenant
     [MaxLength(256)]
     public string? Remark { get; set; }
 
+    /// <summary>
+    /// 系统内置
+    /// </summary>
+    [SugarColumn(ColumnDescription = "系统内置")]
+    public YesNoEnum SysFlag { get; set; } = YesNoEnum.N;
+
     /// <summary>
     /// 状态
     /// </summary>

+ 5 - 6
Admin.NET/Admin.NET.Core/Job/EnumToDictJob.cs

@@ -64,9 +64,8 @@ public class EnumToDictJob : IJob
             await storageable2.AsUpdateable.UpdateColumns(u => new
             {
                 u.Label,
-                u.Name,
-                u.Value,
-                u.TenantId
+                u.Code,
+                u.Value
             }).ExecuteCommandAsync(stoppingToken);
 
             Console.WriteLine($"【{DateTime.Now}】系统枚举项转字典值数据: 插入{storageable2.InsertList.Count}条, 更新{storageable2.UpdateList.Count}条, 共{storageable2.TotalList.Count}条。");
@@ -125,16 +124,16 @@ public class EnumToDictJob : IJob
             var dictType = new SysDictType
             {
                 Id = 900000000000 + CommonUtil.GetFixedHashCode(type.TypeFullName),
+                SysFlag = YesNoEnum.Y,
                 Code = type.TypeName,
                 Name = type.TypeDescribe,
-                Remark = type.TypeFullName,
-                TenantId = SqlSugarConst.DefaultTenantId
+                Remark = type.TypeFullName
             };
             dictType.Children = type.EnumEntities.Select(x => new SysDictData
             {
                 Id = dictType.Id + orderNo++,
                 DictTypeId = dictType.Id,
-                Name = x.Name,
+                Code = x.Name,
                 Label = x.Describe,
                 Value = x.Value.ToString(),
                 OrderNo = x.Value + OrderOffset,

+ 49 - 49
Admin.NET/Admin.NET.Core/SeedData/SysDictDataSeedData.cs

@@ -20,61 +20,61 @@ public class SysDictDataSeedData : ISqlSugarEntitySeedData<SysDictData>
         var typeList = new SysDictTypeSeedData().HasData().ToList();
         return new[]
         {
-            new SysDictData{ Id=1300000000101, DictTypeId=typeList[0].Id, Label="输入框", Value="Input", OrderNo=100, Remark="输入框", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictData{ Id=1300000000102, DictTypeId=typeList[0].Id, Label="字典选择器", Value="DictSelector", OrderNo=100, Remark="字典选择器", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictData{ Id=1300000000103, DictTypeId=typeList[0].Id, Label="常量选择器", Value="ConstSelector", OrderNo=100, Remark="常量选择器", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictData{ Id=1300000000104, DictTypeId=typeList[0].Id, Label="枚举选择器", Value="EnumSelector", OrderNo=100, Remark="枚举选择器", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictData{ Id=1300000000105, DictTypeId=typeList[0].Id, Label="树选择器", Value="ApiTreeSelector", OrderNo=100, Remark="树选择器", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictData{ Id=1300000000106, DictTypeId=typeList[0].Id, Label="外键", Value="ForeignKey", OrderNo=100, Remark="外键", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictData{ Id=1300000000107, DictTypeId=typeList[0].Id, Label="数字输入框", Value="InputNumber", OrderNo=100, Remark="数字输入框", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictData{ Id=1300000000108, DictTypeId=typeList[0].Id, Label="时间选择", Value="DatePicker", OrderNo=100, Remark="时间选择", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictData{ Id=1300000000109, DictTypeId=typeList[0].Id, Label="文本域", Value="InputTextArea", OrderNo=100, Remark="文本域", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictData{ Id=1300000000110, DictTypeId=typeList[0].Id, Label="上传", Value="Upload", OrderNo=100, Remark="上传", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictData{ Id=1300000000111, DictTypeId=typeList[0].Id, Label="开关", Value="Switch", OrderNo=100, Remark="开关", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
+            new SysDictData{ Id=1300000000101, DictTypeId=typeList[0].Id, Label="输入框", Value="Input", OrderNo=100, Remark="输入框", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
+            new SysDictData{ Id=1300000000102, DictTypeId=typeList[0].Id, Label="字典选择器", Value="DictSelector", OrderNo=100, Remark="字典选择器", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
+            new SysDictData{ Id=1300000000103, DictTypeId=typeList[0].Id, Label="常量选择器", Value="ConstSelector", OrderNo=100, Remark="常量选择器", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
+            new SysDictData{ Id=1300000000104, DictTypeId=typeList[0].Id, Label="枚举选择器", Value="EnumSelector", OrderNo=100, Remark="枚举选择器", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
+            new SysDictData{ Id=1300000000105, DictTypeId=typeList[0].Id, Label="树选择器", Value="ApiTreeSelector", OrderNo=100, Remark="树选择器", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
+            new SysDictData{ Id=1300000000106, DictTypeId=typeList[0].Id, Label="外键", Value="ForeignKey", OrderNo=100, Remark="外键", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
+            new SysDictData{ Id=1300000000107, DictTypeId=typeList[0].Id, Label="数字输入框", Value="InputNumber", OrderNo=100, Remark="数字输入框", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
+            new SysDictData{ Id=1300000000108, DictTypeId=typeList[0].Id, Label="时间选择", Value="DatePicker", OrderNo=100, Remark="时间选择", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
+            new SysDictData{ Id=1300000000109, DictTypeId=typeList[0].Id, Label="文本域", Value="InputTextArea", OrderNo=100, Remark="文本域", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
+            new SysDictData{ Id=1300000000110, DictTypeId=typeList[0].Id, Label="上传", Value="Upload", OrderNo=100, Remark="上传", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
+            new SysDictData{ Id=1300000000111, DictTypeId=typeList[0].Id, Label="开关", Value="Switch", OrderNo=100, Remark="开关", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
 
-            new SysDictData{ Id=1300000000201, DictTypeId=typeList[1].Id, Label="等于", Value="==", OrderNo=1, Remark="等于", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictData{ Id=1300000000202, DictTypeId=typeList[1].Id, Label="模糊", Value="like", OrderNo=1, Remark="模糊", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictData{ Id=1300000000203, DictTypeId=typeList[1].Id, Label="大于", Value=">", OrderNo=1, Remark="大于", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictData{ Id=1300000000204, DictTypeId=typeList[1].Id, Label="小于", Value="<", OrderNo=1, Remark="小于", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictData{ Id=1300000000205, DictTypeId=typeList[1].Id, Label="不等于", Value="!=", OrderNo=1, Remark="不等于", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictData{ Id=1300000000206, DictTypeId=typeList[1].Id, Label="大于等于", Value=">=", OrderNo=1, Remark="大于等于", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictData{ Id=1300000000207, DictTypeId=typeList[1].Id, Label="小于等于", Value="<=", OrderNo=1, Remark="小于等于", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictData{ Id=1300000000208, DictTypeId=typeList[1].Id, Label="不为空", Value="isNotNull", OrderNo=1, Remark="不为空", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictData{ Id=1300000000209, DictTypeId=typeList[1].Id, Label="时间范围", Value="~", OrderNo=1, Remark="时间范围", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
+            new SysDictData{ Id=1300000000201, DictTypeId=typeList[1].Id, Label="等于", Value="==", OrderNo=1, Remark="等于", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
+            new SysDictData{ Id=1300000000202, DictTypeId=typeList[1].Id, Label="模糊", Value="like", OrderNo=1, Remark="模糊", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
+            new SysDictData{ Id=1300000000203, DictTypeId=typeList[1].Id, Label="大于", Value=">", OrderNo=1, Remark="大于", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
+            new SysDictData{ Id=1300000000204, DictTypeId=typeList[1].Id, Label="小于", Value="<", OrderNo=1, Remark="小于", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
+            new SysDictData{ Id=1300000000205, DictTypeId=typeList[1].Id, Label="不等于", Value="!=", OrderNo=1, Remark="不等于", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
+            new SysDictData{ Id=1300000000206, DictTypeId=typeList[1].Id, Label="大于等于", Value=">=", OrderNo=1, Remark="大于等于", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
+            new SysDictData{ Id=1300000000207, DictTypeId=typeList[1].Id, Label="小于等于", Value="<=", OrderNo=1, Remark="小于等于", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
+            new SysDictData{ Id=1300000000208, DictTypeId=typeList[1].Id, Label="不为空", Value="isNotNull", OrderNo=1, Remark="不为空", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
+            new SysDictData{ Id=1300000000209, DictTypeId=typeList[1].Id, Label="时间范围", Value="~", OrderNo=1, Remark="时间范围", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
 
-            new SysDictData{ Id=1300000000301, DictTypeId=typeList[2].Id, Label="long", Value="long", OrderNo=1, Remark="long", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictData{ Id=1300000000302, DictTypeId=typeList[2].Id, Label="string", Value="string", OrderNo=1, Remark="string", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictData{ Id=1300000000303, DictTypeId=typeList[2].Id, Label="DateTime", Value="DateTime", OrderNo=1, Remark="DateTime", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictData{ Id=1300000000304, DictTypeId=typeList[2].Id, Label="bool", Value="bool", OrderNo=1, Remark="bool", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictData{ Id=1300000000305, DictTypeId=typeList[2].Id, Label="int", Value="int", OrderNo=1, Remark="int", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictData{ Id=1300000000306, DictTypeId=typeList[2].Id, Label="double", Value="double", OrderNo=1, Remark="double", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictData{ Id=1300000000307, DictTypeId=typeList[2].Id, Label="float", Value="float", OrderNo=1, Remark="float", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictData{ Id=1300000000308, DictTypeId=typeList[2].Id, Label="decimal", Value="decimal", OrderNo=1, Remark="decimal", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictData{ Id=1300000000309, DictTypeId=typeList[2].Id, Label="Guid", Value="Guid", OrderNo=1, Remark="Guid", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictData{ Id=1300000000310, DictTypeId=typeList[2].Id, Label="DateTimeOffset", Value="DateTimeOffset", OrderNo=1, Remark="DateTimeOffset", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
+            new SysDictData{ Id=1300000000301, DictTypeId=typeList[2].Id, Label="long", Value="long", OrderNo=1, Remark="long", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
+            new SysDictData{ Id=1300000000302, DictTypeId=typeList[2].Id, Label="string", Value="string", OrderNo=1, Remark="string", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
+            new SysDictData{ Id=1300000000303, DictTypeId=typeList[2].Id, Label="DateTime", Value="DateTime", OrderNo=1, Remark="DateTime", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
+            new SysDictData{ Id=1300000000304, DictTypeId=typeList[2].Id, Label="bool", Value="bool", OrderNo=1, Remark="bool", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
+            new SysDictData{ Id=1300000000305, DictTypeId=typeList[2].Id, Label="int", Value="int", OrderNo=1, Remark="int", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
+            new SysDictData{ Id=1300000000306, DictTypeId=typeList[2].Id, Label="double", Value="double", OrderNo=1, Remark="double", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
+            new SysDictData{ Id=1300000000307, DictTypeId=typeList[2].Id, Label="float", Value="float", OrderNo=1, Remark="float", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
+            new SysDictData{ Id=1300000000308, DictTypeId=typeList[2].Id, Label="decimal", Value="decimal", OrderNo=1, Remark="decimal", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
+            new SysDictData{ Id=1300000000309, DictTypeId=typeList[2].Id, Label="Guid", Value="Guid", OrderNo=1, Remark="Guid", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
+            new SysDictData{ Id=1300000000310, DictTypeId=typeList[2].Id, Label="DateTimeOffset", Value="DateTimeOffset", OrderNo=1, Remark="DateTimeOffset", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
 
-            new SysDictData{ Id=1300000000401, DictTypeId=typeList[3].Id, Label="下载压缩包", Value="100", OrderNo=1, Remark="下载压缩包", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictData{ Id=1300000000402, DictTypeId=typeList[3].Id, Label="下载压缩包(前端)", Value="111", OrderNo=2, Remark="下载压缩包(前端)", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictData{ Id=1300000000403, DictTypeId=typeList[3].Id, Label="下载压缩包(后端)", Value="121", OrderNo=3, Remark="下载压缩包(后端)", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictData{ Id=1300000000404, DictTypeId=typeList[3].Id, Label="生成到本项目", Value="200", OrderNo=4, Remark="生成到本项目", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictData{ Id=1300000000405, DictTypeId=typeList[3].Id, Label="生成到本项目(前端)", Value="211", OrderNo=5, Remark="生成到本项目(前端)", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictData{ Id=1300000000406, DictTypeId=typeList[3].Id, Label="生成到本项目(后端)", Value="221", OrderNo=6, Remark="生成到本项目(后端)", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
+            new SysDictData{ Id=1300000000401, DictTypeId=typeList[3].Id, Label="下载压缩包", Value="100", OrderNo=1, Remark="下载压缩包", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
+            new SysDictData{ Id=1300000000402, DictTypeId=typeList[3].Id, Label="下载压缩包(前端)", Value="111", OrderNo=2, Remark="下载压缩包(前端)", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
+            new SysDictData{ Id=1300000000403, DictTypeId=typeList[3].Id, Label="下载压缩包(后端)", Value="121", OrderNo=3, Remark="下载压缩包(后端)", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
+            new SysDictData{ Id=1300000000404, DictTypeId=typeList[3].Id, Label="生成到本项目", Value="200", OrderNo=4, Remark="生成到本项目", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
+            new SysDictData{ Id=1300000000405, DictTypeId=typeList[3].Id, Label="生成到本项目(前端)", Value="211", OrderNo=5, Remark="生成到本项目(前端)", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
+            new SysDictData{ Id=1300000000406, DictTypeId=typeList[3].Id, Label="生成到本项目(后端)", Value="221", OrderNo=6, Remark="生成到本项目(后端)", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
 
-            new SysDictData{ Id=1300000000501, DictTypeId=typeList[4].Id, Label="EntityBaseId【基础实体Id】", Value="EntityBaseId", OrderNo=1, Remark="【基础实体Id】", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictData{ Id=1300000000502, DictTypeId=typeList[4].Id, Label="EntityBase【基础实体】", Value="EntityBase", OrderNo=1, Remark="【基础实体】", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictData{ Id=1300000000503, DictTypeId=typeList[4].Id, Label="EntityTenantId【租户实体Id】", Value="EntityTenantId", OrderNo=1, Remark="【租户实体Id】", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictData{ Id=1300000000504, DictTypeId=typeList[4].Id, Label="EntityTenant【租户实体】", Value="EntityTenant", OrderNo=1, Remark="【租户实体】", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictData{ Id=1300000000505, DictTypeId=typeList[4].Id, Label="EntityBaseData【业务实体】", Value="EntityBaseData", OrderNo=1, Remark="【业务实体】", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictData{ Id=1300000000506, DictTypeId=typeList[4].Id, Label="EntityTenantBaseData【租户业务实体】", Value="EntityTenantBaseData", OrderNo=1, Remark="【租户业务实体】", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
+            new SysDictData{ Id=1300000000501, DictTypeId=typeList[4].Id, Label="EntityBaseId【基础实体Id】", Value="EntityBaseId", OrderNo=1, Remark="【基础实体Id】", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
+            new SysDictData{ Id=1300000000502, DictTypeId=typeList[4].Id, Label="EntityBase【基础实体】", Value="EntityBase", OrderNo=1, Remark="【基础实体】", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
+            new SysDictData{ Id=1300000000503, DictTypeId=typeList[4].Id, Label="EntityTenantId【租户实体Id】", Value="EntityTenantId", OrderNo=1, Remark="【租户实体Id】", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
+            new SysDictData{ Id=1300000000504, DictTypeId=typeList[4].Id, Label="EntityTenant【租户实体】", Value="EntityTenant", OrderNo=1, Remark="【租户实体】", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
+            new SysDictData{ Id=1300000000505, DictTypeId=typeList[4].Id, Label="EntityBaseData【业务实体】", Value="EntityBaseData", OrderNo=1, Remark="【业务实体】", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
+            new SysDictData{ Id=1300000000506, DictTypeId=typeList[4].Id, Label="EntityTenantBaseData【租户业务实体】", Value="EntityTenantBaseData", OrderNo=1, Remark="【租户业务实体】", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
 
-            new SysDictData{ Id=1300000000601, DictTypeId=typeList[5].Id, Label="不需要", Value="off", OrderNo=100, Remark="不需要打印支持", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-12-04 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictData{ Id=1300000000602, DictTypeId=typeList[5].Id, Label="绑定打印模版", Value="custom", OrderNo=101, Remark="绑定打印模版", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-12-04 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
+            new SysDictData{ Id=1300000000601, DictTypeId=typeList[5].Id, Label="不需要", Value="off", OrderNo=100, Remark="不需要打印支持", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-12-04 00:00:00") },
+            new SysDictData{ Id=1300000000602, DictTypeId=typeList[5].Id, Label="绑定打印模版", Value="custom", OrderNo=101, Remark="绑定打印模版", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-12-04 00:00:00") },
 
-            new SysDictData{ Id=1300000000701, DictTypeId=typeList[6].Id, Label="集团", Value="101", OrderNo=100, Remark="集团", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictData{ Id=1300000000702, DictTypeId=typeList[6].Id, Label="公司", Value="201", OrderNo=101, Remark="公司", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictData{ Id=1300000000703, DictTypeId=typeList[6].Id, Label="部门", Value="301", OrderNo=102, Remark="部门", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictData{ Id=1300000000704, DictTypeId=typeList[6].Id, Label="区域", Value="401", OrderNo=103, Remark="区域", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictData{ Id=1300000000705, DictTypeId=typeList[6].Id, Label="组", Value="501", OrderNo=104, Remark="组", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
+            new SysDictData{ Id=1300000000701, DictTypeId=typeList[6].Id, Label="集团", Value="101", OrderNo=100, Remark="集团", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-02-10 00:00:00") },
+            new SysDictData{ Id=1300000000702, DictTypeId=typeList[6].Id, Label="公司", Value="201", OrderNo=101, Remark="公司", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-02-10 00:00:00") },
+            new SysDictData{ Id=1300000000703, DictTypeId=typeList[6].Id, Label="部门", Value="301", OrderNo=102, Remark="部门", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-02-10 00:00:00") },
+            new SysDictData{ Id=1300000000704, DictTypeId=typeList[6].Id, Label="区域", Value="401", OrderNo=103, Remark="区域", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-02-10 00:00:00") },
+            new SysDictData{ Id=1300000000705, DictTypeId=typeList[6].Id, Label="组", Value="501", OrderNo=104, Remark="组", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-02-10 00:00:00") },
         };
     }
 }

+ 7 - 7
Admin.NET/Admin.NET.Core/SeedData/SysDictTypeSeedData.cs

@@ -19,13 +19,13 @@ public class SysDictTypeSeedData : ISqlSugarEntitySeedData<SysDictType>
     {
         return new[]
         {
-            new SysDictType{ Id=1300000000111, Name="代码生成控件类型", Code="code_gen_effect_type", OrderNo=100, Remark="代码生成控件类型", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictType{ Id=1300000000121, Name="代码生成查询类型", Code="code_gen_query_type", OrderNo=101, Remark="代码生成查询类型", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictType{ Id=1300000000131, Name="代码生成.NET类型", Code="code_gen_net_type", OrderNo=102, Remark="代码生成.NET类型", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictType{ Id=1300000000141, Name="代码生成方式", Code="code_gen_create_type", OrderNo=103, Remark="代码生成方式", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictType{ Id=1300000000151, Name="代码生成基类", Code="code_gen_base_class", OrderNo=104, Remark="代码生成基类", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictType{ Id=1300000000161, Name="代码生成打印类型", Code="code_gen_print_type", OrderNo=105, Remark="代码生成打印类型", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-12-04 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
-            new SysDictType{ Id=1300000000171, Name="机构类型", Code="org_type", OrderNo=201, Remark="机构类型", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-02-10 00:00:00"),TenantId=SqlSugarConst.DefaultTenantId },
+            new SysDictType{ Id=1300000000111, Name="代码生成控件类型", Code="code_gen_effect_type", SysFlag=YesNoEnum.Y, OrderNo=100, Remark="代码生成控件类型", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
+            new SysDictType{ Id=1300000000121, Name="代码生成查询类型", Code="code_gen_query_type", SysFlag=YesNoEnum.Y, OrderNo=101, Remark="代码生成查询类型", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
+            new SysDictType{ Id=1300000000131, Name="代码生成.NET类型", Code="code_gen_net_type", SysFlag=YesNoEnum.Y, OrderNo=102, Remark="代码生成.NET类型", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
+            new SysDictType{ Id=1300000000141, Name="代码生成方式", Code="code_gen_create_type", SysFlag=YesNoEnum.Y, OrderNo=103, Remark="代码生成方式", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
+            new SysDictType{ Id=1300000000151, Name="代码生成基类", Code="code_gen_base_class", SysFlag=YesNoEnum.Y, OrderNo=104, Remark="代码生成基类", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
+            new SysDictType{ Id=1300000000161, Name="代码生成打印类型", Code="code_gen_print_type", SysFlag=YesNoEnum.Y, OrderNo=105, Remark="代码生成打印类型", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-12-04 00:00:00") },
+            new SysDictType{ Id=1300000000171, Name="机构类型", Code="org_type", SysFlag=YesNoEnum.Y, OrderNo=201, Remark="机构类型", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2023-02-10 00:00:00") },
         };
     }
 }

+ 0 - 5
Admin.NET/Admin.NET.Core/Service/Dict/Dto/DictDataInput.cs

@@ -21,11 +21,6 @@ public class PageDictDataInput : BasePageInput
     /// 字典文本
     /// </summary>
     public string Label { get; set; }
-
-    /// <summary>
-    /// 租户Id
-    /// </summary>
-    public long TenantId { get; set; }
 }
 
 public class AddDictDataInput : SysDictData

+ 0 - 5
Admin.NET/Admin.NET.Core/Service/Dict/Dto/DictTypeInput.cs

@@ -21,11 +21,6 @@ public class PageDictTypeInput : BasePageInput
     /// 编码
     /// </summary>
     public string Code { get; set; }
-
-    /// <summary>
-    /// 租户Id
-    /// </summary>
-    public long TenantId { get; set; }
 }
 
 public class AddDictTypeInput : SysDictType

+ 17 - 61
Admin.NET/Admin.NET.Core/Service/Dict/SysDictDataService.cs

@@ -35,12 +35,9 @@ public class SysDictDataService : IDynamicApiController, ITransient
     [DisplayName("获取字典值分页列表")]
     public async Task<SqlSugarPagedList<SysDictData>> Page(PageDictDataInput input)
     {
-        var ids = GetTenantIdList();
         return await _sysDictDataRep.AsQueryable()
             .Where(u => u.DictTypeId == input.DictTypeId)
-            .WhereIF(!_userManager.SuperAdmin, u => ids.Contains(u.TenantId.Value))
             .WhereIF(!string.IsNullOrEmpty(input.Label?.Trim()), u => u.Value.Contains(input.Label))
-            .WhereIF(_userManager.SuperAdmin && input.TenantId > 0, u => u.TenantId == input.TenantId)
             .OrderBy(u => new { u.OrderNo, Code = u.Value })
             .ToPagedListAsync(input.Page, input.PageSize);
     }
@@ -52,7 +49,7 @@ public class SysDictDataService : IDynamicApiController, ITransient
     [DisplayName("获取字典值列表")]
     public async Task<List<SysDictData>> GetList([FromQuery] GetDataDictDataInput input)
     {
-        return await GetDictDataListByDictTypeId(input.DictTypeId);
+        return await _sysDictDataRep.AsQueryable().Where(u => u.DictTypeId == input.DictTypeId).ToListAsync();
     }
 
     /// <summary>
@@ -64,10 +61,10 @@ public class SysDictDataService : IDynamicApiController, ITransient
     [DisplayName("增加字典值")]
     public async Task AddDictData(AddDictDataInput input)
     {
-        var isExist = await _sysDictDataRep.AsQueryable().ClearFilter().AnyAsync(u => u.Value == input.Value && u.DictTypeId == input.DictTypeId);
+        var isExist = await _sysDictDataRep.IsAnyAsync(u => u.Value == input.Value && u.DictTypeId == input.DictTypeId);
         if (isExist) throw Oops.Oh(ErrorCodeEnum.D3003);
 
-        var dictTypeCode = await _sysDictDataRep.AsQueryable().ClearFilter().Where(u => u.DictTypeId == input.DictTypeId).Select(u => u.DictType.Code).FirstAsync();
+        var dictTypeCode = await _sysDictDataRep.AsQueryable().Where(u => u.DictTypeId == input.DictTypeId).Select(u => u.DictType.Code).FirstAsync();
         _sysCacheService.RemoveByPrefixKey($"{CacheConst.KeyDict}{dictTypeCode}");
 
         await _sysDictDataRep.InsertAsync(input.Adapt<SysDictData>());
@@ -83,13 +80,13 @@ public class SysDictDataService : IDynamicApiController, ITransient
     [DisplayName("更新字典值")]
     public async Task UpdateDictData(UpdateDictDataInput input)
     {
-        var isExist = await _sysDictDataRep.AsQueryable().ClearFilter().AnyAsync(u => u.Id == input.Id);
+        var isExist = await _sysDictDataRep.IsAnyAsync(u => u.Id == input.Id);
         if (!isExist) throw Oops.Oh(ErrorCodeEnum.D3004);
 
-        isExist = await _sysDictDataRep.AsQueryable().ClearFilter().AnyAsync(u => u.Value == input.Value && u.DictTypeId == input.DictTypeId && u.Id != input.Id);
+        isExist = await _sysDictDataRep.IsAnyAsync(u => u.Value == input.Value && u.DictTypeId == input.DictTypeId && u.Id != input.Id);
         if (isExist) throw Oops.Oh(ErrorCodeEnum.D3003);
 
-        var dictTypeCode = await _sysDictDataRep.AsQueryable().ClearFilter().Where(u => u.DictTypeId == input.DictTypeId).Select(u => u.DictType.Code).FirstAsync();
+        var dictTypeCode = await _sysDictDataRep.AsQueryable().Where(u => u.DictTypeId == input.DictTypeId).Select(u => u.DictType.Code).FirstAsync();
         _sysCacheService.RemoveByPrefixKey($"{CacheConst.KeyDict}{dictTypeCode}");
 
         await _sysDictDataRep.UpdateAsync(input.Adapt<SysDictData>());
@@ -105,9 +102,9 @@ public class SysDictDataService : IDynamicApiController, ITransient
     [DisplayName("删除字典值")]
     public async Task DeleteDictData(DeleteDictDataInput input)
     {
-        var dictData = await GetSysDictDataQueryable().FirstAsync(u => u.Id == input.Id) ?? throw Oops.Oh(ErrorCodeEnum.D3004);
+        var dictData = await _sysDictDataRep.AsQueryable().FirstAsync(u => u.Id == input.Id) ?? throw Oops.Oh(ErrorCodeEnum.D3004);
 
-        var dictTypeCode = await GetSysDictDataQueryable().Where(u => u.DictTypeId == dictData.Id).Select(u => u.DictType.Code).FirstAsync();
+        var dictTypeCode = await _sysDictDataRep.AsQueryable().Where(u => u.DictTypeId == dictData.Id).Select(u => u.DictType.Code).FirstAsync();
         _sysCacheService.RemoveByPrefixKey($"{CacheConst.KeyDict}{dictTypeCode}");
 
         await _sysDictDataRep.DeleteAsync(dictData);
@@ -142,17 +139,6 @@ public class SysDictDataService : IDynamicApiController, ITransient
         await _sysDictDataRep.AsUpdateable(dictData).UpdateColumns(u => new { u.Status }, true).ExecuteCommandAsync();
     }
 
-    /// <summary>
-    /// 根据字典类型Id获取字典值集合
-    /// </summary>
-    /// <param name="dictTypeId"></param>
-    /// <returns></returns>
-    [NonAction]
-    public async Task<List<SysDictData>> GetDictDataListByDictTypeId(long dictTypeId)
-    {
-        return await GetSysDictDataQueryable().Where(u => u.DictTypeId == dictTypeId).OrderBy(u => new { u.OrderNo, Code = u.Value }).ToListAsync();
-    }
-
     /// <summary>
     /// 根据字典类型编码获取字典值集合 🔖
     /// </summary>
@@ -161,19 +147,12 @@ public class SysDictDataService : IDynamicApiController, ITransient
     [DisplayName("根据字典类型编码获取字典值集合")]
     public async Task<List<SysDictData>> GetDataList(string code)
     {
-        var ids = GetTenantIdList();
-        var cacheKey = $"{CacheConst.KeyDict}{code}:{string.Join("|", ids)}";
+        var cacheKey = $"{CacheConst.KeyDict}{code}";
         var dictDataList = _sysCacheService.Get<List<SysDictData>>(cacheKey);
-        if (dictDataList == null)
-        {
-            dictDataList = await _sysDictDataRep.Context.Queryable<SysDictType>().ClearFilter()
-                .LeftJoin<SysDictData>((u, a) => u.Id == a.DictTypeId)
-                .Where((u, a) => u.Code == code && u.Status == StatusEnum.Enable && a.Status == StatusEnum.Enable && a.IsDelete == false)
-                .WhereIF(!_userManager.SuperAdmin, (u, a) => ids.Contains(u.TenantId.Value) && ids.Contains(a.TenantId.Value))
-                .OrderBy((u, a) => new { a.OrderNo, Code = a.Value })
-                .Select((u, a) => a).ToListAsync();
-            _sysCacheService.Set(cacheKey, dictDataList);
-        }
+        if (dictDataList != null) return dictDataList;
+
+        dictDataList = await _sysDictDataRep.AsQueryable().Includes(u => u.DictType).Where(u => u.DictType.Code == code).ToListAsync();
+        _sysCacheService.Set(cacheKey, dictDataList);
         return dictDataList;
     }
 
@@ -185,34 +164,12 @@ public class SysDictDataService : IDynamicApiController, ITransient
     [DisplayName("根据查询条件获取字典值集合")]
     public async Task<List<SysDictData>> GetDataList([FromQuery] QueryDictDataInput input)
     {
-        var ids = GetTenantIdList();
-        return await _sysDictDataRep.Context.Queryable<SysDictType>()
-            .LeftJoin<SysDictData>((u, a) => u.Id == a.DictTypeId)
-            .Where((u, a) => u.Code == input.Code)
-            .WhereIF(input.Status.HasValue, (u, a) => a.Status == (StatusEnum)input.Status.Value)
-            .WhereIF(!_userManager.SuperAdmin, (u, a) => ids.Contains(u.TenantId.Value) && ids.Contains(a.TenantId.Value))
-            .OrderBy((u, a) => new { a.OrderNo, Code = a.Value })
-            .Select((u, a) => a).ToListAsync();
+        return await _sysDictDataRep.AsQueryable().Includes(u => u.DictType)
+            .Where(u => u.DictType.Code == input.Code)
+            .WhereIF(input.Status > 0, u => u.Status == (StatusEnum)input.Status)
+            .ToListAsync();
     }
 
-    /// <summary>
-    /// 获取租户Id列表
-    /// </summary>
-    /// <returns></returns>
-    [NonAction]
-    public List<long> GetTenantIdList() => SysDictTypeService.GetTenantIdList();
-
-    /// <summary>
-    /// 获取SysDictData表查询实例
-    /// </summary>
-    /// <returns></returns>
-    [NonAction]
-    public ISugarQueryable<SysDictData> GetSysDictDataQueryable()
-    {
-        var ids = GetTenantIdList();
-        return _sysDictDataRep.AsQueryable().ClearFilter()
-            .Where(u => u.IsDelete == false).WhereIF(!_userManager.SuperAdmin, u => ids.Contains(u.TenantId.Value));
-    }
 
     /// <summary>
     /// 根据字典类型Id删除字典值
@@ -224,7 +181,6 @@ public class SysDictDataService : IDynamicApiController, ITransient
     {
         var dictTypeCode = await _sysDictDataRep.AsQueryable().Where(u => u.DictTypeId == dictTypeId).Select(u => u.DictType.Code).FirstAsync();
         _sysCacheService.RemoveByPrefixKey($"{CacheConst.KeyDict}{dictTypeCode}");
-
         await _sysDictDataRep.DeleteAsync(u => u.DictTypeId == dictTypeId);
     }
 }

+ 28 - 65
Admin.NET/Admin.NET.Core/Service/Dict/SysDictTypeService.cs

@@ -36,8 +36,7 @@ public class SysDictTypeService : IDynamicApiController, ITransient
     public async Task<SqlSugarPagedList<SysDictType>> Page(PageDictTypeInput input)
     {
         return await _sysDictTypeRep.AsQueryable()
-            .WhereIF(!_userManager.SuperAdmin, u => !SqlFunc.EndsWith(SqlFunc.ToLower(u.Code), nameof(Enum).ToLower()))
-            .WhereIF(_userManager.SuperAdmin && input.TenantId > 0, u => u.TenantId == input.TenantId)
+            .WhereIF(!_userManager.SuperAdmin, u => u.SysFlag == YesNoEnum.N)
             .WhereIF(!string.IsNullOrEmpty(input.Code?.Trim()), u => u.Code.Contains(input.Code))
             .WhereIF(!string.IsNullOrEmpty(input.Name?.Trim()), u => u.Name.Contains(input.Name))
             .OrderBy(u => new { u.OrderNo, u.Code })
@@ -51,7 +50,7 @@ public class SysDictTypeService : IDynamicApiController, ITransient
     [DisplayName("获取字典类型列表")]
     public async Task<List<SysDictType>> GetList()
     {
-        return await GetSysDictDataQueryable().OrderBy(u => new { u.OrderNo, u.Code }).ToListAsync();
+        return await _sysDictTypeRep.AsQueryable().OrderBy(u => new { u.OrderNo, u.Code }).ToListAsync();
     }
 
     /// <summary>
@@ -59,11 +58,15 @@ public class SysDictTypeService : IDynamicApiController, ITransient
     /// </summary>
     /// <param name="input"></param>
     /// <returns></returns>
+    [UnitOfWork]
     [DisplayName("获取字典类型-值列表")]
     public async Task<List<SysDictData>> GetDataList([FromQuery] GetDataDictTypeInput input)
     {
-        var dictType = await GetSysDictDataQueryable().FirstAsync(u => u.Code == input.Code) ?? throw Oops.Oh(ErrorCodeEnum.D3000);
-        return await _sysDictDataService.GetDictDataListByDictTypeId(dictType.Id);
+        return await _sysDictTypeRep.AsQueryable()
+            .Where(u => u.Code == input.Code)
+            .InnerJoin<SysDictData>((u, w) => u.Id == w.DictTypeId)
+            .Select((u, w) => w)
+            .ToListAsync() ?? throw Oops.Oh(ErrorCodeEnum.D3000);
     }
 
     /// <summary>
@@ -75,9 +78,9 @@ public class SysDictTypeService : IDynamicApiController, ITransient
     [DisplayName("添加字典类型")]
     public async Task AddDictType(AddDictTypeInput input)
     {
-        if (input.Code.ToLower().EndsWith(nameof(Enum).ToLower())) throw Oops.Oh(ErrorCodeEnum.D3006);
+        if (input.Code.ToLower().EndsWith("enum")) throw Oops.Oh(ErrorCodeEnum.D3006);
 
-        var isExist = await _sysDictTypeRep.AsQueryable().ClearFilter().AnyAsync(u => u.Code == input.Code);
+        var isExist = await _sysDictTypeRep.IsAnyAsync(u => u.Code == input.Code);
         if (isExist) throw Oops.Oh(ErrorCodeEnum.D3001);
 
         await _sysDictTypeRep.InsertAsync(input.Adapt<SysDictType>());
@@ -96,9 +99,9 @@ public class SysDictTypeService : IDynamicApiController, ITransient
         var dict = await _sysDictTypeRep.GetFirstAsync(x => x.Id == input.Id);
         if (dict == null) throw Oops.Oh(ErrorCodeEnum.D3000);
 
-        if (dict.Code.ToLower().EndsWith(nameof(Enum).ToLower()) && input.Code != dict.Code) throw Oops.Oh(ErrorCodeEnum.D3007);
+        if (dict.Code.ToLower().EndsWith("enum") && input.Code != dict.Code) throw Oops.Oh(ErrorCodeEnum.D3007);
 
-        var isExist = await _sysDictTypeRep.AsQueryable().ClearFilter().AnyAsync(u => u.Code == input.Code && u.Id != input.Id);
+        var isExist = await _sysDictTypeRep.IsAnyAsync(u => u.Code == input.Code && u.Id != input.Id);
         if (isExist) throw Oops.Oh(ErrorCodeEnum.D3001);
 
         _sysCacheService.RemoveByPrefixKey($"{CacheConst.KeyDict}{input.Code}");
@@ -150,34 +153,6 @@ public class SysDictTypeService : IDynamicApiController, ITransient
         await _sysDictTypeRep.AsUpdateable(dictType).UpdateColumns(u => new { u.Status }, true).ExecuteCommandAsync();
     }
 
-    /// <summary>
-    /// 迁移字典租户 🔖
-    /// </summary>
-    /// <param name="input"></param>
-    /// <returns></returns>
-    [UnitOfWork]
-    [DisplayName("迁移字典租户")]
-    public async Task Move(DictTypeMoveInput input)
-    {
-        var dictType = await _sysDictTypeRep.GetByIdAsync(input.Id) ?? throw Oops.Oh(ErrorCodeEnum.D3000);
-        if (dictType.TenantId == input.TenantId) throw Oops.Oh(ErrorCodeEnum.D3009);
-        if (dictType.Code.EndsWith("Enum")) throw Oops.Oh(ErrorCodeEnum.D3008);
-
-        dictType.TenantId = input.TenantId;
-
-        var list = await _sysDictTypeRep.Context.Queryable<SysDictData>().Where(u => u.DictTypeId == input.Id).ToListAsync();
-        list?.ForEach(e => e.TenantId = input.TenantId);
-
-        await _sysDictTypeRep.DeleteAsync(dictType);
-        await _sysDictTypeRep.InsertAsync(dictType);
-
-        if (list != null)
-        {
-            await _sysDictTypeRep.Context.Deleteable(list).ExecuteCommandAsync();
-            await _sysDictTypeRep.Context.Insertable(list).ExecuteCommandAsync();
-        }
-    }
-
     /// <summary>
     /// 获取所有字典集合 🔖
     /// </summary>
@@ -185,35 +160,23 @@ public class SysDictTypeService : IDynamicApiController, ITransient
     [DisplayName("获取所有字典集合")]
     public async Task<dynamic> GetAllDictList()
     {
-        var ds = await GetSysDictDataQueryable()
-            .InnerJoin<SysDictData>((u, a) => u.Id == a.DictTypeId).ClearFilter()
-            .Where((u, a) => u.Status == StatusEnum.Enable && a.Status == StatusEnum.Enable && a.IsDelete == false)
-            .Select((u, a) => new { TypeCode = u.Code, a.Label, a.Value, a.Name, a.TagType, a.StyleSetting, a.ClassSetting, a.ExtData, a.Remark, a.OrderNo, a.Status })
+        var ds = await _sysDictTypeRep.AsQueryable()
+            .InnerJoin<SysDictData>((u, w) => u.Id == w.DictTypeId).ClearFilter()
+            .Where((u, w) => !string.IsNullOrWhiteSpace(w.Value))
+            .Where((u, w) => u.SysFlag == YesNoEnum.Y || (u.SysFlag == YesNoEnum.N && w.TenantId == _userManager.TenantId))
+            .Select((u, w) => new
+            {
+                TypeCode = u.Code,
+                w.Label, w.Value,
+                w.Code, w.TagType,
+                w.StyleSetting,
+                w.ClassSetting,
+                w.ExtData,
+                w.Remark,
+                w.OrderNo,
+                Status = w.Status == StatusEnum.Enable && u.Status == StatusEnum.Enable ? StatusEnum.Enable : StatusEnum.Disable
+            })
             .ToListAsync();
         return ds.OrderBy(u => u.OrderNo).GroupBy(u => u.TypeCode).ToDictionary(u => u.Key, u => u);
     }
-
-    /// <summary>
-    /// 获取SysDictData表查询实例
-    /// </summary>
-    /// <returns></returns>
-    [NonAction]
-    public ISugarQueryable<SysDictType> GetSysDictDataQueryable()
-    {
-        var ids = GetTenantIdList();
-        return _sysDictTypeRep.AsQueryable().ClearFilter()
-            .Where(u => u.IsDelete == false).WhereIF(!_userManager.SuperAdmin, u => ids.Contains(u.TenantId.Value));
-    }
-
-    /// <summary>
-    /// 获取租户Id列表
-    /// </summary>
-    /// <returns></returns>
-    [NonAction]
-    public List<long> GetTenantIdList()
-    {
-        return SqlSugarConst.DefaultTenantId != _userManager.TenantId
-            ? new() { SqlSugarConst.DefaultTenantId, _userManager.TenantId }
-            : new() { SqlSugarConst.DefaultTenantId };
-    }
 }

+ 0 - 84
Web/src/api-services/apis/sys-dict-type-api.ts

@@ -24,7 +24,6 @@ import { AdminResultSqlSugarPagedListSysDictType } from '../models';
 import { AdminResultSysDictType } from '../models';
 import { DeleteDictTypeInput } from '../models';
 import { DictTypeInput } from '../models';
-import { DictTypeMoveInput } from '../models';
 import { PageDictTypeInput } from '../models';
 import { StatusEnum } from '../models';
 import { UpdateDictTypeInput } from '../models';
@@ -325,54 +324,6 @@ export const SysDictTypeApiAxiosParamCreator = function (configuration?: Configu
                 options: localVarRequestOptions,
             };
         },
-        /**
-         * 
-         * @summary 迁移字典租户 🔖
-         * @param {DictTypeMoveInput} [body] 
-         * @param {*} [options] Override http request option.
-         * @throws {RequiredError}
-         */
-        apiSysDictTypeMovePost: async (body?: DictTypeMoveInput, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
-            const localVarPath = `/api/sysDictType/move`;
-            // use dummy base URL string because the URL constructor only accepts absolute URLs.
-            const localVarUrlObj = new URL(localVarPath, 'https://example.com');
-            let baseOptions;
-            if (configuration) {
-                baseOptions = configuration.baseOptions;
-            }
-            const localVarRequestOptions :AxiosRequestConfig = { method: 'POST', ...baseOptions, ...options};
-            const localVarHeaderParameter = {} as any;
-            const localVarQueryParameter = {} as any;
-
-            // authentication Bearer required
-            // http bearer authentication required
-            if (configuration && configuration.accessToken) {
-                const accessToken = typeof configuration.accessToken === 'function'
-                    ? await configuration.accessToken()
-                    : await configuration.accessToken;
-                localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
-            }
-
-            localVarHeaderParameter['Content-Type'] = 'application/json-patch+json';
-
-            const query = new URLSearchParams(localVarUrlObj.search);
-            for (const key in localVarQueryParameter) {
-                query.set(key, localVarQueryParameter[key]);
-            }
-            for (const key in options.params) {
-                query.set(key, options.params[key]);
-            }
-            localVarUrlObj.search = (new URLSearchParams(query)).toString();
-            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
-            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
-            const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
-            localVarRequestOptions.data =  needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || "");
-
-            return {
-                url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
-                options: localVarRequestOptions,
-            };
-        },
         /**
          * 
          * @summary 获取字典类型分页列表 🔖
@@ -609,20 +560,6 @@ export const SysDictTypeApiFp = function(configuration?: Configuration) {
                 return axios.request(axiosRequestArgs);
             };
         },
-        /**
-         * 
-         * @summary 迁移字典租户 🔖
-         * @param {DictTypeMoveInput} [body] 
-         * @param {*} [options] Override http request option.
-         * @throws {RequiredError}
-         */
-        async apiSysDictTypeMovePost(body?: DictTypeMoveInput, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<void>>> {
-            const localVarAxiosArgs = await SysDictTypeApiAxiosParamCreator(configuration).apiSysDictTypeMovePost(body, options);
-            return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
-                const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
-                return axios.request(axiosRequestArgs);
-            };
-        },
         /**
          * 
          * @summary 获取字典类型分页列表 🔖
@@ -733,16 +670,6 @@ export const SysDictTypeApiFactory = function (configuration?: Configuration, ba
         async apiSysDictTypeListGet(options?: AxiosRequestConfig): Promise<AxiosResponse<AdminResultListSysDictType>> {
             return SysDictTypeApiFp(configuration).apiSysDictTypeListGet(options).then((request) => request(axios, basePath));
         },
-        /**
-         * 
-         * @summary 迁移字典租户 🔖
-         * @param {DictTypeMoveInput} [body] 
-         * @param {*} [options] Override http request option.
-         * @throws {RequiredError}
-         */
-        async apiSysDictTypeMovePost(body?: DictTypeMoveInput, options?: AxiosRequestConfig): Promise<AxiosResponse<void>> {
-            return SysDictTypeApiFp(configuration).apiSysDictTypeMovePost(body, options).then((request) => request(axios, basePath));
-        },
         /**
          * 
          * @summary 获取字典类型分页列表 🔖
@@ -848,17 +775,6 @@ export class SysDictTypeApi extends BaseAPI {
     public async apiSysDictTypeListGet(options?: AxiosRequestConfig) : Promise<AxiosResponse<AdminResultListSysDictType>> {
         return SysDictTypeApiFp(this.configuration).apiSysDictTypeListGet(options).then((request) => request(this.axios, this.basePath));
     }
-    /**
-     * 
-     * @summary 迁移字典租户 🔖
-     * @param {DictTypeMoveInput} [body] 
-     * @param {*} [options] Override http request option.
-     * @throws {RequiredError}
-     * @memberof SysDictTypeApi
-     */
-    public async apiSysDictTypeMovePost(body?: DictTypeMoveInput, options?: AxiosRequestConfig) : Promise<AxiosResponse<void>> {
-        return SysDictTypeApiFp(this.configuration).apiSysDictTypeMovePost(body, options).then((request) => request(this.axios, this.basePath));
-    }
     /**
      * 
      * @summary 获取字典类型分页列表 🔖

+ 0 - 6
Web/src/api-services/models/add-dict-data-input.ts

@@ -96,12 +96,6 @@ export interface AddDictDataInput {
      * @memberof AddDictDataInput
      */
     code?: string | null;
-    /**
-     * 名称
-     * @type {string}
-     * @memberof AddDictDataInput
-     */
-    name?: string | null;
     /**
      * 显示样式-标签颜色
      * @type {string}

+ 7 - 6
Web/src/api-services/models/add-dict-type-input.ts

@@ -13,6 +13,7 @@
  */
 import { StatusEnum } from './status-enum';
 import { SysDictData } from './sys-dict-data';
+import { YesNoEnum } from './yes-no-enum';
 /**
  * 
  * @export
@@ -67,12 +68,6 @@ export interface AddDictTypeInput {
      * @memberof AddDictTypeInput
      */
     isDelete?: boolean;
-    /**
-     * 租户Id
-     * @type {number}
-     * @memberof AddDictTypeInput
-     */
-    tenantId?: number | null;
     /**
      * 名称
      * @type {string}
@@ -97,6 +92,12 @@ export interface AddDictTypeInput {
      * @memberof AddDictTypeInput
      */
     remark?: string | null;
+    /**
+     * 
+     * @type {YesNoEnum}
+     * @memberof AddDictTypeInput
+     */
+    sysFlag?: YesNoEnum;
     /**
      * 
      * @type {StatusEnum}

+ 1 - 1
Web/src/api-services/models/add-user-reg-way-input.ts

@@ -95,7 +95,7 @@ export interface AddUserRegWayInput {
      * @type {AccountTypeEnum}
      * @memberof AddUserRegWayInput
      */
-    accountType: AccountTypeEnum;
+    accountType?: AccountTypeEnum;
     /**
      * 角色
      * @type {number}

+ 0 - 32
Web/src/api-services/models/dict-type-move-input.ts

@@ -1,32 +0,0 @@
-/* tslint:disable */
-/* eslint-disable */
-/**
- * Admin.NET 通用权限开发平台
- * 让 .NET 开发更简单、更通用、更流行。整合最新技术,模块插件式开发,前后端分离,开箱即用。<br/><u><b><font color='FF0000'> 👮不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!</font></b></u>
- *
- * OpenAPI spec version: 1.0.0
- * 
- *
- * NOTE: This class is auto generated by the swagger code generator program.
- * https://github.com/swagger-api/swagger-codegen.git
- * Do not edit the class manually.
- */
-/**
- * 
- * @export
- * @interface DictTypeMoveInput
- */
-export interface DictTypeMoveInput {
-    /**
-     * 主键Id
-     * @type {number}
-     * @memberof DictTypeMoveInput
-     */
-    id: number;
-    /**
-     * 租户
-     * @type {number}
-     * @memberof DictTypeMoveInput
-     */
-    tenantId: number;
-}

+ 0 - 1
Web/src/api-services/models/index.ts

@@ -189,7 +189,6 @@ export * from './delete-user-input';
 export * from './delete-wechat-user-input';
 export * from './dict-data-input';
 export * from './dict-type-input';
-export * from './dict-type-move-input';
 export * from './digit-shapes';
 export * from './enum-entity';
 export * from './enum-type-output';

+ 0 - 6
Web/src/api-services/models/page-dict-data-input.ts

@@ -79,10 +79,4 @@ export interface PageDictDataInput {
      * @memberof PageDictDataInput
      */
     label?: string | null;
-    /**
-     * 租户Id
-     * @type {number}
-     * @memberof PageDictDataInput
-     */
-    tenantId?: number;
 }

+ 0 - 6
Web/src/api-services/models/page-dict-type-input.ts

@@ -79,10 +79,4 @@ export interface PageDictTypeInput {
      * @memberof PageDictTypeInput
      */
     code?: string | null;
-    /**
-     * 租户Id
-     * @type {number}
-     * @memberof PageDictTypeInput
-     */
-    tenantId?: number;
 }

+ 0 - 6
Web/src/api-services/models/sys-dict-data.ts

@@ -96,12 +96,6 @@ export interface SysDictData {
      * @memberof SysDictData
      */
     code?: string | null;
-    /**
-     * 名称
-     * @type {string}
-     * @memberof SysDictData
-     */
-    name?: string | null;
     /**
      * 显示样式-标签颜色
      * @type {string}

+ 7 - 6
Web/src/api-services/models/sys-dict-type.ts

@@ -13,6 +13,7 @@
  */
 import { StatusEnum } from './status-enum';
 import { SysDictData } from './sys-dict-data';
+import { YesNoEnum } from './yes-no-enum';
 /**
  * 系统字典类型表
  * @export
@@ -67,12 +68,6 @@ export interface SysDictType {
      * @memberof SysDictType
      */
     isDelete?: boolean;
-    /**
-     * 租户Id
-     * @type {number}
-     * @memberof SysDictType
-     */
-    tenantId?: number | null;
     /**
      * 名称
      * @type {string}
@@ -97,6 +92,12 @@ export interface SysDictType {
      * @memberof SysDictType
      */
     remark?: string | null;
+    /**
+     * 
+     * @type {YesNoEnum}
+     * @memberof SysDictType
+     */
+    sysFlag?: YesNoEnum;
     /**
      * 
      * @type {StatusEnum}

+ 0 - 6
Web/src/api-services/models/update-dict-data-input.ts

@@ -96,12 +96,6 @@ export interface UpdateDictDataInput {
      * @memberof UpdateDictDataInput
      */
     code?: string | null;
-    /**
-     * 名称
-     * @type {string}
-     * @memberof UpdateDictDataInput
-     */
-    name?: string | null;
     /**
      * 显示样式-标签颜色
      * @type {string}

+ 7 - 6
Web/src/api-services/models/update-dict-type-input.ts

@@ -13,6 +13,7 @@
  */
 import { StatusEnum } from './status-enum';
 import { SysDictData } from './sys-dict-data';
+import { YesNoEnum } from './yes-no-enum';
 /**
  * 
  * @export
@@ -67,12 +68,6 @@ export interface UpdateDictTypeInput {
      * @memberof UpdateDictTypeInput
      */
     isDelete?: boolean;
-    /**
-     * 租户Id
-     * @type {number}
-     * @memberof UpdateDictTypeInput
-     */
-    tenantId?: number | null;
     /**
      * 名称
      * @type {string}
@@ -97,6 +92,12 @@ export interface UpdateDictTypeInput {
      * @memberof UpdateDictTypeInput
      */
     remark?: string | null;
+    /**
+     * 
+     * @type {YesNoEnum}
+     * @memberof UpdateDictTypeInput
+     */
+    sysFlag?: YesNoEnum;
     /**
      * 
      * @type {StatusEnum}

+ 1 - 1
Web/src/api-services/models/update-user-reg-way-input.ts

@@ -89,7 +89,7 @@ export interface UpdateUserRegWayInput {
      * @type {AccountTypeEnum}
      * @memberof UpdateUserRegWayInput
      */
-    accountType: AccountTypeEnum;
+    accountType?: AccountTypeEnum;
     /**
      * 角色
      * @type {number}

+ 7 - 5
Web/src/views/system/dict/component/editDictData.vue

@@ -11,17 +11,17 @@
 				<el-row :gutter="35">
 					<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
 						<el-form-item label="显示文本" prop="label" :rules="[{ required: true, message: '显示文本不能为空', trigger: 'blur' }]">
-							<el-input v-model="state.ruleForm.label" placeholder="字典值" clearable />
+							<el-input v-model="state.ruleForm.label" placeholder="字典值" :disabled="state.isSysFlag" clearable />
 						</el-form-item>
 					</el-col>
 					<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
 						<el-form-item label="字典值" prop="value" :rules="[{ required: true, message: '字典值不能为空', trigger: 'blur' }]">
-							<el-input v-model="state.ruleForm.value" placeholder="编码" clearable />
+							<el-input v-model="state.ruleForm.value" placeholder="字典值" :disabled="state.isSysFlag" clearable />
 						</el-form-item>
 					</el-col>
 					<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
-						<el-form-item label="名称" prop="name">
-							<el-input v-model="state.ruleForm.name" placeholder="名称" clearable />
+						<el-form-item label="编码" prop="code">
+							<el-input v-model="state.ruleForm.code" placeholder="编码" :disabled="state.isSysFlag" clearable />
 						</el-form-item>
 					</el-col>
 					<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
@@ -47,7 +47,7 @@
 					</el-col>
 					<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
 						<el-form-item label="状态">
-							<el-radio-group v-model="state.ruleForm.status">
+							<el-radio-group v-model="state.ruleForm.status" :disabled="state.isSysFlag">
 								<el-radio :value="1">启用</el-radio>
 								<el-radio :value="2">禁用</el-radio>
 							</el-radio-group>
@@ -94,12 +94,14 @@ const props = defineProps({
 const emits = defineEmits(['handleQuery', 'handleUpdate']);
 const ruleFormRef = ref();
 const state = reactive({
+	isSysFlag: false,
 	isShowDialog: false,
 	ruleForm: {} as UpdateDictDataInput,
 });
 
 // 打开弹窗
 const openDialog = (row: any) => {
+	state.isSysFlag = row.dictType.sysFlag !== 2;
 	state.ruleForm = JSON.parse(JSON.stringify(row));
 	if (JSON.stringify(row) == '{}') {
 		state.ruleForm.dictTypeId = props.dictTypeId;

+ 17 - 84
Web/src/views/system/dict/index.vue

@@ -5,14 +5,8 @@
 				<el-card class="full-table" shadow="hover" :body-style="{ height: 'calc(100% - 51px)' }">
 					<template #header>
 						<el-icon size="16" style="margin-right: 3px; display: inline; vertical-align: middle"><ele-Collection /></el-icon>字典
-						<NoticeBar text="枚举字典对非超管用户不可见,前端获取字典数据范围:默认租户字典 + 当前租户字典。" v-if="userStore.userInfos.accountType == 999" class="ml20" />
 					</template>
 					<el-form :model="state.queryDictTypeParams" ref="queryForm" :inline="true" @submit.native.prevent>
-						<el-form-item label="租户" v-if="userStore.userInfos.accountType == 999">
-							<el-select v-model="state.queryDictTypeParams.tenantId" placeholder="租户" clearable style="width: 100%">
-								<el-option :value="item.value" :label="`${item.label} (${item.host})`" v-for="(item, index) in state.tenantList" :key="index" />
-							</el-select>
-						</el-form-item>
 						<el-form-item label="名称">
 							<el-input v-model="state.queryDictTypeParams.name" @keyup.enter.native="handleDictTypeQuery" placeholder="字典名称" clearable />
 						</el-form-item>
@@ -44,14 +38,11 @@
 						</el-table-column>
 						<el-table-column label="操作" width="120" fixed="right" align="center" v-if="auths(['sysDictType:update', 'sysDictType:delete'])">
 							<template #default="scope">
-								<el-tooltip content="迁移">
-									<el-button icon="ele-Switch" size="small" text type="primary" @click="openMoveDictType(scope.row)" v-auth="'sysDictType:move'"> </el-button>
-								</el-tooltip>
 								<el-tooltip content="编辑">
-									<el-button icon="ele-Edit" size="small" text type="primary" @click="openEditDictType(scope.row)" v-auth="'sysDictType:update'"> </el-button>
+									<el-button icon="ele-Edit" size="small" text type="primary" :disabled="!hasPermission(scope.row)" @click="openEditDictType(scope.row)" v-auth="'sysDictType:update'"> </el-button>
 								</el-tooltip>
 								<el-tooltip content="删除">
-									<el-button icon="ele-Delete" size="small" text type="danger" @click="delDictType(scope.row)" v-auth="'sysDictType:delete'"> </el-button>
+									<el-button icon="ele-Delete" size="small" text type="danger" :disabled="!hasPermission(scope.row)" @click="delDictType(scope.row)" v-auth="'sysDictType:delete'"> </el-button>
 								</el-tooltip>
 							</template>
 						</el-table-column>
@@ -98,7 +89,7 @@
 							</template>
 						</el-table-column>
 						<el-table-column prop="value" label="字典值" header-align="center" min-width="120" show-overflow-tooltip />
-						<el-table-column prop="name" label="名称" header-align="center" min-width="120" show-overflow-tooltip />
+						<el-table-column prop="code" label="编码" header-align="center" min-width="120" show-overflow-tooltip />
 						<el-table-column prop="extData" label="拓展数据" width="90" align="center">
 							<template #default="scope">
 								<el-tag type="warning" v-if="scope.row.extData == null || scope.row.extData == ''">空</el-tag>
@@ -122,10 +113,10 @@
 									<el-button icon="ele-Edit" size="small" text type="primary" @click="openEditDictData(scope.row)" v-auth="'sysDictData:update'"> </el-button>
 								</el-tooltip>
 								<el-tooltip content="删除">
-									<el-button icon="ele-Delete" size="small" text type="danger" @click="delDictData(scope.row)" v-auth="'sysDictData:delete'"> </el-button>
+									<el-button icon="ele-Delete" size="small" text type="danger" :disabled="!hasPermission(state.selectDict)" @click="delDictData(scope.row)" v-auth="'sysDictData:delete'"> </el-button>
 								</el-tooltip>
 								<el-tooltip content="复制">
-									<el-button icon="ele-CopyDocument" size="small" text type="primary" @click="openCopyDictData(scope.row)" v-auth="'sysDictData:add'"> </el-button>
+									<el-button icon="ele-CopyDocument" size="small" text type="primary" :disabled="!hasPermission(state.selectDict)" @click="openCopyDictData(scope.row)" v-auth="'sysDictData:add'"> </el-button>
 								</el-tooltip>
 							</template>
 						</el-table-column>
@@ -144,43 +135,6 @@
 				</el-card>
 			</el-col>
 		</el-row>
-
-		<el-dialog v-model="state.showMoveDictDialog" draggable :close-on-click-modal="false" width="700px">
-			<template #header>
-				<div style="color: #fff">
-					<el-icon size="16" style="margin-right: 3px; display: inline; vertical-align: middle"> <ele-Edit /> </el-icon>
-					<span> 迁移字典租户 </span>
-				</div>
-			</template>
-			<el-form :model="state.selectDict" ref="moveDictTypeFormRef" label-width="auto">
-				<el-row :gutter="35">
-					<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
-						<el-form-item label="字典名称" prop="name" :rules="[{ required: true, message: '字典名称不能为空', trigger: 'blur' }]">
-							<el-input v-model="state.selectDict.name" :disabled="true" placeholder="字典名称" clearable />
-						</el-form-item>
-					</el-col>
-					<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
-						<el-form-item label="字典编码" prop="code" :rules="[{ required: true, message: '字典名称不能为空', trigger: 'blur' }]">
-							<el-input v-model="state.selectDict.code" :disabled="true" placeholder="字典名称" clearable />
-						</el-form-item>
-					</el-col>
-					<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
-						<el-form-item label="租户" prop="tenantId" :rules="[{ required: true, message: '租户不能为空', trigger: 'blur' }]">
-							<el-select v-model="state.selectDict.tenantId" placeholder="租户" class="w100">
-								<el-option :value="item.value" :label="`${item.label} (${item.host})`" v-for="(item, index) in state.tenantList" :key="index" />
-							</el-select>
-						</el-form-item>
-					</el-col>
-				</el-row>
-			</el-form>
-			<template #footer>
-				<span class="dialog-footer">
-					<el-button @click="() => state.showMoveDictDialog = false">取 消</el-button>
-					<el-button type="primary" @click="moveDictTypeSubmit" v-reclick="1000">确 定</el-button>
-				</span>
-			</template>
-		</el-dialog>
-
 		<EditDictType ref="editDictTypeRef" :title="state.editDictTypeTitle" @handleQuery="handleDictTypeQuery" @handleUpdate="updateDictSession" />
 		<EditDictData ref="editDictDataRef" :title="state.editDictDataTitle" @handleQuery="handleDictDataQuery" @handleUpdate="updateDictSession" />
 	</div>
@@ -191,16 +145,14 @@ import { onMounted, reactive, ref } from 'vue';
 import { getAPI } from '/@/utils/axios-utils';
 import { useUserInfo } from '/@/stores/userInfo';
 import { ElMessageBox, ElMessage } from 'element-plus';
-import { SysDictType, SysDictData, UpdateDictDataInput } from '/@/api-services/models';
-import { SysDictTypeApi, SysDictDataApi, SysTenantApi } from '/@/api-services/api';
+import {SysDictType, SysDictData, UpdateDictDataInput, AccountTypeEnum} from '/@/api-services/models';
+import { SysDictTypeApi, SysDictDataApi } from '/@/api-services/api';
 import EditDictType from '/@/views/system/dict/component/editDictType.vue';
 import EditDictData from '/@/views/system/dict/component/editDictData.vue';
 import ModifyRecord from '/@/components/table/modifyRecord.vue';
-import NoticeBar from "/@/components/noticeBar/index.vue";
 import { auths } from "/@/utils/authFunction";
 
-const userStore = useUserInfo();
-const moveDictTypeFormRef = ref();
+const userInfo = useUserInfo().userInfos;
 const editDictTypeRef = ref<InstanceType<typeof EditDictType>>();
 const editDictDataRef = ref<InstanceType<typeof EditDictData>>();
 const state = reactive({
@@ -212,7 +164,6 @@ const state = reactive({
 	dictTypeData: [] as Array<SysDictType>,
 	dictDataData: [] as Array<SysDictData>,
 	queryDictTypeParams: {
-		tenantId: undefined,
 		name: undefined,
 		code: undefined,
 	},
@@ -222,7 +173,6 @@ const state = reactive({
 		total: 0 as any,
 	},
 	queryDictDataParams: {
-		tenantId: undefined,
     label: undefined,
 		dictTypeId: 0, // 字典类型Id
 	},
@@ -237,10 +187,6 @@ const state = reactive({
 });
 
 onMounted(async () => {
-	if (userStore.userInfos.accountType == 999) {
-		state.tenantList = await getAPI(SysTenantApi).apiSysTenantListGet().then(res => res.data.result ?? []);
-		state.queryDictDataParams.tenantId = state.tenantList[0].value;
-	}
 	handleDictTypeQuery();
 });
 
@@ -257,7 +203,6 @@ const handleDictTypeQuery = async () => {
 // 查询字典值操作
 const handleDictDataQuery = async () => {
 	state.loading = true;
-	state.queryDictDataParams.tenantId = state.queryDictTypeParams.tenantId;
 	let params = Object.assign(state.queryDictDataParams, state.tableDictDataParams);
 	const res = await getAPI(SysDictDataApi).apiSysDictDataPagePost(params);
 	state.dictDataData = res.data.result?.items ?? [];
@@ -270,10 +215,11 @@ const handleDictType = (row: any, event: any, column: any) => {
 	openDictDataDialog(row);
 };
 
-// 刷新字典类型和字典值表格
-const handleAllDictQuery = () => {
-	handleDictTypeQuery().then(() => handleDictDataQuery());
-}
+// 判断是否有权限操作
+const hasPermission = (row: any) => {
+	if (row.code.toLowerCase().endsWith('enum')) return false;
+	return row.sysFlag === 2 || userInfo.accountType === AccountTypeEnum.NUMBER_999;
+};
 
 // 重置字典操作
 const resetDictTypeQuery = () => {
@@ -291,7 +237,7 @@ const resetDictDataQuery = () => {
 // 打开新增字典页面
 const openAddDictType = () => {
 	state.editDictTypeTitle = '添加字典';
-	editDictTypeRef.value?.openDialog({ status: 1, orderNo: 100, tenantId: state.queryDictTypeParams.tenantId });
+	editDictTypeRef.value?.openDialog({ status: 1, orderNo: 100 });
 };
 
 // 打开新增字典值页面
@@ -301,24 +247,9 @@ const openAddDictData = () => {
 		return;
 	}
 	state.editDictDataTitle = '添加字典值';
-	editDictDataRef.value?.openDialog({ status: 1, orderNo: 100, dictTypeId: state.queryDictDataParams.dictTypeId, tenantId: state.queryDictTypeParams.tenantId });
+	editDictDataRef.value?.openDialog({ status: 1, orderNo: 100, dictTypeId: state.queryDictDataParams.dictTypeId });
 };
 
-const moveDictTypeSubmit = async () => {
-	moveDictTypeFormRef.value.validate(async (valid: boolean) => {
-		if (!valid) return;
-		await getAPI(SysDictTypeApi).apiSysDictTypeMovePost({ id: state.selectDict.id, tenantId: state.selectDict.tenantId });
-		handleAllDictQuery();
-		state.showMoveDictDialog = false;
-	});
-}
-
-// 打开迁移字典租户
-const openMoveDictType = (row: any) => {
-	state.selectDict = row;
-	state.showMoveDictDialog = true;
-}
-
 // 打开编辑字典页面
 const openEditDictType = (row: any) => {
 	state.editDictTypeTitle = '编辑字典';
@@ -335,12 +266,14 @@ const openCopyDictData = (row: any) => {
 
 // 打开编辑字典值页面
 const openEditDictData = (row: any) => {
+	row.dictType = state.selectDict;
 	state.editDictDataTitle = '编辑字典值';
 	editDictDataRef.value?.openDialog(row);
 };
 
 // 打开字典值页面
 const openDictDataDialog = (row: any) => {
+	state.selectDict = row;
 	state.editDictTypeName = row.name;
 	state.queryDictDataParams.dictTypeId = row.id;
 	handleDictDataQuery();

+ 1 - 1
Web/src/views/system/user/component/editUser.vue

@@ -35,7 +35,7 @@
 								<el-form-item label="账号类型" prop="accountType" :rules="[{ required: true, message: '账号类型不能为空', trigger: 'blur' }]">
 									<g-sys-dict
 										v-model="state.ruleForm.accountType"
-										:on-item-filter="(data: any) => data.name != 'SuperAdmin' && (data.name == 'SysAdmin' ? AccountTypeEnum.NUMBER_999 == userInfos.accountType : true)"
+										:on-item-filter="(data: any) => data.code != 'SuperAdmin' && (data.code == 'SysAdmin' ? AccountTypeEnum.NUMBER_999 == userInfos.accountType : true)"
 										code="AccountTypeEnum"
 										render-as="select"
 									/>