108 lines
3.4 KiB
C#
108 lines
3.4 KiB
C#
|
|
using Microsoft.AspNetCore.Mvc;
|
|||
|
|
using DOAN.Model.MES.base_.Dto;
|
|||
|
|
using DOAN.Model.MES.base_;
|
|||
|
|
using DOAN.Service.MES.base_.IService;
|
|||
|
|
using DOAN.Admin.WebApi.Filters;
|
|||
|
|
|
|||
|
|
//创建时间:2024-07-08
|
|||
|
|
namespace DOAN.Admin.WebApi.Controllers
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 供应商信息
|
|||
|
|
/// </summary>
|
|||
|
|
[Verify]
|
|||
|
|
[Route("mes/baseManagement/BaseSupplier")]
|
|||
|
|
public class BaseSupplierController : BaseController
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 供应商信息接口
|
|||
|
|
/// </summary>
|
|||
|
|
private readonly IBaseSupplierService _BaseSupplierService;
|
|||
|
|
|
|||
|
|
public BaseSupplierController(IBaseSupplierService BaseSupplierService)
|
|||
|
|
{
|
|||
|
|
_BaseSupplierService = BaseSupplierService;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 查询供应商信息列表
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="parm"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
[HttpGet("list")]
|
|||
|
|
[ActionPermissionFilter(Permission = "baseManagement:basesupplier:list")]
|
|||
|
|
public IActionResult QueryBaseSupplier([FromQuery] BaseSupplierQueryDto parm)
|
|||
|
|
{
|
|||
|
|
var response = _BaseSupplierService.GetList(parm);
|
|||
|
|
return SUCCESS(response);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 查询供应商信息详情
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="Id"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
[HttpGet("{Id}")]
|
|||
|
|
[ActionPermissionFilter(Permission = "baseManagement:basesupplier:query")]
|
|||
|
|
public IActionResult GetBaseSupplier(int Id)
|
|||
|
|
{
|
|||
|
|
var response = _BaseSupplierService.GetInfo(Id);
|
|||
|
|
|
|||
|
|
var info = response.Adapt<BaseSupplier>();
|
|||
|
|
return SUCCESS(info);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 添加供应商信息
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
[HttpPost]
|
|||
|
|
[ActionPermissionFilter(Permission = "baseManagement:basesupplier:add")]
|
|||
|
|
[Log(Title = "供应商信息", BusinessType = BusinessType.INSERT)]
|
|||
|
|
public IActionResult AddBaseSupplier([FromBody] BaseSupplierDto parm)
|
|||
|
|
{
|
|||
|
|
var modal = parm.Adapt<BaseSupplier>().ToCreate(HttpContext);
|
|||
|
|
|
|||
|
|
var response = _BaseSupplierService.AddBaseSupplier(modal);
|
|||
|
|
|
|||
|
|
return SUCCESS(response);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 更新供应商信息
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
[HttpPut]
|
|||
|
|
[ActionPermissionFilter(Permission = "baseManagement:basesupplier:edit")]
|
|||
|
|
[Log(Title = "供应商信息", BusinessType = BusinessType.UPDATE)]
|
|||
|
|
public IActionResult UpdateBaseSupplier([FromBody] BaseSupplierDto parm)
|
|||
|
|
{
|
|||
|
|
var modal = parm.Adapt<BaseSupplier>().ToUpdate(HttpContext);
|
|||
|
|
var response = _BaseSupplierService.UpdateBaseSupplier(modal);
|
|||
|
|
|
|||
|
|
return ToResponse(response);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 删除供应商信息
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
[HttpDelete("{ids}")]
|
|||
|
|
[ActionPermissionFilter(Permission = "business:basesupplier:delete")]
|
|||
|
|
[Log(Title = "供应商信息", BusinessType = BusinessType.DELETE)]
|
|||
|
|
public IActionResult DeleteBaseSupplier(string ids)
|
|||
|
|
{
|
|||
|
|
int[] idsArr = Tools.SpitIntArrary(ids);
|
|||
|
|
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
|
|||
|
|
|
|||
|
|
var response = _BaseSupplierService.Delete(idsArr);
|
|||
|
|
|
|||
|
|
return ToResponse(response);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|