using Attribute; using Common; using Dto; using Vo; using Enums; using Filters; using Infrastructure; using Infrastructure.Model; using Mapster; using Microsoft.AspNetCore.Mvc; using Middleware; using Model; using Services; using Model.Base; namespace Controllers { /// /// ApiGroup)Controller /// // [Route("ApiGroup")] // [ApiExplorerSettings(GroupName = "ApiGroup")] public class ApiGroupController : BaseController { /// /// api分组接口 /// private readonly IApiGroupService _ApiGroupService; public ApiGroupController(IApiGroupService ApiGroupService) { _ApiGroupService = ApiGroupService; } /// /// api接口分组列表 /// /// 请求参数 /// api接口分组列表 [HttpGet] [Route("/v1/api/ApiGroup/list")] public IActionResult List([FromQuery] ApiGroupListDto parm) { var response = _ApiGroupService.List(parm); return SUCCESS(response); } /// /// api接口分组详情 /// /// 请求参数 /// api接口分组详情 [HttpGet] [Route("/v1/api/ApiGroup/query")] public IActionResult Query([FromQuery] ApiGroupQueryDto parm) { var response = _ApiGroupService.Queryable() .First(x => x.id == parm.id) .Adapt() ?? new ApiGroupQueryVo(); return SUCCESS(response); } /// /// api接口分组添加 /// /// 请求参数 /// api接口分组添加 [HttpPost] [Route("/v1/api/ApiGroup/add")] public IActionResult Add([FromBody] ApiGroupAddDto parm) { var modal = parm.Adapt().ToCreate(HttpContext); var response = _ApiGroupService.Add(modal); return SUCCESS(response); } /// /// api接口分组修改 /// /// 请求参数 /// api接口分组修改 [HttpPut] [Route("/v1/api/ApiGroup/update")] public IActionResult Update([FromBody] ApiGroupUpdateDto parm) { var modal = parm.Adapt().ToUpdate(HttpContext); var response = _ApiGroupService.Update(modal, true); return SUCCESS(response); } /// /// api接口分组删除 /// /// ID /// api接口分组删除 [HttpDelete] [Route("/v1/api/ApiGroup/delete/{id}")] public IActionResult Delete(int id) { var response = _ApiGroupService.Delete(id); return SUCCESS(response); } /// /// api接口分组下拉框数据 /// /// 请求参数 /// api接口分组下拉框数据 [HttpGet] [Route("/v1/api/ApiGroup/SelectList")] public IActionResult SelectList() { var response = _ApiGroupService.SelectList(); return SUCCESS(response); } } }