DictController.java 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. package com.gz.controller.system;
  2. import cn.hutool.core.lang.tree.Tree;
  3. import com.github.pagehelper.PageInfo;
  4. import com.gz.core.annotation.TraceLog;
  5. import com.gz.core.exception.BusinessException;
  6. import com.gz.dto.system.DictDTO;
  7. import com.gz.dto.system.gdndDTO;
  8. import com.gz.service.system.DictService;
  9. import com.gz.vo.system.DictVO;
  10. import org.springframework.web.bind.annotation.*;
  11. import javax.annotation.Resource;
  12. import java.util.List;
  13. import java.util.Map;
  14. /**
  15. * @author LiuchangLan
  16. * @date 2020/9/7 10:21
  17. */
  18. @RestController
  19. @RequestMapping("system/dict")
  20. public class DictController {
  21. @Resource
  22. private DictService dictService;
  23. /**
  24. * @description 增
  25. * @author LiuChangLan
  26. * @since 2020/9/4 14:46
  27. */
  28. @PostMapping("insert")
  29. @TraceLog(module = "字典管理",business = "新增字典")
  30. public Integer insert(@RequestBody DictDTO dictDTO) throws BusinessException {
  31. return dictService.insert(dictDTO);
  32. }
  33. /**
  34. * @description 删
  35. * @author LiuChangLan
  36. * @since 2020/9/4 14:46
  37. */
  38. @DeleteMapping("delete")
  39. @TraceLog(module = "字典管理",business = "删除字典")
  40. public Integer delete(Integer id){
  41. return dictService.delete(id);
  42. }
  43. /**
  44. * @description 改
  45. * @author LiuChangLan
  46. * @since 2020/9/4 14:46
  47. */
  48. @PostMapping("update")
  49. @TraceLog(module = "字典管理",business = "修改字典")
  50. public Integer update(@RequestBody DictDTO dictDTO) throws BusinessException {
  51. return dictService.update(dictDTO);
  52. }
  53. /**
  54. * @description 查(给分页参数查分页 没给查全部)
  55. * @author LiuChangLan
  56. * @since 2020/9/4 14:46
  57. */
  58. @GetMapping("selectByPage")
  59. @TraceLog(module = "字典管理",business = "查找字典列表")
  60. public PageInfo<DictDTO> select(DictVO dictVO){
  61. return dictService.selectByPage(dictVO);
  62. }
  63. /**
  64. * @description 根据主键查询
  65. * @author LiuChangLan
  66. * @since 2020/9/4 16:36
  67. */
  68. @GetMapping("selectByPrimaryKey")
  69. @TraceLog(module = "字典管理",business = "查询字典详细信息")
  70. public DictDTO selectByPrimaryKey(Integer id){
  71. return dictService.selectByPrimaryKey(id);
  72. }
  73. /**
  74. * @description 查
  75. * @author LiuChangLan
  76. * @since 2020/9/7 10:28
  77. */
  78. @GetMapping("select")
  79. @TraceLog(module = "字典管理",business = "查询素有字典")
  80. public List<DictDTO> select(){
  81. return dictService.select();
  82. }
  83. /**
  84. * @description 获取字典树
  85. * @author LiuChangLan
  86. * @since 2020/9/7 14:36
  87. */
  88. @GetMapping("getDictTree")
  89. @TraceLog(module = "字典管理",business = "查询字典树列表")
  90. List<Tree<String>> getDictTree(){
  91. return dictService.getDictTree();
  92. }
  93. /**
  94. * @description 根据code查询所有选项
  95. * @author LiuChangLan
  96. * @since 2020/9/7 16:57
  97. */
  98. @GetMapping("selectDictByCode")
  99. @TraceLog(module = "字典管理",business = "查询固定code的子字典")
  100. List<DictDTO> selectDictByCode(String code){
  101. return dictService.selectDictByCode(code);
  102. }
  103. /**
  104. * @description 查询所有归档年度
  105. * @author zhanghai
  106. * @since 2021/9/11
  107. */
  108. @GetMapping("selectGdnd")
  109. List<gdndDTO> selectGdnd(){
  110. List<gdndDTO> gdndDTOS = dictService.selectGdnd();
  111. System.out.println(gdndDTOS.toString());
  112. return gdndDTOS;
  113. }
  114. @GetMapping("selectMiJiRole")
  115. List<Map> selectMiJiRole(Integer roleId){
  116. return dictService.selectMiJiRole(roleId);
  117. }
  118. }