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.
108 lines
3.0 KiB
C#
108 lines
3.0 KiB
C#
using CommonModel;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using ZhongLianInterface;
|
|
using ZhongLianModel;
|
|
using ZhongLianService;
|
|
|
|
namespace ZhongLianAPI.Controllers
|
|
{
|
|
/// <summary>
|
|
/// 安装单接口
|
|
/// </summary>
|
|
[Route("api/[controller]")]
|
|
[ApiController]
|
|
public class InstallController : ControllerBase
|
|
{
|
|
public InstallController(IInstallService installService)
|
|
{
|
|
InstallService = installService;
|
|
}
|
|
|
|
private readonly IInstallService InstallService;
|
|
|
|
/// <summary>
|
|
/// 创建安装单
|
|
/// </summary>
|
|
/// <param name="install">安装单</param>
|
|
/// <returns></returns>
|
|
[HttpPost("insert")]
|
|
public async Task<ActionResult> Insert(InstallDO install)
|
|
{
|
|
var _CheckMSG = InstallService.InsertCheck(install);
|
|
if (string.IsNullOrEmpty(_CheckMSG))
|
|
{
|
|
return Ok(await InstallService.Insert(install));
|
|
}
|
|
else
|
|
{
|
|
return BadRequest(_CheckMSG);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 更新安装单
|
|
/// </summary>
|
|
/// <param name="install">安装单</param>
|
|
/// <returns></returns>
|
|
[HttpPost("update")]
|
|
public async Task<ActionResult> Update(InstallDO install)
|
|
{
|
|
var _CheckMSG = InstallService.UpdateCheck(install);
|
|
if (string.IsNullOrEmpty(_CheckMSG))
|
|
{
|
|
return Ok(await InstallService.Update(install));
|
|
}
|
|
else
|
|
{
|
|
return BadRequest(_CheckMSG);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除安装单
|
|
/// </summary>
|
|
/// <param name="ids">编号数组</param>
|
|
/// <returns></returns>
|
|
[HttpPost("delete")]
|
|
public async Task<ActionResult> Delete(string[] ids)
|
|
{
|
|
await InstallService.Delete(ids);
|
|
return Ok();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取安装单列表
|
|
/// </summary>
|
|
/// <param name="pageSearch">查询条件</param>
|
|
/// <returns></returns>
|
|
[HttpPost("list")]
|
|
public async Task<ActionResult> List(PageYearSearch<InstallDO> pageSearch)
|
|
{
|
|
return Ok(await InstallService.List(pageSearch));
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取安装单详情
|
|
/// </summary>
|
|
/// <param name="id">编号</param>
|
|
/// <returns></returns>
|
|
[HttpGet("get")]
|
|
public async Task<ActionResult> Get([FromQuery] string id)
|
|
{
|
|
return Ok(await InstallService.Get(id));
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取安装单步骤
|
|
/// </summary>
|
|
/// <param name="installId">编号</param>
|
|
/// <returns></returns>
|
|
[HttpGet("getsteps")]
|
|
public async Task<ActionResult> GetSteps([FromQuery] string installId)
|
|
{
|
|
return Ok(await InstallService.GetStepsDO(installId));
|
|
}
|
|
}
|
|
}
|