fix 移除无用api

This commit is contained in:
2024-07-05 13:30:54 +08:00
parent 8c4aaee32a
commit 24f7598d8d
4 changed files with 0 additions and 89 deletions

View File

@@ -49,16 +49,6 @@ public class DevicePermissionsController : ControllerBase
await _devicePermissionService.AssignToUniqueAsync(request);
}
[AllowAnonymous]
[HttpPost("assignment-generate")]
[Transactional]
[IgnoreTenant]
public async Task GeneratePermissionsAsync(GeneratePermissionIdRequest request)
{
await _devicePermissionService.GeneratePermissionsAsync(request.Id);
}
/// <summary>
/// 当前类型的权限分配
/// </summary>

View File

@@ -23,8 +23,6 @@ public interface IDevicePermissionService : IScopeDependency
/// <returns></returns>
Task AssignToUniqueAsync(DevicePermissionsAssignToDeviceRequest request);
Task GeneratePermissionsAsync(long id);
/// <summary>
/// 获取分配的权限
/// </summary>

View File

@@ -130,51 +130,6 @@ public class DevicePermissionService : IDevicePermissionService
}, null);
}
public async Task GeneratePermissionsAsync(long id)
{
var assignment = await _dbContext.Queryable<DevicePermissionAssignmentEntity>().SingleAsync(x => x.Id == id);
if (assignment == null) return;
if (assignment.IsHandler) return;
try
{
var request = assignment.Assignment.ToObject<DevicePermissionSaveRequest>();
await GenerateDeviceTasksAsync(async () =>
{
//删除当前匹配的基地权限
var p = await _dbContext.Queryable<DevicePermissionEntity>()
.Where(x => x.AssignType == request.AssignType)
.Where(x => x.AssignValue == request.AssignValue)
.Where(x => x.UniqueType == request.UniqueType)
.Where(x => x.TenantId == request.TenantId)
.ToListAsync();
await _dbContext.DeleteReallyAsync(p);
//保存配置的权限
if (request.Codes.IsPresent())
{
var devicePermissions = request.Codes.Select(code => new DevicePermissionEntity
{
AssignType = request.AssignType,
AssignValue = request.AssignValue,
UniqueType = request.UniqueType,
UniqueValue = code,
TenantId = request.TenantId
}).ToList();
await _dbContext.InsertAsync(devicePermissions);
}
}, null);
}
finally
{
assignment.IsHandler = true;
await _dbContext.UpdateAsync(assignment);
}
}
public async Task<List<Guid>> GetAssignmentsAsync(DeviceGetAssignmentsRequest request)
{
return await _dbContext.Queryable<DevicePermissionEntity>()

View File

@@ -1,32 +0,0 @@
using Kurisu.AspNetCore.DataAccess.Entity;
using Kurisu.AspNetCore.DataAccess.SqlSugar;
using SqlSugar;
namespace Dlhis.Entity.Basic.Entity;
/// <summary>
/// 设备权限分配
/// </summary>
[SugarTable(TableName = "DevicePermissionAssignment", TableDescription = "设备权限分配")]
public class DevicePermissionAssignmentEntity : SugarBaseEntity, ITenantId
{
/// <summary>
/// 分配json
/// </summary>
[SugarColumn(IsNullable = false, ColumnDataType = "varchar(1000)", ColumnDescription = "分配json")]
public string Assignment { get; set; }
/// <summary>
/// 是否处理
/// </summary>
[SugarColumn(ColumnDataType = "bit(1)", ColumnDescription = "是否处理")]
public bool IsHandler { get; set; }
/// <summary>
/// 处理结果
/// </summary>
[SugarColumn(ColumnDescription = "处理结果")]
public string Result { get; set; }
public string TenantId { get; set; }
}