昨天
This commit is contained in:
82
ZR.Admin.WebApi/Controllers/mes/md/MdDeviceController.cs
Normal file
82
ZR.Admin.WebApi/Controllers/mes/md/MdDeviceController.cs
Normal file
@@ -0,0 +1,82 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using ZR.Admin.WebApi.Extensions;
|
||||
using ZR.Model.mes.md;
|
||||
using ZR.Service.mes.md;
|
||||
using ZR.Service.mes.md.IService;
|
||||
namespace ZR.Admin.WebApi.Controllers.mes.md
|
||||
{
|
||||
|
||||
[Route("mes/md/device")]
|
||||
public class MdDeviceController : BaseController
|
||||
{
|
||||
IMdDeviceService deviceService;
|
||||
public MdDeviceController(IMdDeviceService deviceService)
|
||||
{
|
||||
this.deviceService = deviceService;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="pageNum"></param>
|
||||
/// <param name="pageSize"></param>
|
||||
/// <param name="deviceCode"></param>
|
||||
/// <param name="deviceName"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("list")]
|
||||
public IActionResult List(int pageNum, int pageSize, string deviceCode = "", string deviceName = "")
|
||||
{
|
||||
(int, List<MdDevice>) data = deviceService.GetAll(deviceCode, deviceName, pageNum, pageSize);
|
||||
return ToResponse(new ApiResult(200, "success", data));
|
||||
}
|
||||
|
||||
|
||||
[HttpPost("addDevice")]
|
||||
public IActionResult AddDevice([FromBody]MdDevice device)
|
||||
{
|
||||
if (device != null)
|
||||
device.ToCreate(HttpContext);
|
||||
int result = deviceService.AddDevice(device);
|
||||
return SUCCESS(result);
|
||||
}
|
||||
|
||||
[HttpPost("updateDevice")]
|
||||
public IActionResult UpdateDevice([FromBody]MdDevice device)
|
||||
{
|
||||
if (device != null)
|
||||
{
|
||||
device.ToUpdate(HttpContext);
|
||||
}
|
||||
|
||||
int result = deviceService.UpdateDevice(device);
|
||||
return SUCCESS(result);
|
||||
}
|
||||
|
||||
|
||||
[HttpPost("delDevice")]
|
||||
public IActionResult deleteWorkshop([FromBody] List<int> ids)
|
||||
{
|
||||
if (ids != null)
|
||||
{
|
||||
int result = deviceService.deleteDevice(ids.ToArray());
|
||||
return ToResponse(result);
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user