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

109 lines
3.7 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-27
namespace DOAN.Admin.WebApi.Controllers
{
/// <summary>
/// 维修记录
/// </summary>
[Verify]
[Route("mes/deviceManagement/DeviceMaintenanceRecord")]
public class DeviceMaintenanceRecordController : BaseController
{
/// <summary>
/// 维修记录接口
/// </summary>
private readonly IDeviceMaintenanceRecordService _DeviceMaintenanceRecordService;
public DeviceMaintenanceRecordController(IDeviceMaintenanceRecordService DeviceMaintenanceRecordService)
{
_DeviceMaintenanceRecordService = DeviceMaintenanceRecordService;
}
/// <summary>
/// 查询维修记录列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
[HttpGet("list")]
// [ActionPermissionFilter(Permission = "business:devicemaintenancerecord:list")]
public IActionResult QueryDeviceMaintenanceRecord([FromQuery] DeviceMaintenanceRecordQueryDto parm)
{
var response = _DeviceMaintenanceRecordService.GetList(parm);
return SUCCESS(response);
}
/// <summary>
/// 查询维修记录详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
[HttpGet("{Id}")]
[ActionPermissionFilter(Permission = "business:devicemaintenancerecord:query")]
public IActionResult GetDeviceMaintenanceRecord(string Id)
{
var response = _DeviceMaintenanceRecordService.GetInfo(Id);
var info = response.Adapt<DeviceMaintenanceRecord>();
return SUCCESS(info);
}
/// <summary>
/// 添加维修记录
/// </summary>
/// <returns></returns>
[HttpPost]
[ActionPermissionFilter(Permission = "business:devicemaintenancerecord:add")]
[Log(Title = "维修记录", BusinessType = BusinessType.INSERT)]
public IActionResult AddDeviceMaintenanceRecord([FromBody] DeviceMaintenanceRecordDto parm)
{
var modal = parm.Adapt<DeviceMaintenanceRecord>().ToCreate(HttpContext);
var response = _DeviceMaintenanceRecordService.AddDeviceMaintenanceRecord(modal);
return SUCCESS(response);
}
/// <summary>
/// 更新维修记录
/// </summary>
/// <returns></returns>
[HttpPut]
[ActionPermissionFilter(Permission = "business:devicemaintenancerecord:edit")]
[Log(Title = "维修记录", BusinessType = BusinessType.UPDATE)]
public IActionResult UpdateDeviceMaintenanceRecord([FromBody] DeviceMaintenanceRecordDto parm)
{
var modal = parm.Adapt<DeviceMaintenanceRecord>().ToUpdate(HttpContext);
var response = _DeviceMaintenanceRecordService.UpdateDeviceMaintenanceRecord(modal);
return ToResponse(response);
}
/// <summary>
/// 删除维修记录
/// </summary>
/// <returns></returns>
[HttpDelete("{ids}")]
[ActionPermissionFilter(Permission = "business:devicemaintenancerecord:delete")]
[Log(Title = "维修记录", BusinessType = BusinessType.DELETE)]
public IActionResult DeleteDeviceMaintenanceRecord(string ids)
{
string[] idsArr = ids.Split(',');
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
var response = _DeviceMaintenanceRecordService.Delete(idsArr);
return ToResponse(response);
}
}
}