123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- 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>
- /// ApiInfo)Controller
- /// </summary>
- // [Route("ApiInfo")]
- // [ApiExplorerSettings(GroupName = "ApiInfo")]
- public class ApiInfoController : BaseController
- {
- /// <summary>
- /// api分组接口
- /// </summary>
- private readonly IApiInfoService _ApiInfoService;
- public ApiInfoController(IApiInfoService ApiInfoService)
- {
- _ApiInfoService = ApiInfoService;
- }
- /// <summary>
- /// api接口列表
- /// </summary>
- /// <param name="parm">请求参数</param>
- /// <returns>api接口列表</returns>
- [HttpGet]
- [Route("/v1/api/ApiInfo/list")]
- public IActionResult List([FromQuery] PagerInfo page, [FromQuery] ApiInfoListDto parm)
- {
- var response = _ApiInfoService.List(page, parm);
- return SUCCESS(response);
- }
- /// <summary>
- /// api接口详情
- /// </summary>
- /// <param name="parm">请求参数</param>
- /// <returns>api接口详情</returns>
- [HttpGet]
- [Route("/v1/api/ApiInfo/query")]
- public IActionResult Query([FromQuery] ApiInfoQueryDto parm)
- {
- var response = _ApiInfoService.Queryable()
- .First(x => x.id == parm.id)
- .Adapt<ApiInfoQueryVo>() ?? new ApiInfoQueryVo();
- return SUCCESS(response);
- }
- /// <summary>
- /// api接口添加
- /// </summary>
- /// <param name="parm">请求参数</param>
- /// <returns>api接口添加</returns>
- [HttpPost]
- [Route("/v1/api/ApiInfo/add")]
- public IActionResult Add([FromBody] ApiInfoAddDto parm)
- {
- var modal = parm.Adapt<ApiInfo>().ToCreate(HttpContext);
- var response = _ApiInfoService.Add(modal);
- return SUCCESS(response);
- }
- /// <summary>
- /// api接口设置版本号
- /// </summary>
- /// <param name="parm">请求参数</param>
- /// <returns>api接口设置版本号</returns>
- [HttpPut]
- [Route("/v1/api/ApiInfo/setVersion")]
- public IActionResult SetVersion([FromBody] ApiInfoSetVersionDto parm)
- {
- var modal = parm.Adapt<ApiInfo>().ToUpdate(HttpContext);
- var response = _ApiInfoService.Update(modal, true);
- return SUCCESS(response);
- }
- /// <summary>
- /// api接口删除
- /// </summary>
- /// <param name="Id">ID</param>
- /// <returns>api接口删除</returns>
- [HttpDelete]
- [Route("/v1/api/ApiInfo/delete/{id}")]
- public IActionResult Delete(int id)
- {
- var response = _ApiInfoService.Delete(id);
- return SUCCESS(response);
- }
- /// <summary>
- /// api接口修改
- /// </summary>
- /// <param name="parm">请求参数</param>
- /// <returns>api接口修改</returns>
- [HttpPut]
- [Route("/v1/api/ApiInfo/update")]
- public IActionResult Update([FromBody] ApiInfoUpdateDto parm)
- {
- var modal = parm.Adapt<ApiInfo>().ToUpdate(HttpContext);
- var response = _ApiInfoService.Update(modal, true);
- return SUCCESS(response);
- }
- /// <summary>
- /// api接口设置请求地址
- /// </summary>
- /// <param name="parm">请求参数</param>
- /// <returns>api接口设置请求地址</returns>
- [HttpPut]
- [Route("/v1/api/ApiInfo/setRouter")]
- public IActionResult SetRouter([FromBody] ApiInfoSetRouterDto parm)
- {
- var modal = parm.Adapt<ApiInfo>().ToUpdate(HttpContext);
- var response = _ApiInfoService.Update(modal, true);
- return SUCCESS(response);
- }
- }
- }
|