DictionaryController.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. using Admin.Core.Common.Input;
  2. using Admin.Core.Common.Output;
  3. using Admin.Core.Model.Admin;
  4. using Admin.Core.Service.Admin.Dictionary;
  5. using Admin.Core.Service.Admin.Dictionary.Input;
  6. using Microsoft.AspNetCore.Mvc;
  7. using System.Threading.Tasks;
  8. namespace Admin.Core.Controllers.Admin
  9. {
  10. /// <summary>
  11. /// 数据字典
  12. /// </summary>
  13. public class DictionaryController : AreaController
  14. {
  15. private readonly IDictionaryService _dictionaryService;
  16. public DictionaryController(IDictionaryService dictionaryService)
  17. {
  18. _dictionaryService = dictionaryService;
  19. }
  20. /// <summary>
  21. /// 查询单条数据字典
  22. /// </summary>
  23. /// <param name="id"></param>
  24. /// <returns></returns>
  25. [HttpGet]
  26. public async Task<IResponseOutput> Get(long id)
  27. {
  28. return await _dictionaryService.GetAsync(id);
  29. }
  30. /// <summary>
  31. /// 查询分页数据字典
  32. /// </summary>
  33. /// <param name="model"></param>
  34. /// <returns></returns>
  35. [HttpPost]
  36. public async Task<IResponseOutput> GetPage(PageInput<DictionaryEntity> model)
  37. {
  38. return await _dictionaryService.PageAsync(model);
  39. }
  40. /// <summary>
  41. /// 新增数据字典
  42. /// </summary>
  43. /// <param name="input"></param>
  44. /// <returns></returns>
  45. [HttpPost]
  46. public async Task<IResponseOutput> Add(DictionaryAddInput input)
  47. {
  48. return await _dictionaryService.AddAsync(input);
  49. }
  50. /// <summary>
  51. /// 修改数据字典
  52. /// </summary>
  53. /// <param name="input"></param>
  54. /// <returns></returns>
  55. [HttpPut]
  56. public async Task<IResponseOutput> Update(DictionaryUpdateInput input)
  57. {
  58. return await _dictionaryService.UpdateAsync(input);
  59. }
  60. /// <summary>
  61. /// 删除数据字典
  62. /// </summary>
  63. /// <param name="id"></param>
  64. /// <returns></returns>
  65. [HttpDelete]
  66. public async Task<IResponseOutput> SoftDelete(long id)
  67. {
  68. return await _dictionaryService.SoftDeleteAsync(id);
  69. }
  70. }
  71. }