Files
kunshan-bzfm-mes-backend/DOAN.Admin.WebApi/Controllers/MES/Device/DeviceRepairController.cs
2024-12-10 14:34:13 +08:00

109 lines
3.3 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 DOAN.Service.MES.dev.IService;
using DOAN.Model.MES.dev.Dto;
using DOAN.Admin.WebApi.Filters;
using DOAN.Model.MES.dev.Dto;
using DOAN.Model.MES.dev;
//创建时间2024-05-28
namespace DOAN.Admin.WebApi.Controllers
{
/// <summary>
/// 报修单
/// </summary>
[Verify]
[Route("business/DeviceRepair")]
public class DeviceRepairController : BaseController
{
/// <summary>
/// 报修单接口
/// </summary>
private readonly IDeviceRepairService _DeviceRepairService;
public DeviceRepairController(IDeviceRepairService DeviceRepairService)
{
_DeviceRepairService = DeviceRepairService;
}
/// <summary>
/// 查询报修单列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
[HttpPost("list")]
public IActionResult QueryDeviceRepair([FromBody] DeviceRepairQueryDto parm)
{
var response = _DeviceRepairService.GetList(parm);
return SUCCESS(response);
}
/// <summary>
/// 查询报修单详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
[HttpGet("{Id}")]
[ActionPermissionFilter(Permission = "deviceManagement:devicerepair:query")]
public IActionResult GetDeviceRepair(string Id)
{
var response = _DeviceRepairService.GetInfo(Id);
var info = response.Adapt<DeviceRepair>();
return SUCCESS(info);
}
/// <summary>
/// 添加报修单
/// </summary>
/// <returns></returns>
[HttpPost]
[ActionPermissionFilter(Permission = "deviceManagement:devicerepair:add")]
[Log(Title = "报修单", BusinessType = BusinessType.INSERT)]
public IActionResult AddDeviceRepair([FromBody] DeviceRepairDto parm)
{
var modal = parm.Adapt<DeviceRepair>().ToCreate(HttpContext);
var response = _DeviceRepairService.AddDeviceRepair(modal);
return SUCCESS(response);
}
/// <summary>
/// 更新报修单
/// </summary>
/// <returns></returns>
[HttpPut]
[ActionPermissionFilter(Permission = "deviceManagement:devicerepair:edit")]
[Log(Title = "报修单", BusinessType = BusinessType.UPDATE)]
public IActionResult UpdateDeviceRepair([FromBody] DeviceRepairDto parm)
{
var modal = parm.Adapt<DeviceRepair>().ToUpdate(HttpContext);
var response = _DeviceRepairService.UpdateDeviceRepair(modal);
return ToResponse(response);
}
/// <summary>
/// 删除报修单
/// </summary>
/// <returns></returns>
[HttpDelete("{ids}")]
[ActionPermissionFilter(Permission = "deviceManagement:devicerepair:delete")]
[Log(Title = "报修单", BusinessType = BusinessType.DELETE)]
public IActionResult DeleteDeviceRepair(string ids)
{
string[] idsArr = ids.Split(',');
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
var response = _DeviceRepairService.Delete(idsArr);
return ToResponse(response);
}
}
}