zhuangpei-mesbackend/MDM/Controllers/Recipe/PfRecipeTemplateController.cs
2025-12-29 16:58:36 +08:00

106 lines
3.5 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Microsoft.AspNetCore.Mvc;
using DOAN.Model.MES.recipe;
using DOAN.Model.MES.recipe.Dto;
using DOAN.Service.MES.recipe.IService;
using Infrastructure.Controllers;
using Infrastructure.Enums;
using DOAN.ServiceCore.Middleware;
using Mapster;
using Infrastructure;
using Infrastructure.Attribute;
//创建时间2025-12-05
namespace DOAN.WebApi.Controllers.MES.recipe
{
/// <summary>
/// 配方模板表
/// </summary>
[Route("mes/PfRecipeTemplate")]
public class PfRecipeTemplateController : BaseController
{
/// <summary>
/// 配方模板表接口
/// </summary>
private readonly IPfRecipeTemplateService _PfRecipeTemplateService;
public PfRecipeTemplateController(IPfRecipeTemplateService PfRecipeTemplateService)
{
_PfRecipeTemplateService = PfRecipeTemplateService;
}
/// <summary>
/// 查询配方模板表列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
[HttpGet("list")]
[ActionPermissionFilter(Permission = "pfrecipetemplate:list")]
public IActionResult QueryPfRecipeTemplate([FromQuery] PfRecipeTemplateQueryDto parm)
{
var response = _PfRecipeTemplateService.GetList(parm);
return SUCCESS(response);
}
/// <summary>
/// 查询配方模板表详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
[HttpGet("{Id}")]
[ActionPermissionFilter(Permission = "pfrecipetemplate:query")]
public IActionResult GetPfRecipeTemplate(int Id)
{
var response = _PfRecipeTemplateService.GetInfo(Id);
var info = response.Adapt<PfRecipeTemplateDto>();
return SUCCESS(info);
}
/// <summary>
/// 添加配方模板表
/// </summary>
/// <returns></returns>
[HttpPost]
[ActionPermissionFilter(Permission = "pfrecipetemplate:add")]
[Log(Title = "配方模板表", BusinessType = BusinessType.INSERT)]
public IActionResult AddPfRecipeTemplate([FromBody] PfRecipeTemplateDto parm)
{
var modal = parm.Adapt<PfRecipeTemplate>().ToCreate(HttpContext);
var response = _PfRecipeTemplateService.AddPfRecipeTemplate(modal);
return SUCCESS(response);
}
/// <summary>
/// 更新配方模板表
/// </summary>
/// <returns></returns>
[HttpPut]
[ActionPermissionFilter(Permission = "pfrecipetemplate:edit")]
[Log(Title = "配方模板表", BusinessType = BusinessType.UPDATE)]
public IActionResult UpdatePfRecipeTemplate([FromBody] PfRecipeTemplateDto parm)
{
var modal = parm.Adapt<PfRecipeTemplate>().ToUpdate(HttpContext);
var response = _PfRecipeTemplateService.UpdatePfRecipeTemplate(modal);
return ToResponse(response);
}
/// <summary>
/// 删除配方模板表
/// </summary>
/// <returns></returns>
[HttpPost("delete/{ids}")]
[ActionPermissionFilter(Permission = "pfrecipetemplate:delete")]
[Log(Title = "配方模板表", BusinessType = BusinessType.DELETE)]
public IActionResult DeletePfRecipeTemplate([FromRoute]string ids)
{
var idArr = int.Parse(ids);
return ToResponse(_PfRecipeTemplateService.Delete(idArr));
}
}
}