You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using CommonModel;
|
|
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using ZhongLianInterface;
|
|
|
|
|
using ZhongLianModel;
|
|
|
|
|
using ZhongLianService;
|
|
|
|
|
|
|
|
|
|
namespace ZhongLianAPI.Controllers
|
|
|
|
|
{
|
|
|
|
|
[Route("api/[controller]")]
|
|
|
|
|
[ApiController]
|
|
|
|
|
public class MaintenanceController : ControllerBase
|
|
|
|
|
{
|
|
|
|
|
public MaintenanceController(IMaintenanceService maintenanceService) {
|
|
|
|
|
MaintenanceService = maintenanceService;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private readonly IMaintenanceService MaintenanceService;
|
|
|
|
|
|
|
|
|
|
[HttpPost("insert")]
|
|
|
|
|
public async Task<ActionResult> Insert(MaintenanceDO maintenance)
|
|
|
|
|
{
|
|
|
|
|
var _CheckMSG = MaintenanceService.InsertCheck(maintenance);
|
|
|
|
|
if (string.IsNullOrEmpty(_CheckMSG))
|
|
|
|
|
{
|
|
|
|
|
return Ok(await MaintenanceService.InserDO(maintenance));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return BadRequest(_CheckMSG);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost("update")]
|
|
|
|
|
public async Task<ActionResult> Update(MaintenanceDO maintenance)
|
|
|
|
|
{
|
|
|
|
|
var _CheckMSG = MaintenanceService.UpdateCheck(maintenance);
|
|
|
|
|
if (string.IsNullOrEmpty(_CheckMSG))
|
|
|
|
|
{
|
|
|
|
|
return Ok(await MaintenanceService.UpdateDO(maintenance));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return BadRequest(_CheckMSG);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost("delete")]
|
|
|
|
|
public async Task<ActionResult> Delete(string[] ids)
|
|
|
|
|
{
|
|
|
|
|
await MaintenanceService.DeleteDO(ids);
|
|
|
|
|
return Ok();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost("list")]
|
|
|
|
|
public async Task<ActionResult> List(PageYearSearch<MaintenanceDO> pageSearch)
|
|
|
|
|
{
|
|
|
|
|
return Ok(await MaintenanceService.ListDO(pageSearch));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpGet("get")]
|
|
|
|
|
public async Task<ActionResult> Get([FromQuery] string id)
|
|
|
|
|
{
|
|
|
|
|
return Ok(await MaintenanceService.GetDO(id));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|