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.

70 lines
2.0 KiB
C#

2 months ago
using DS.Module.Core;
using DS.Module.Core.Data;
using DS.WMS.Core.Code.Entity;
using DS.WMS.Core.Code.Interface;
using Microsoft.AspNetCore.Mvc;
namespace DS.WMS.MainApi.Controllers
{
/// <summary>
/// 发票代码API
/// </summary>
public class CodeInvoiceController : ApiController
{
private readonly ICodeInvoiceService _invokeService;
/// <summary>
/// 构造函数
/// </summary>
/// <param name="invokeService"></param>
public CodeInvoiceController(ICodeInvoiceService invokeService)
{
_invokeService = invokeService;
}
/// <summary>
/// 列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost, Route("GetList")]
public async Task<DataResult<List<CodeInvoice>>> GetListAsync([FromBody] PageRequest request)
{
return await _invokeService.GetListAsync(request);
}
/// <summary>
/// 获取详情
/// </summary>
/// <param name="id">发票代码ID</param>
/// <returns></returns>
[HttpGet, Route("Edit")]
public async Task<DataResult<CodeInvoice>> GetAsync([FromQuery] long id)
{
return await _invokeService.GetAsync(id);
}
/// <summary>
/// 新增/修改
/// </summary>
/// <param name="ci">发票代码</param>
/// <returns></returns>
[HttpPost, Route("Edit")]
public async Task<DataResult<CodeInvoice>> EditAsync([FromBody] CodeInvoice ci)
{
return await _invokeService.EditAsync(ci);
}
/// <summary>
/// 删除
/// </summary>
/// <param name="idModel"></param>
/// <returns></returns>
[HttpPost, Route("Delete")]
public async Task<DataResult> DeleteAsync([FromBody] IdModel idModel)
{
return await _invokeService.DeleteAsync(idModel.Ids);
}
}
}