using Infrastructure; using Infrastructure.Attribute; using Infrastructure.Enums; using Infrastructure.Model; using Mapster; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using ARW.Admin.WebApi.Extensions; using ARW.Admin.WebApi.Filters; using ARW.Common; using ARW.Model.Dto.Business.Settings.PlatformSpecs; using ARW.Service.Business.IBusinessService.Settings.PlatformSpecs; using ARW.Admin.WebApi.Controllers; using ARW.Model.Models.Business.Settings.PlatformSpecs; using ARW.Model.Vo.Business.Settings.PlatformSpecs; using Microsoft.AspNetCore.Authorization; using ARW.Admin.WebApi.Framework; namespace ARW.WebApi.Controllers.Business.Settings.PlatformSpecs { /// /// 平台资质与规范控制器 /// /// @author lwh /// @date 2023-10-22 /// [Verify] [Route("business/[controller]")] public class PlatformSpecController : BaseController { private readonly IPlatformSpecService _PlatformSpecService; /// /// 依赖注入 /// /// 平台资质与规范服务 public PlatformSpecController(IPlatformSpecService PlatformSpecService) { _PlatformSpecService = PlatformSpecService; } /// /// 获取平台资质与规范列表 /// /// 查询参数 /// [HttpGet("getPlatformSpecList")] [ActionPermissionFilter(Permission = "business:platformspec:list")] public async Task GetPlatformSpecList([FromQuery] PlatformSpecQueryDto parm) { var res = await _PlatformSpecService.GetPlatformSpecList(parm); return SUCCESS(res); } /// /// 添加或修改平台资质与规范 /// /// /// [HttpPost("addOrUpdatePlatformSpec")] [ActionPermissionFilter(Permission = "business:platformspec:addOrUpdate")] [Log(Title = "添加或修改平台资质与规范", BusinessType = BusinessType.ADDORUPDATE)] public async Task AddOrUpdatePlatformSpec([FromBody] PlatformSpecDto parm) { if (parm == null) { throw new CustomException("请求参数错误"); } var modal = new PlatformSpec(); if (parm.PlatformSpecId != 0) modal = parm.Adapt().ToUpdate(HttpContext); else modal = parm.Adapt().ToCreate(HttpContext); var res = await _PlatformSpecService.AddOrUpdatePlatformSpec(modal); return SUCCESS(res); } /// /// 删除平台资质与规范 /// /// [HttpDelete("{ids}")] [ActionPermissionFilter(Permission = "business:platformspec:delete")] [Log(Title = "平台资质与规范删除", BusinessType = BusinessType.DELETE)] public IActionResult Delete(string ids) { long[] idsArr = Tools.SpitLongArrary(ids); if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); } var response = _PlatformSpecService.Delete(idsArr); return SUCCESS("删除成功!"); } } }