AppVersionController.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. using Attribute;
  2. using Common;
  3. using Dto;
  4. using Vo;
  5. using Enums;
  6. using Filters;
  7. using Infrastructure;
  8. using Infrastructure.Model;
  9. using Mapster;
  10. using Microsoft.AspNetCore.Mvc;
  11. using Middleware;
  12. using Model;
  13. using Services;
  14. using Model.Base;
  15. namespace Controllers
  16. {
  17. /// <summary>
  18. /// AppVersion)Controller
  19. /// </summary>
  20. // [Route("AppVersion")]
  21. // [ApiExplorerSettings(GroupName = "AppVersion")]
  22. public class AppVersionController : BaseController
  23. {
  24. /// <summary>
  25. /// api分组接口
  26. /// </summary>
  27. private readonly IAppVersionService _AppVersionService;
  28. public AppVersionController(IAppVersionService AppVersionService)
  29. {
  30. _AppVersionService = AppVersionService;
  31. }
  32. /// <summary>
  33. /// app版本管理列表
  34. /// </summary>
  35. /// <param name="parm">请求参数</param>
  36. /// <returns>app版本管理列表</returns>
  37. [HttpGet]
  38. [Route("/v1/api/AppVersion/list")]
  39. public IActionResult List([FromQuery] AppVersionListDto parm)
  40. {
  41. var response = _AppVersionService.List(parm);
  42. return SUCCESS(response);
  43. }
  44. /// <summary>
  45. /// app版本管理详情
  46. /// </summary>
  47. /// <param name="parm">请求参数</param>
  48. /// <returns>app版本管理详情</returns>
  49. [HttpGet]
  50. [Route("/v1/api/AppVersion/query")]
  51. public IActionResult Query([FromQuery] AppVersionQueryDto parm)
  52. {
  53. var response = _AppVersionService.Queryable()
  54. .First(x => x.id == parm.id)
  55. .Adapt<AppVersionQueryVo>() ?? new AppVersionQueryVo();
  56. return SUCCESS(response);
  57. }
  58. /// <summary>
  59. /// app版本管理添加
  60. /// </summary>
  61. /// <param name="parm">请求参数</param>
  62. /// <returns>app版本管理添加</returns>
  63. [HttpPost]
  64. [Route("/v1/api/AppVersion/add")]
  65. public IActionResult Add([FromBody] AppVersionAddDto parm)
  66. {
  67. var modal = parm.Adapt<AppVersion>().ToCreate(HttpContext);
  68. var response = _AppVersionService.Add(modal);
  69. return SUCCESS(response);
  70. }
  71. /// <summary>
  72. /// app版本管理修改
  73. /// </summary>
  74. /// <param name="parm">请求参数</param>
  75. /// <returns>app版本管理修改</returns>
  76. [HttpPut]
  77. [Route("/v1/api/AppVersion/update")]
  78. public IActionResult Update([FromBody] AppVersionUpdateDto parm)
  79. {
  80. var modal = parm.Adapt<AppVersion>().ToUpdate(HttpContext);
  81. var response = _AppVersionService.Update(modal, true);
  82. return SUCCESS(response);
  83. }
  84. /// <summary>
  85. /// app版本管理删除
  86. /// </summary>
  87. /// <param name="Id">ID</param>
  88. /// <returns>app版本管理删除</returns>
  89. [HttpDelete]
  90. [Route("/v1/api/AppVersion/delete/{id}")]
  91. public IActionResult Delete(int id)
  92. {
  93. var response = _AppVersionService.Delete(id);
  94. return SUCCESS(response);
  95. }
  96. }
  97. }