fix 增加设备type类型
This commit is contained in:
@@ -1,17 +1,27 @@
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Dlhis.Entity.Sys.Enums;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar;
|
||||
using SqlSugar;
|
||||
using SqlSugar.DbConvert;
|
||||
|
||||
namespace Dlhis.Entity.Sys.Entities;
|
||||
|
||||
[SugarTable(TableName = "DataPermissions")]
|
||||
public class DataPermissionEntity : SugarBaseEntity
|
||||
{
|
||||
[SugarColumn(IsNullable = false, ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert))]
|
||||
public AssignTypeEnumType AssignType { get; set; }
|
||||
|
||||
[SugarColumn(IsNullable = false)]
|
||||
public string AssignValue { get; set; }
|
||||
|
||||
[SugarColumn(IsNullable = false, ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert))]
|
||||
public DeviceAssignmentTypeEnumType UniqueType { get; set; }
|
||||
|
||||
[SugarColumn(IsNullable = false)]
|
||||
public Guid UniqueValue { get; set; }
|
||||
|
||||
|
||||
[SugarColumn(IsNullable = false, ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert))]
|
||||
public DeviceTypeEnumType DeviceType { get; set; }
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Dlhis.Entity.Sys.Enums;
|
||||
using Dlhis.Sys.DataPermission.Request;
|
||||
using Dlhis.Sys.DataPermission.Services;
|
||||
@@ -30,8 +31,10 @@ public class DataPermissionsController : ControllerBase
|
||||
|
||||
|
||||
[HttpGet("assignments")]
|
||||
public async Task<List<Guid>> GetAssignmentsAsync(string assignValue, [EnumDataType(typeof(DeviceAssignmentTypeEnumType))] DeviceAssignmentTypeEnumType uniqueType)
|
||||
public async Task<List<Guid>> GetAssignmentsAsync(string assignValue,
|
||||
[EnumDataType(typeof(DeviceAssignmentTypeEnumType))] DeviceAssignmentTypeEnumType uniqueType,
|
||||
DeviceTypeEnumType type)
|
||||
{
|
||||
return await _dataPermissionService.GetAssignmentsAsync(assignValue, uniqueType);
|
||||
return await _dataPermissionService.GetAssignmentsAsync(assignValue, uniqueType, type);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Dlhis.Entity.Sys.Enums;
|
||||
|
||||
namespace Dlhis.Sys.DataPermission.Request;
|
||||
@@ -13,6 +14,9 @@ public class DataPermissionSaveRequest : IValidatableObject
|
||||
|
||||
public List<Guid> Codes { get; set; } = new();
|
||||
|
||||
[EnumDataType(typeof(DeviceTypeEnumType))]
|
||||
public DeviceTypeEnumType Type { get; set; }
|
||||
|
||||
|
||||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
||||
{
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Dlhis.Entity.Sys.Enums;
|
||||
using Dlhis.Sys.DataPermission.Request;
|
||||
|
||||
@@ -7,5 +8,5 @@ public interface IDataPermissionService : IScopeDependency
|
||||
{
|
||||
Task SaveAsync(DataPermissionSaveRequest request);
|
||||
|
||||
Task<List<Guid>> GetAssignmentsAsync(string assignValue, DeviceAssignmentTypeEnumType uniqueType);
|
||||
Task<List<Guid>> GetAssignmentsAsync(string assignValue, DeviceAssignmentTypeEnumType uniqueType, DeviceTypeEnumType type);
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Dlhis.Entity.Sys.Entities;
|
||||
using Dlhis.Entity.Sys.Enums;
|
||||
using Dlhis.Sys.DataPermission.Request;
|
||||
@@ -21,6 +22,7 @@ public class DataPermissionService : IDataPermissionService
|
||||
.Where(x => x.AssignValue == request.AssignValue)
|
||||
.Where(x => x.AssignType == AssignTypeEnumType.User)
|
||||
.Where(x => x.UniqueType == request.UniqueType)
|
||||
.Where(x => x.DeviceType == request.Type)
|
||||
.ToListAsync();
|
||||
|
||||
await _dbContext.DeleteReallyAsync(data);
|
||||
@@ -34,12 +36,13 @@ public class DataPermissionService : IDataPermissionService
|
||||
}).ToList());
|
||||
}
|
||||
|
||||
public async Task<List<Guid>> GetAssignmentsAsync(string assignValue, DeviceAssignmentTypeEnumType uniqueType)
|
||||
public async Task<List<Guid>> GetAssignmentsAsync(string assignValue, DeviceAssignmentTypeEnumType uniqueType, DeviceTypeEnumType type)
|
||||
{
|
||||
return await _dbContext.Queryable<DataPermissionEntity>()
|
||||
.Where(x => x.AssignValue == assignValue)
|
||||
.Where(x => x.AssignType == AssignTypeEnumType.User)
|
||||
.Where(x => x.UniqueType == uniqueType)
|
||||
.Where(x => x.DeviceType == type)
|
||||
.Select(x => x.UniqueValue)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user