106 lines
3.5 KiB
C#
106 lines
3.5 KiB
C#
using DOAN.Model;
|
||
using DOAN.Model.Dto;
|
||
using DOAN.Service.Business.IBusinessService;
|
||
using Microsoft.AspNetCore.Mvc;
|
||
|
||
//创建时间:2025-09-02
|
||
namespace DOAN.Admin.WebApi.Controllers
|
||
{
|
||
/// <summary>
|
||
/// 追溯配置,涵盖通用,项目,零件不同配置
|
||
/// </summary>
|
||
[Route("business/TraceConfig")]
|
||
public class TraceConfigController : BaseController
|
||
{
|
||
/// <summary>
|
||
/// 追溯配置,涵盖通用,项目,零件不同配置接口
|
||
/// </summary>
|
||
private readonly ITraceConfigService _TraceConfigService;
|
||
|
||
public TraceConfigController(ITraceConfigService TraceConfigService)
|
||
{
|
||
_TraceConfigService = TraceConfigService;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 查询追溯配置,涵盖通用,项目,零件不同配置列表
|
||
/// </summary>
|
||
/// <param name="parm"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("list")]
|
||
[AllowAnonymous]
|
||
public IActionResult QueryTraceConfig([FromQuery] TraceConfigQueryDto parm)
|
||
{
|
||
var response = _TraceConfigService.GetList(parm);
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 查询追溯配置,涵盖通用,项目,零件不同配置详情
|
||
/// </summary>
|
||
/// <param name="Id"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("{Id}")]
|
||
[AllowAnonymous]
|
||
public IActionResult GetTraceConfig(int Id)
|
||
{
|
||
var response = _TraceConfigService.GetInfo(Id);
|
||
|
||
var info = response.Adapt<TraceConfig>();
|
||
return SUCCESS(info);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 添加追溯配置,涵盖通用,项目,零件不同配置
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost]
|
||
[AllowAnonymous]
|
||
[Log(Title = "追溯配置,涵盖通用,项目,零件不同配置", BusinessType = BusinessType.INSERT)]
|
||
public IActionResult AddTraceConfig([FromBody] TraceConfigDto parm)
|
||
{
|
||
var modal = parm.Adapt<TraceConfig>().ToCreate(HttpContext);
|
||
|
||
var response = _TraceConfigService.AddTraceConfig(modal);
|
||
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 更新追溯配置,涵盖通用,项目,零件不同配置
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPut]
|
||
[AllowAnonymous]
|
||
[Log(Title = "追溯配置,涵盖通用,项目,零件不同配置", BusinessType = BusinessType.UPDATE)]
|
||
public IActionResult UpdateTraceConfig([FromBody] TraceConfigDto parm)
|
||
{
|
||
var modal = parm.Adapt<TraceConfig>().ToUpdate(HttpContext);
|
||
var response = _TraceConfigService.UpdateTraceConfig(modal);
|
||
|
||
return ToResponse(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 删除追溯配置,涵盖通用,项目,零件不同配置
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpDelete("{ids}")]
|
||
[AllowAnonymous]
|
||
[Log(Title = "追溯配置,涵盖通用,项目,零件不同配置", BusinessType = BusinessType.DELETE)]
|
||
public IActionResult DeleteTraceConfig(string ids)
|
||
{
|
||
int[] idsArr = Tools.SpitIntArrary(ids);
|
||
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
|
||
|
||
var response = _TraceConfigService.Delete(idsArr);
|
||
|
||
return ToResponse(response);
|
||
}
|
||
|
||
|
||
|
||
|
||
}
|
||
} |