109 lines
3.4 KiB
C#
109 lines
3.4 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
||
using ZR.Model.Dto;
|
||
using ZR.Service.Business.IBusinessService;
|
||
using ZR.Admin.WebApi.Filters;
|
||
using ZR.Model.MES.dev.Dto;
|
||
using ZR.Model.MES.dev;
|
||
|
||
//创建时间:2024-05-20
|
||
namespace ZR.Admin.WebApi.Controllers
|
||
{
|
||
/// <summary>
|
||
/// 设备台账
|
||
/// </summary>
|
||
[Verify]
|
||
[Route("business/DeviceAccount")]
|
||
public class DeviceAccountController : BaseController
|
||
{
|
||
/// <summary>
|
||
/// 设备台账接口
|
||
/// </summary>
|
||
private readonly IDeviceAccountService _DeviceAccountService;
|
||
|
||
public DeviceAccountController(IDeviceAccountService DeviceAccountService)
|
||
{
|
||
_DeviceAccountService = DeviceAccountService;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 查询设备台账列表
|
||
/// </summary>
|
||
/// <param name="parm"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("list")]
|
||
[ActionPermissionFilter(Permission = "business:deviceaccount:list")]
|
||
public IActionResult QueryDeviceAccount([FromQuery] DeviceAccountQueryDto parm)
|
||
{
|
||
var response = _DeviceAccountService.GetList(parm);
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 查询设备台账详情
|
||
/// </summary>
|
||
/// <param name="Id"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("{Id}")]
|
||
[ActionPermissionFilter(Permission = "business:deviceaccount:query")]
|
||
public IActionResult GetDeviceAccount(int Id)
|
||
{
|
||
var response = _DeviceAccountService.GetInfo(Id);
|
||
|
||
var info = response.Adapt<DeviceAccount>();
|
||
return SUCCESS(info);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 添加设备台账
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost]
|
||
[ActionPermissionFilter(Permission = "business:deviceaccount:add")]
|
||
[Log(Title = "设备台账", BusinessType = BusinessType.INSERT)]
|
||
public IActionResult AddDeviceAccount([FromBody] DeviceAccountDto parm)
|
||
{
|
||
var modal = parm.Adapt<DeviceAccount>().ToCreate(HttpContext);
|
||
|
||
var response = _DeviceAccountService.AddDeviceAccount(modal);
|
||
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 更新设备台账
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPut]
|
||
[ActionPermissionFilter(Permission = "business:deviceaccount:edit")]
|
||
[Log(Title = "设备台账", BusinessType = BusinessType.UPDATE)]
|
||
public IActionResult UpdateDeviceAccount([FromBody] DeviceAccountDto parm)
|
||
{
|
||
var modal = parm.Adapt<DeviceAccount>().ToUpdate(HttpContext);
|
||
var response = _DeviceAccountService.UpdateDeviceAccount(modal);
|
||
|
||
return ToResponse(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 删除设备台账
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpDelete("{ids}")]
|
||
[ActionPermissionFilter(Permission = "business:deviceaccount:delete")]
|
||
[Log(Title = "设备台账", BusinessType = BusinessType.DELETE)]
|
||
public IActionResult DeleteDeviceAccount(string ids)
|
||
{
|
||
int[] idsArr = Tools.SpitIntArrary(ids);
|
||
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
|
||
|
||
var response = _DeviceAccountService.Delete(idsArr);
|
||
|
||
return ToResponse(response);
|
||
}
|
||
|
||
|
||
|
||
|
||
}
|
||
} |