123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- 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
- {
- /// <summary>
- /// ApiGroup)Controller
- /// </summary>
- // [Route("ApiGroup")]
- // [ApiExplorerSettings(GroupName = "ApiGroup")]
- public class ApiGroupController : BaseController
- {
- /// <summary>
- /// api分组接口
- /// </summary>
- private readonly IApiGroupService _ApiGroupService;
- public ApiGroupController(IApiGroupService ApiGroupService)
- {
- _ApiGroupService = ApiGroupService;
- }
- /// <summary>
- /// api接口分组列表
- /// </summary>
- /// <param name="parm">请求参数</param>
- /// <returns>api接口分组列表</returns>
- [HttpGet]
- [Route("/v1/api/ApiGroup/list")]
- public IActionResult List([FromQuery] ApiGroupListDto parm)
- {
- var response = _ApiGroupService.List(parm);
- return SUCCESS(response);
- }
- /// <summary>
- /// api接口分组详情
- /// </summary>
- /// <param name="parm">请求参数</param>
- /// <returns>api接口分组详情</returns>
- [HttpGet]
- [Route("/v1/api/ApiGroup/query")]
- public IActionResult Query([FromQuery] ApiGroupQueryDto parm)
- {
- var response = _ApiGroupService.Queryable()
- .First(x => x.id == parm.id)
- .Adapt<ApiGroupQueryVo>() ?? new ApiGroupQueryVo();
- return SUCCESS(response);
- }
- /// <summary>
- /// api接口分组添加
- /// </summary>
- /// <param name="parm">请求参数</param>
- /// <returns>api接口分组添加</returns>
- [HttpPost]
- [Route("/v1/api/ApiGroup/add")]
- public IActionResult Add([FromBody] ApiGroupAddDto parm)
- {
- var modal = parm.Adapt<ApiGroup>().ToCreate(HttpContext);
- var response = _ApiGroupService.Add(modal);
- return SUCCESS(response);
- }
- /// <summary>
- /// api接口分组修改
- /// </summary>
- /// <param name="parm">请求参数</param>
- /// <returns>api接口分组修改</returns>
- [HttpPut]
- [Route("/v1/api/ApiGroup/update")]
- public IActionResult Update([FromBody] ApiGroupUpdateDto parm)
- {
- var modal = parm.Adapt<ApiGroup>().ToUpdate(HttpContext);
- var response = _ApiGroupService.Update(modal, true);
- return SUCCESS(response);
- }
- /// <summary>
- /// api接口分组删除
- /// </summary>
- /// <param name="Id">ID</param>
- /// <returns>api接口分组删除</returns>
- [HttpDelete]
- [Route("/v1/api/ApiGroup/delete/{id}")]
- public IActionResult Delete(int id)
- {
- var response = _ApiGroupService.Delete(id);
- return SUCCESS(response);
- }
- /// <summary>
- /// api接口分组下拉框数据
- /// </summary>
- /// <param name="parm">请求参数</param>
- /// <returns>api接口分组下拉框数据</returns>
- [HttpGet]
- [Route("/v1/api/ApiGroup/SelectList")]
- public IActionResult SelectList()
- {
- var response = _ApiGroupService.SelectList();
- return SUCCESS(response);
- }
- }
- }
|