74 lines
2.1 KiB
C#
74 lines
2.1 KiB
C#
using Dlhis.Basic.Device.Request;
|
|
using Dlhis.Basic.Device.Response;
|
|
using Dlhis.Basic.Device.Services;
|
|
using Kurisu.AspNetCore.DataAccess.Dto;
|
|
using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace Dlhis.Basic.Device.Controllers;
|
|
|
|
[Authorize]
|
|
[Route("api/[controller]")]
|
|
[ApiController]
|
|
public class DevicePermissionManuallyController : ControllerBase
|
|
{
|
|
private readonly IDevicePermissionManuallyService _devicePermissionService;
|
|
|
|
public DevicePermissionManuallyController(IDevicePermissionManuallyService devicePermissionService)
|
|
{
|
|
_devicePermissionService = devicePermissionService;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 数据分页
|
|
/// </summary>
|
|
/// <param name="request"></param>
|
|
/// <returns></returns>
|
|
[HttpGet("page")]
|
|
[DataPermission]
|
|
public async Task<Pagination<DevicePermissionManuallyResponse>> GetPageAsync([FromQuery] DevicePermissionManuallyRequest request)
|
|
{
|
|
return await _devicePermissionService.GetPageAsync(request);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加权限
|
|
/// </summary>
|
|
/// <param name="request"></param>
|
|
[HttpPost("add")]
|
|
[Transactional]
|
|
public async Task AddAsync(DevicePermissionManuallyAddRequest request)
|
|
{
|
|
await _devicePermissionService.AddAsync(request);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除权限
|
|
/// </summary>
|
|
/// <param name="id"></param>
|
|
[HttpGet("{id:long}")]
|
|
[Transactional]
|
|
public async Task DeleteAsync(long id)
|
|
{
|
|
await _devicePermissionService.DeleteAsync(id);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除权限
|
|
/// </summary>
|
|
/// <param name="ids"></param>
|
|
[HttpPost("batchDelete")]
|
|
[Transactional]
|
|
public async Task DeleteAsync(List<long> ids)
|
|
{
|
|
await _devicePermissionService.DeleteAsync(ids);
|
|
}
|
|
|
|
[HttpPost("{factory}/clear/{userCode}")]
|
|
[IgnoreTenant]
|
|
public async Task ClearAllDevicePermissions(string factory, string userCode)
|
|
{
|
|
await _devicePermissionService.ClearAllDevicePermissions(factory, userCode);
|
|
}
|
|
} |