refactor 简单优化

- 使用DepartmentDto替换DepartmentEntity
- 命名使用rider配置规范
This commit is contained in:
2025-06-23 14:58:10 +08:00
parent 4d8b7b5f16
commit e2f43cb01b
8 changed files with 33 additions and 15 deletions

View File

@@ -4,14 +4,14 @@ namespace Dlhis.Basic.Device;
public static class PermissionAnalyzeConstants
{
private const string _verb = "PermissionAnalyze";
public const string User = nameof(AssignTypeEnumType.User) + _verb;
public const string Group = nameof(AssignTypeEnumType.Group) + _verb;
public const string Department = nameof(AssignTypeEnumType.Department) + _verb;
public const string Tenant = nameof(AssignTypeEnumType.Tenant) + _verb;
private const string Verb = "PermissionAnalyze";
public const string User = nameof(AssignTypeEnumType.User) + Verb;
public const string Group = nameof(AssignTypeEnumType.Group) + Verb;
public const string Department = nameof(AssignTypeEnumType.Department) + Verb;
public const string Tenant = nameof(AssignTypeEnumType.Tenant) + Verb;
public static string GetTypeName(AssignTypeEnumType assignTypeEnumType)
{
return assignTypeEnumType + _verb;
return assignTypeEnumType + Verb;
}
}

View File

@@ -1,6 +1,7 @@
using Dlhis.Basic.Device.Dtos;
using Dlhis.Basic.Device.Request;
using Dlhis.Basic.Device.Response;
using Dlhis.Basic.Organization.Dto;
using Dlhis.Entity.Basic.Entity;
using Dlhis.Entity.Basic.Enums;
using Dlhis.Entity.Device.Entities;
@@ -306,7 +307,7 @@ public class DeviceGroupService : IDeviceGroupService
.GroupBy(x => x.Factory)
.ToDictionary(x => x.Key, x => x.Select(p => p.DepartmentNo).Distinct().ToList());
var departments = await _dbContext.Queryable<DepartmentEntity>().ToListAsync();
var departments = await _dbContext.Queryable<DepartmentEntity>().Select<DepartmentDto>().ToListAsync();
var gainfoByDeptWhere = LinqExpressionExtensions.False<GainfoEntity>();
foreach ((string factory, List<string> departmentNos) in tenantDepartmentNos)

View File

@@ -113,7 +113,7 @@ public class DevicePermissionAnalyzeService : IDevicePermissionAnalyzeService
var deviceRelationships = await _dbContext.Queryable<DeviceGroupRelationshipEntity>()
.Where(x => x.IsDeleted == false)
.ToListAsync();
var departments = await _dbContext.Queryable<DepartmentEntity>().ToListAsync();
var departments = await _dbContext.Queryable<DepartmentEntity>().Select<DepartmentDto>().ToListAsync();
var result = new ConcurrentDictionary<string, List<TenantAssignTypeDeviceCode>>();
@@ -163,7 +163,7 @@ public class DevicePermissionAnalyzeService : IDevicePermissionAnalyzeService
List<DevicePermissionDto> devicePermissions,
List<DeviceGroupEntity> deviceGroups,
List<DeviceGroupRelationshipEntity> deviceGroupRelationships,
List<DepartmentEntity> departments)
List<DepartmentDto> departments)
{
var deviceDtos = new List<TenantAssignTypeDeviceCode>();

View File

@@ -1,6 +1,7 @@
using Dlhis.Basic.Device.Dtos;
using Dlhis.Basic.Device.Request;
using Dlhis.Basic.Device.Response;
using Dlhis.Basic.Organization.Dto;
using Dlhis.Basic.Organization.Services;
using Dlhis.Entity.Basic.Entity;
using Dlhis.Entity.Basic.Enums;
@@ -350,7 +351,7 @@ public class DevicePermissionService : IDevicePermissionService
.SingleAsync();
device.ThrowIfNull("设备不存在");
var departments = await _dbContext.Queryable<DepartmentEntity>().ToListAsync();
var departments = await _dbContext.Queryable<DepartmentEntity>().Select<DepartmentDto>().ToListAsync();
//当前设备的分组
var groups = await _dbContext.Queryable<DeviceGroupRelationshipEntity>()

View File

@@ -1,3 +1,4 @@
using Dlhis.Basic.Organization.Dto;
using Dlhis.Entity.Basic.Entity;
using Dlhis.Entity.Device.Enums;
@@ -18,7 +19,7 @@ public class DepartmentPermissionAnalyzeService : BasePermissionAnalyzeService
var factory = data[0];
var departmentNo = data[1];
var departments = await DbContext.Queryable<DepartmentEntity>().ToListAsync();
var departments = await DbContext.Queryable<DepartmentEntity>().Select<DepartmentDto>().ToListAsync();
var departmentNos = RecursionHelper.HandlerDepartmentNextCodes(departmentNo, departments);
return await DbContext.Queryable<GainfoEntity>()