108 lines
3.5 KiB
C#
Raw Normal View History

2024-10-10 17:36:33 +08:00
using DOAN.Admin.WebApi.Filters;
2024-10-12 16:30:09 +08:00
using DOAN.Model.MES.quality.IQC;
using DOAN.Model.MES.quality.IQC.Dto;
using DOAN.Service.MES.quality.FQC.IService;
2024-10-10 17:36:33 +08:00
using Microsoft.AspNetCore.Mvc;
//创建时间2024-10-10
2024-10-12 16:30:09 +08:00
namespace DOAN.WebApi.Controllers.MES.quality.FQC
2024-10-10 17:36:33 +08:00
{
/// <summary>
/// 缺陷类别
/// </summary>
//[Verify]
2024-10-12 16:30:09 +08:00
[Route("mes/qualityManagement/QcDefectConfig")]
2024-10-10 17:36:33 +08:00
public class QcDefectConfigController : BaseController
{
/// <summary>
/// 缺陷类别接口
/// </summary>
private readonly IQcDefectConfigService _QcDefectConfigService;
public QcDefectConfigController(IQcDefectConfigService QcDefectConfigService)
{
_QcDefectConfigService = QcDefectConfigService;
}
/// <summary>
/// 查询缺陷类别列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
[HttpGet("list")]
[ActionPermissionFilter(Permission = "business:qcdefectconfig:list")]
public IActionResult QueryQcDefectConfig([FromQuery] QcDefectConfigQueryDto parm)
{
var response = _QcDefectConfigService.GetList(parm);
return SUCCESS(response);
}
/// <summary>
/// 查询缺陷类别详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
[HttpGet("{Id}")]
[ActionPermissionFilter(Permission = "business:qcdefectconfig:query")]
public IActionResult GetQcDefectConfig(int Id)
{
var response = _QcDefectConfigService.GetInfo(Id);
2024-10-12 16:30:09 +08:00
2024-10-10 17:36:33 +08:00
var info = response.Adapt<QcDefectConfig>();
return SUCCESS(info);
}
/// <summary>
/// 添加缺陷类别
/// </summary>
/// <returns></returns>
[HttpPost]
[ActionPermissionFilter(Permission = "business:qcdefectconfig:add")]
[Log(Title = "缺陷类别", BusinessType = BusinessType.INSERT)]
public IActionResult AddQcDefectConfig([FromBody] QcDefectConfigDto parm)
{
var modal = parm.Adapt<QcDefectConfig>().ToCreate(HttpContext);
var response = _QcDefectConfigService.AddQcDefectConfig(modal);
return SUCCESS(response);
}
/// <summary>
/// 更新缺陷类别
/// </summary>
/// <returns></returns>
[HttpPut]
[ActionPermissionFilter(Permission = "business:qcdefectconfig:edit")]
[Log(Title = "缺陷类别", BusinessType = BusinessType.UPDATE)]
public IActionResult UpdateQcDefectConfig([FromBody] QcDefectConfigDto parm)
{
var modal = parm.Adapt<QcDefectConfig>().ToUpdate(HttpContext);
var response = _QcDefectConfigService.UpdateQcDefectConfig(modal);
return ToResponse(response);
}
/// <summary>
/// 删除缺陷类别
/// </summary>
/// <returns></returns>
[HttpDelete("{ids}")]
[ActionPermissionFilter(Permission = "business:qcdefectconfig:delete")]
[Log(Title = "缺陷类别", BusinessType = BusinessType.DELETE)]
public IActionResult DeleteQcDefectConfig(string ids)
{
int[] idsArr = Tools.SpitIntArrary(ids);
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
var response = _QcDefectConfigService.Delete(idsArr);
return ToResponse(response);
}
}
}