using Microsoft.AspNetCore.Mvc;
using DOAN.Model.Dto;
using DOAN.Service.MES.dev.IService;
using DOAN.Model.MES.dev.Dto;
using DOAN.Admin.WebApi.Filters;
using DOAN.Model.MES.dev;
//创建时间:2024-05-22
namespace DOAN.Admin.WebApi.Controllers
{
///
/// 设备检查项表单配置表
///
[Verify]
[Route("mes/deviceManagement/DeviceFormConfig")]
public class DeviceFormConfigController : BaseController
{
///
/// 设备检查项表单配置表接口
///
private readonly IDeviceFormConfigService _DeviceFormConfigService;
public DeviceFormConfigController(IDeviceFormConfigService DeviceFormConfigService)
{
_DeviceFormConfigService = DeviceFormConfigService;
}
///
/// 查询设备检查项表单配置表列表
///
///
///
[HttpGet("list")]
[ActionPermissionFilter(Permission = "business:deviceformconfig:list")]
public IActionResult QueryDeviceFormConfig([FromQuery] DeviceFormConfigQueryDto parm)
{
var response = _DeviceFormConfigService.GetList(parm);
return SUCCESS(response);
}
///
/// 查询设备检查项表单配置表详情
///
///
///
[HttpGet("{Id}")]
[ActionPermissionFilter(Permission = "business:deviceformconfig:query")]
public IActionResult GetDeviceFormConfig(string Id)
{
var response = _DeviceFormConfigService.GetInfo(Id);
var info = response.Adapt();
return SUCCESS(info);
}
///
/// 添加设备检查项表单配置表
///
///
[HttpPost]
[ActionPermissionFilter(Permission = "business:deviceformconfig:add")]
[Log(Title = "设备检查项表单配置表", BusinessType = BusinessType.INSERT)]
public IActionResult AddDeviceFormConfig([FromBody] DeviceFormConfigDto parm)
{
var modal = parm.Adapt().ToCreate(HttpContext);
var response = _DeviceFormConfigService.AddDeviceFormConfig(modal);
return SUCCESS(response);
}
///
/// 更新设备检查项表单配置表
///
///
[HttpPut]
[ActionPermissionFilter(Permission = "business:deviceformconfig:edit")]
[Log(Title = "设备检查项表单配置表", BusinessType = BusinessType.UPDATE)]
public IActionResult UpdateDeviceFormConfig([FromBody] DeviceFormConfigDto parm)
{
var modal = parm.Adapt().ToUpdate(HttpContext);
var response = _DeviceFormConfigService.UpdateDeviceFormConfig(modal);
return ToResponse(response);
}
///
/// 删除设备检查项表单配置表
///
///
[HttpDelete("{ids}")]
[ActionPermissionFilter(Permission = "business:deviceformconfig:delete")]
[Log(Title = "设备检查项表单配置表", BusinessType = BusinessType.DELETE)]
public IActionResult DeleteDeviceFormConfig(string ids)
{
string[] strIds = ids.Split(",", (char)StringSplitOptions.RemoveEmptyEntries);
if (strIds.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
var response = _DeviceFormConfigService.Delete(strIds);
return ToResponse(response);
}
}
}