fix 移除type问题
This commit is contained in:
@@ -27,6 +27,7 @@ public class DeviceGetAssignmentsRequest : IValidatableObject
|
||||
/// <summary>
|
||||
/// 设备类型
|
||||
/// </summary>
|
||||
[EnumDataType(typeof(DeviceTypeEnumType))]
|
||||
public DeviceTypeEnumType Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
@@ -58,4 +59,11 @@ public class DeviceGetAssignmentUniquesRequest
|
||||
///
|
||||
/// </summary>
|
||||
public Guid UniqueValue { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 设备类型
|
||||
/// </summary>
|
||||
[EnumDataType(typeof(DeviceTypeEnumType))]
|
||||
public DeviceTypeEnumType Type { get; set; }
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Dlhis.Entity.Sys.Enums;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
|
||||
namespace Dlhis.Basic.Device.Request;
|
||||
|
||||
@@ -26,6 +26,10 @@ public class DevicePermissionsAssignToDeviceRequest : IValidatableObject
|
||||
/// </summary>
|
||||
public List<string> Values { get; set; }
|
||||
|
||||
|
||||
[EnumDataType(typeof(DeviceTypeEnumType))]
|
||||
public DeviceTypeEnumType Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 只删除权限
|
||||
/// </summary>
|
||||
|
||||
@@ -44,6 +44,7 @@ public class DevicePermissionService : IDevicePermissionService
|
||||
.Where(x => x.AssignType == request.AssignType)
|
||||
.Where(x => x.AssignValue == request.AssignValue)
|
||||
.Where(x => x.UniqueType == request.UniqueType)
|
||||
.Where(x => x.Type == request.Type)
|
||||
.WhereIF(values.Any(), x => values.Contains(x.UniqueValue))
|
||||
.Where(x => x.TenantId == tenantId)
|
||||
.ToListAsync();
|
||||
@@ -59,6 +60,7 @@ public class DevicePermissionService : IDevicePermissionService
|
||||
AssignValue = request.AssignValue,
|
||||
UniqueType = request.UniqueType,
|
||||
UniqueValue = code,
|
||||
Type = request.Type,
|
||||
TenantId = tenantId
|
||||
}).ToList();
|
||||
|
||||
@@ -101,6 +103,7 @@ public class DevicePermissionService : IDevicePermissionService
|
||||
.Where(x => x.UniqueType == request.UniqueType)
|
||||
.Where(x => x.UniqueValue == request.UniqueValue)
|
||||
.Where(x => x.AssignType == request.AssignType)
|
||||
.Where(x => x.Type == request.Type)
|
||||
.Where(x => x.TenantId == tenantId)
|
||||
.ToListAsync();
|
||||
|
||||
@@ -122,7 +125,8 @@ public class DevicePermissionService : IDevicePermissionService
|
||||
UniqueValue = request.UniqueValue,
|
||||
AssignType = request.AssignType,
|
||||
AssignValue = v,
|
||||
TenantId = tenantId
|
||||
TenantId = tenantId,
|
||||
Type = request.Type
|
||||
}).ToList();
|
||||
|
||||
await _dbContext.InsertAsync(devicePermissions);
|
||||
@@ -137,6 +141,7 @@ public class DevicePermissionService : IDevicePermissionService
|
||||
.Where(x => x.AssignType == request.AssignType)
|
||||
.Where(x => x.AssignValue == request.AssignValue)
|
||||
.Where(x => x.UniqueType == request.UniqueType)
|
||||
.Where(x => x.Type == request.Type)
|
||||
.Select(x => x.UniqueValue)
|
||||
.ToListAsync();
|
||||
}
|
||||
@@ -148,6 +153,7 @@ public class DevicePermissionService : IDevicePermissionService
|
||||
.Where(x => x.UniqueType == request.UniqueType)
|
||||
.Where(x => x.UniqueValue == request.UniqueValue)
|
||||
.Where(x => x.AssignType == AssignTypeEnumType.User)
|
||||
.Where(x => x.Type == request.Type)
|
||||
.Select(x => x.AssignValue)
|
||||
.ToListAsync();
|
||||
|
||||
@@ -429,7 +435,6 @@ public class DevicePermissionService : IDevicePermissionService
|
||||
Priority = 0,
|
||||
Version = 0,
|
||||
TenantId = x.TenantId,
|
||||
|
||||
}).ToList();
|
||||
|
||||
await _dbContext.InsertAsync(tasks);
|
||||
|
||||
@@ -35,12 +35,14 @@ public class DeviceService : IDeviceService
|
||||
var role = _currentUser.GetRole();
|
||||
var isAll = role is "tenant-admin" or "admin";
|
||||
var tenantIds = _currentUser.GetUserClaim("tenants").Split(",").ToList();
|
||||
var tenantId = _currentUser.GetStringTenantId();
|
||||
|
||||
var page = await _dbContext.Queryable<DeviceEntity>()
|
||||
.LeftJoin<DeviceTemplateEntity>((d, dt) => d.TemplateCode == dt.Code)
|
||||
.LeftJoin<DeviceRegistryEntity>((d, dt, dr) => d.UniqueNo == dr.DeviceUniqueNo)
|
||||
.LeftJoin<BusinessPlaceEntity>((d, dt, dr, bp) => dr.BusinessPlaceCode == bp.Code)
|
||||
.WhereIF(isAll, d => tenantIds.Contains(d.TenantId))
|
||||
.WhereIF(!isAll, d => tenantId == d.TenantId)
|
||||
.WhereIF(request.Type.HasValue, (d, dt) => d.Type == request.Type)
|
||||
.WhereIF(request.Enable.HasValue, (d, dt) => d.Enable == request.Enable)
|
||||
.WhereIF(request.Search.IsPresent(), d => d.UniqueNo == request.Search || d.DeployPlace.Contains(request.Search))
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Dlhis.Entity.Sys.Enums;
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Dlhis.Entity.Sys.Enums;
|
||||
using Kurisu.AspNetCore.DataAccess.Entity;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar;
|
||||
using SqlSugar;
|
||||
@@ -36,6 +37,12 @@ public class DevicePermissionEntity : SugarBaseEntity, ITenantId, ISoftDeleted
|
||||
[SugarColumn(ColumnDescription = "类型值")]
|
||||
public Guid UniqueValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备数据类型
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDataType = "varchar(50)", ColumnDescription = "设备数据类型", SqlParameterDbType = typeof(EnumToStringConvert))]
|
||||
public DeviceTypeEnumType Type { get; set; }
|
||||
|
||||
|
||||
public string TenantId { get; set; }
|
||||
|
||||
|
||||
@@ -133,6 +133,7 @@ public class SyncBusinessTripJob : BaseJob
|
||||
UniqueType = DeviceAssignmentTypeEnumType.Group,
|
||||
UniqueValue = tripGroup.Code,
|
||||
TenantId = factoryTripInfos.Key,
|
||||
Type = tripGroup.Type,
|
||||
IsDeleted = false
|
||||
});
|
||||
}
|
||||
@@ -144,6 +145,7 @@ public class SyncBusinessTripJob : BaseJob
|
||||
.Where(x => x.AssignValue == gainfo.No)
|
||||
.Where(x => x.UniqueType == DeviceAssignmentTypeEnumType.Group)
|
||||
.Where(x => x.UniqueValue == tripGroup.Code)
|
||||
.Where(x => x.Type == tripGroup.Type)
|
||||
.Where(x => x.TenantId == factoryTripInfos.Key)
|
||||
.ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user