102 lines
3.1 KiB
C#
102 lines
3.1 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
||
using DOAN.Model.Bydlms.Dto;
|
||
using DOAN.Model.Bydlms;
|
||
using DOAN.Service.Bydlms.IBydlmsService;
|
||
using DOAN.Admin.WebApi.Filters;
|
||
|
||
//创建时间:2025-02-19
|
||
namespace DOAN.Admin.WebApi.Controllers.Bydlms
|
||
{
|
||
/// <summary>
|
||
/// 设备状态
|
||
/// </summary>
|
||
[Verify]
|
||
[Route("bydlms/BydDevice")]
|
||
public class BydDeviceController : BaseController
|
||
{
|
||
/// <summary>
|
||
/// 设备状态接口
|
||
/// </summary>
|
||
private readonly IBydDeviceService _BydDeviceService;
|
||
|
||
public BydDeviceController(IBydDeviceService BydDeviceService)
|
||
{
|
||
_BydDeviceService = BydDeviceService;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 查询设备状态列表
|
||
/// </summary>
|
||
/// <param name="parm"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("list")]
|
||
[ActionPermissionFilter(Permission = "byddevice:list")]
|
||
public IActionResult QueryBydDevice([FromQuery] BydDeviceQueryDto parm)
|
||
{
|
||
var response = _BydDeviceService.GetList(parm);
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 查询设备状态详情
|
||
/// </summary>
|
||
/// <param name="Id"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("{Id}")]
|
||
[ActionPermissionFilter(Permission = "byddevice:query")]
|
||
public IActionResult GetBydDevice(string Id)
|
||
{
|
||
var response = _BydDeviceService.GetInfo(Id);
|
||
|
||
var info = response.Adapt<BydDeviceDto>();
|
||
return SUCCESS(info);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 添加设备状态
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost]
|
||
[ActionPermissionFilter(Permission = "byddevice:add")]
|
||
[Log(Title = "设备状态", BusinessType = BusinessType.INSERT)]
|
||
public IActionResult AddBydDevice([FromBody] BydDeviceDto parm)
|
||
{
|
||
var modal = parm.Adapt<BydDevice>().ToCreate(HttpContext);
|
||
|
||
var response = _BydDeviceService.AddBydDevice(modal);
|
||
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 更新设备状态
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPut]
|
||
[ActionPermissionFilter(Permission = "byddevice:edit")]
|
||
[Log(Title = "设备状态", BusinessType = BusinessType.UPDATE)]
|
||
public IActionResult UpdateBydDevice([FromBody] BydDeviceDto parm)
|
||
{
|
||
var modal = parm.Adapt<BydDevice>().ToUpdate(HttpContext);
|
||
var response = _BydDeviceService.UpdateBydDevice(modal);
|
||
|
||
return ToResponse(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 删除设备状态
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost("delete/{ids}")]
|
||
[ActionPermissionFilter(Permission = "byddevice:delete")]
|
||
[Log(Title = "设备状态", BusinessType = BusinessType.DELETE)]
|
||
public IActionResult DeleteBydDevice([FromRoute]string ids)
|
||
{
|
||
var idArr = Tools.SplitAndConvert<string>(ids);
|
||
|
||
return ToResponse(_BydDeviceService.Delete(idArr));
|
||
}
|
||
|
||
}
|
||
} |