PriListController.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. using Vo;
  2. using Microsoft.AspNetCore.Mvc;
  3. using Model;
  4. using Services;
  5. using Model.Base;
  6. using Vo.Admin;
  7. using Mapster;
  8. using Infrastructure;
  9. namespace Controllers.Admin
  10. {
  11. /// <summary>
  12. /// PriList)Controller
  13. /// </summary>
  14. // [Route("${Router}$")]
  15. // [ApiExplorerSettings(GroupName = "PriList")]
  16. public class PriListController : BaseController
  17. {
  18. /// <summary>
  19. /// api分组接口
  20. /// </summary>
  21. private readonly IPriListService _PriListService;
  22. public PriListController(IPriListService PriListService)
  23. {
  24. _PriListService = PriListService;
  25. }
  26. /// <param name="page">分页参数</param>
  27. /// <summary>
  28. /// 列表
  29. /// </summary>
  30. /// <param name="page">分页对象</param>
  31. /// <param name="param">参数请求体</param>
  32. /// <returns>列表</returns>
  33. [HttpGet]
  34. [Route("/v1/pri/PriList/getPriListList")]
  35. public IActionResult getPriListList([FromQuery] PagerInfo page, [FromQuery] PriList param)
  36. {
  37. var response = _PriListService.getPriListList(page, param);
  38. return SUCCESS(response);
  39. }
  40. /// <summary>
  41. /// 详情
  42. /// </summary>
  43. /// <param name="param">参数请求体</param>
  44. /// <returns>详情</returns>
  45. [HttpGet]
  46. [Route("/v1/pri/PriList/getPriListQuery")]
  47. public IActionResult getPriListQuery([FromQuery] PriList param)
  48. {
  49. var response = _PriListService.GetFirst(m => m.id == param.id).Adapt<GetPriListQueryVo>();
  50. return SUCCESS(response);
  51. }
  52. /// <summary>
  53. /// 添加
  54. /// </summary>
  55. /// <param name="param">参数请求体</param>
  56. /// <returns>添加</returns>
  57. [HttpPost]
  58. [Route("/v1/pri/PriList/addPriList")]
  59. public IActionResult addPriList([FromBody] PriList param)
  60. {
  61. var modal = param.Adapt<PriList>().ToCreate(HttpContext);
  62. var response = _PriListService.Add(modal);
  63. return SUCCESS(response);
  64. }
  65. /// <summary>
  66. /// 修改
  67. /// </summary>
  68. /// <param name="param">参数请求体</param>
  69. /// <returns>修改</returns>
  70. [HttpPut]
  71. [Route("/v1/pri/PriList/updatePriList")]
  72. public IActionResult updatePriList([FromBody] PriList param)
  73. {
  74. var modal = param.Adapt<PriList>().ToCreate(HttpContext);
  75. var response = _PriListService.Update(modal);
  76. return SUCCESS(response);
  77. }
  78. /// <summary>
  79. /// 删除
  80. /// </summary>
  81. /// <param name="id">ID</param>
  82. /// <returns>删除</returns>
  83. [HttpDelete]
  84. [Route("/v1/pri/PriList/deletePriList/{id}")]
  85. public IActionResult deletePriList(int id)
  86. {
  87. var response = _PriListService.Delete(id);
  88. return SUCCESS(response);
  89. }
  90. /// <summary>
  91. /// 下拉框数据
  92. /// </summary>
  93. /// <param name="page">分页对象</param>
  94. /// <returns>下拉框数据</returns>
  95. [HttpGet]
  96. [Route("/v1/pri/PriList/getPriListDic")]
  97. public IActionResult getPriListDic([FromQuery] PagerInfo page)
  98. {
  99. var response = _PriListService.getPriListDic(page);
  100. return SUCCESS(response);
  101. }
  102. }
  103. }