109 lines
3.4 KiB
C#
109 lines
3.4 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
||
using DOAN.Model.Dto;
|
||
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/BaseCustom")]
|
||
public class BaseCustomController : BaseController
|
||
{
|
||
/// <summary>
|
||
/// 客户信息接口
|
||
/// </summary>
|
||
private readonly IBaseCustomService _BaseCustomService;
|
||
|
||
public BaseCustomController(IBaseCustomService BaseCustomService)
|
||
{
|
||
_BaseCustomService = BaseCustomService;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 查询客户信息列表
|
||
/// </summary>
|
||
/// <param name="parm"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("list")]
|
||
[ActionPermissionFilter(Permission = "baseManagement:basecustom:list")]
|
||
public IActionResult QueryBaseCustom([FromQuery] BaseCustomQueryDto parm)
|
||
{
|
||
var response = _BaseCustomService.GetList(parm);
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 查询客户信息详情
|
||
/// </summary>
|
||
/// <param name="Id"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("{Id}")]
|
||
[ActionPermissionFilter(Permission = "baseManagement:basecustom:query")]
|
||
public IActionResult GetBaseCustom(int Id)
|
||
{
|
||
var response = _BaseCustomService.GetInfo(Id);
|
||
|
||
var info = response.Adapt<BaseCustom>();
|
||
return SUCCESS(info);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 添加客户信息
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost]
|
||
[ActionPermissionFilter(Permission = "baseManagement:basecustom:add")]
|
||
[Log(Title = "客户信息", BusinessType = BusinessType.INSERT)]
|
||
public IActionResult AddBaseCustom([FromBody] BaseCustomDto parm)
|
||
{
|
||
var modal = parm.Adapt<BaseCustom>().ToCreate(HttpContext);
|
||
|
||
var response = _BaseCustomService.AddBaseCustom(modal);
|
||
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 更新客户信息
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPut]
|
||
[ActionPermissionFilter(Permission = "baseManagement:basecustom:edit")]
|
||
[Log(Title = "客户信息", BusinessType = BusinessType.UPDATE)]
|
||
public IActionResult UpdateBaseCustom([FromBody] BaseCustomDto parm)
|
||
{
|
||
var modal = parm.Adapt<BaseCustom>().ToUpdate(HttpContext);
|
||
var response = _BaseCustomService.UpdateBaseCustom(modal);
|
||
|
||
return ToResponse(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 删除客户信息
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpDelete("{ids}")]
|
||
[ActionPermissionFilter(Permission = "baseManagement:basecustom:delete")]
|
||
[Log(Title = "客户信息", BusinessType = BusinessType.DELETE)]
|
||
public IActionResult DeleteBaseCustom(string ids)
|
||
{
|
||
int[] idsArr = Tools.SpitIntArrary(ids);
|
||
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
|
||
|
||
var response = _BaseCustomService.Delete(idsArr);
|
||
|
||
return ToResponse(response);
|
||
}
|
||
|
||
|
||
|
||
|
||
}
|
||
} |