guiyang-fluorescent-line-lm.../MDM/Controllers/Plant/PlantPlcIoPointController.cs
gcw_MV9p2JJN df44f145a9 MDM更新
2025-11-25 15:44:04 +08:00

117 lines
3.7 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 Infrastructure;
using Infrastructure.Attribute;
using Infrastructure.Controllers;
using Infrastructure.Enums;
using Infrastructure.Model;
using Mapster;
using MDM.Model.Plant;
using MDM.Model.Plant.Dto;
using MDM.Services.IPlantService;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using RIZO.Admin.WebApi.Filters;
using RIZO.Common;
using RIZO.ServiceCore.Middleware;
//创建时间2025-11-15
namespace MDM.Controllers.Plant
{
/// <summary>
/// PLC点位
/// </summary>
[Verify]
[Route("MasterDataManagement/Plant/PlantPlcIoPoint")]
public class PlantPlcIoPointController : BaseController
{
/// <summary>
/// PLC点位接口
/// </summary>
private readonly IPlantPlcIoPointService _PlantPlcIoPointService;
public PlantPlcIoPointController(IPlantPlcIoPointService PlantPlcIoPointService)
{
_PlantPlcIoPointService = PlantPlcIoPointService;
}
/// <summary>
/// 查询PLC点位列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
[HttpGet("list")]
[ActionPermissionFilter(Permission = "business:plantplciopoint:list")]
public IActionResult QueryPlantPlcIoPoint([FromQuery] PlantPlcIoPointQueryDto parm)
{
var response = _PlantPlcIoPointService.GetList(parm);
return SUCCESS(response);
}
/// <summary>
/// 查询PLC点位详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
[HttpGet("{Id}")]
[ActionPermissionFilter(Permission = "business:plantplciopoint:query")]
public IActionResult GetPlantPlcIoPoint(int Id)
{
var response = _PlantPlcIoPointService.GetInfo(Id);
var info = response.Adapt<PlantPlcIoPoint>();
return SUCCESS(info);
}
/// <summary>
/// 添加PLC点位
/// </summary>
/// <returns></returns>
[HttpPost]
[ActionPermissionFilter(Permission = "business:plantplciopoint:add")]
[Log(Title = "PLC点位", BusinessType = BusinessType.INSERT)]
public IActionResult AddPlantPlcIoPoint([FromBody] PlantPlcIoPointDto parm)
{
var modal = parm.Adapt<PlantPlcIoPoint>().ToCreate(HttpContext);
var response = _PlantPlcIoPointService.AddPlantPlcIoPoint(modal);
return SUCCESS(response);
}
/// <summary>
/// 更新PLC点位
/// </summary>
/// <returns></returns>
[HttpPut]
[ActionPermissionFilter(Permission = "business:plantplciopoint:edit")]
[Log(Title = "PLC点位", BusinessType = BusinessType.UPDATE)]
public IActionResult UpdatePlantPlcIoPoint([FromBody] PlantPlcIoPointDto parm)
{
var modal = parm.Adapt<PlantPlcIoPoint>().ToUpdate(HttpContext);
var response = _PlantPlcIoPointService.UpdatePlantPlcIoPoint(modal);
return ToResponse(response);
}
/// <summary>
/// 删除PLC点位
/// </summary>
/// <returns></returns>
[HttpDelete("{ids}")]
[ActionPermissionFilter(Permission = "business:plantplciopoint:delete")]
[Log(Title = "PLC点位", BusinessType = BusinessType.DELETE)]
public IActionResult DeletePlantPlcIoPoint(string ids)
{
int[] idsArr = Tools.SpitIntArrary(ids);
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
var response = _PlantPlcIoPointService.Delete(idsArr);
return ToResponse(response);
}
}
}