qianhao.xu b59a522e19 提交
2024-05-21 18:58:03 +08:00

109 lines
3.5 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Microsoft.AspNetCore.Mvc;
using ZR.Model.Dto;
using ZR.Admin.WebApi.Filters;
using ZR.Service.MES.dev.IService;
using ZR.Model.MES.dev;
//创建时间2024-05-21
namespace ZR.Admin.WebApi.Controllers
{
/// <summary>
/// 设备检查项
/// </summary>
[Verify]
[Route("mes/deviceManagement/DeviceInspect")]
public class DeviceInspectController : BaseController
{
/// <summary>
/// 设备检查项接口
/// </summary>
private readonly IDeviceInspectService _DeviceInspectService;
public DeviceInspectController(IDeviceInspectService DeviceInspectService)
{
_DeviceInspectService = DeviceInspectService;
}
/// <summary>
/// 查询设备检查项列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
[HttpGet("list")]
[ActionPermissionFilter(Permission = "deviceManagement:deviceinspect:list")]
public IActionResult QueryDeviceInspect([FromQuery] DeviceInspectQueryDto parm)
{
var response = _DeviceInspectService.GetList(parm);
return SUCCESS(response);
}
/// <summary>
/// 查询设备检查项详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
[HttpGet("{Id}")]
[ActionPermissionFilter(Permission = "deviceManagement:deviceinspect:query")]
public IActionResult GetDeviceInspect(int Id)
{
var response = _DeviceInspectService.GetInfo(Id);
var info = response.Adapt<DeviceInspect>();
return SUCCESS(info);
}
/// <summary>
/// 添加设备检查项
/// </summary>
/// <returns></returns>
[HttpPost]
[ActionPermissionFilter(Permission = "deviceManagement:deviceinspect:add")]
[Log(Title = "设备检查项", BusinessType = BusinessType.INSERT)]
public IActionResult AddDeviceInspect([FromBody] DeviceInspectDto parm)
{
var modal = parm.Adapt<DeviceInspect>().ToCreate(HttpContext);
var response = _DeviceInspectService.AddDeviceInspect(modal);
return SUCCESS(response);
}
/// <summary>
/// 更新设备检查项
/// </summary>
/// <returns></returns>
[HttpPut]
[ActionPermissionFilter(Permission = "deviceManagement:deviceinspect:edit")]
[Log(Title = "设备检查项", BusinessType = BusinessType.UPDATE)]
public IActionResult UpdateDeviceInspect([FromBody] DeviceInspectDto parm)
{
var modal = parm.Adapt<DeviceInspect>().ToUpdate(HttpContext);
var response = _DeviceInspectService.UpdateDeviceInspect(modal);
return ToResponse(response);
}
/// <summary>
/// 删除设备检查项
/// </summary>
/// <returns></returns>
[HttpDelete("{ids}")]
[ActionPermissionFilter(Permission = "deviceManagement:deviceinspect:delete")]
[Log(Title = "设备检查项", BusinessType = BusinessType.DELETE)]
public IActionResult DeleteDeviceInspect(string ids)
{
int[] idsArr = Tools.SpitIntArrary(ids);
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
var response = _DeviceInspectService.Delete(idsArr);
return ToResponse(response);
}
}
}