add assignDeviceCodes-all
This commit is contained in:
@@ -4,6 +4,7 @@ using Dlhis.Basic.Organization.Response;
|
||||
using Dlhis.Basic.Organization.Services;
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
@@ -44,6 +45,18 @@ public class GainfoPermissionsController : ControllerBase
|
||||
return await _gainfoPermissions.GetAssignDeviceCodesAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户所有设备权限(all)
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("assignDeviceCodes-all")]
|
||||
[IgnoreTenant]
|
||||
public async Task<Pagination<GainfoDevicePermissionResponse>> GetAssignDeviceCodesAllAsync([FromQuery] DeviceAssUserCodeRequest request)
|
||||
{
|
||||
return await _gainfoPermissions.GetAssignDeviceCodesAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 权限重置
|
||||
/// </summary>
|
||||
|
||||
@@ -15,3 +15,15 @@ public class DeviceAssRequest : PageDto
|
||||
[EnumDataType(typeof(DeviceTypeEnumType))]
|
||||
public DeviceTypeEnumType? DeviceType { get; set; }
|
||||
}
|
||||
|
||||
public class DeviceAssUserCodeRequest : PageDto
|
||||
{
|
||||
[Required(ErrorMessage = "工号不能为空")]
|
||||
public string UserCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备类型
|
||||
/// </summary>
|
||||
[EnumDataType(typeof(DeviceTypeEnumType))]
|
||||
public DeviceTypeEnumType? DeviceType { get; set; }
|
||||
}
|
||||
@@ -12,6 +12,9 @@ public interface IGainfoPermissionService : IScopeDependency
|
||||
Task<List<GetDevicesUnderGroupByUserNoResponse>> GetDevicesUnderGroupByUserNoAsync(string userNo, Guid deviceGroupCode);
|
||||
|
||||
Task<Pagination<GainfoDevicePermissionResponse>> GetAssignDeviceCodesAsync(DeviceAssRequest request);
|
||||
|
||||
Task<Pagination<GainfoDevicePermissionResponse>> GetAssignDeviceCodesAsync(DeviceAssUserCodeRequest request);
|
||||
|
||||
|
||||
Task<DevicePermissionAssignResponse> ResetPermissionsAsync(string userNo, DeviceTaskEnumType type, List<Guid> deviceCodes, string source);
|
||||
}
|
||||
@@ -77,6 +77,22 @@ public class GainfoPermissionService : IGainfoPermissionService
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<Pagination<GainfoDevicePermissionResponse>> GetAssignDeviceCodesAsync(DeviceAssUserCodeRequest request)
|
||||
{
|
||||
var gainfo = await _dbContext.Queryable<GainfoEntity>().Where(x => x.Code == request.UserCode).SingleAsync();
|
||||
gainfo.ThrowIfNull($"{request.UserCode}人员不存在");
|
||||
return await GetAssignDeviceCodesAsync(new DeviceAssRequest
|
||||
{
|
||||
PageIndex = request.PageSize,
|
||||
PageSize = request.PageSize,
|
||||
Search = request.Search,
|
||||
UserNo = gainfo.No,
|
||||
DeviceType = request.DeviceType
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public async Task<Pagination<GainfoDevicePermissionResponse>> GetAssignDeviceCodesAsync(DeviceAssRequest request)
|
||||
{
|
||||
var result = await _devicePermissionAnalyzeService.GetUserAssignDeviceCodesWithTypeInTenantAsync(new List<string> { request.UserNo });
|
||||
@@ -147,6 +163,8 @@ public class GainfoPermissionService : IGainfoPermissionService
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// public async Task<Pagination<GainfoDevicePermissionResponse>> GetAllUserAssignDeviceCodesAsync()
|
||||
// {
|
||||
|
||||
Reference in New Issue
Block a user