110 lines
3.3 KiB
C#
110 lines
3.3 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
||
using ZR.Service.MES.dev.IService;
|
||
using ZR.Model.MES.dev.Dto;
|
||
using ZR.Admin.WebApi.Filters;
|
||
using ZR.Model.MES.dev.Dto;
|
||
using ZR.Model.MES.dev;
|
||
using ZR.Admin.WebApi.Extensions;
|
||
|
||
//创建时间:2024-05-28
|
||
namespace ZR.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);
|
||
}
|
||
|
||
|
||
|
||
|
||
}
|
||
} |