MenuOperationController.java 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. package com.ims.eval.controller;
  2. import com.alibaba.fastjson.JSONObject;
  3. import com.ims.eval.entity.custom.Menu;
  4. import com.ims.eval.entity.dto.result.R;
  5. import com.ims.eval.service.custom.impl.MenuOperationService;
  6. import lombok.extern.slf4j.Slf4j;
  7. import org.springframework.beans.factory.annotation.Autowired;
  8. import org.springframework.web.bind.annotation.*;
  9. import javax.servlet.http.HttpServletRequest;
  10. import java.util.List;
  11. /**
  12. * <p>
  13. * 工作流前端控制器
  14. * </p>
  15. *
  16. * @author wang
  17. * @since 2023-03-03
  18. */
  19. @Slf4j
  20. @RestController
  21. @RequestMapping("//menu")
  22. public class MenuOperationController {
  23. @Autowired
  24. private MenuOperationService menuOperationService;
  25. @Autowired
  26. private HttpServletRequest request;
  27. /**
  28. * 获取菜单
  29. * @param parentId
  30. * @return
  31. */
  32. @PostMapping(value = "menuList")
  33. public R menuList(@RequestParam(value = "parentId", required = false) String parentId) {
  34. List<Menu> getTree = null;
  35. try {
  36. getTree = menuOperationService.getMenuTree(parentId,request);
  37. } catch (Exception e) {
  38. log.error("错误",e);
  39. return R.error().customError("获取菜单获取失败");
  40. }
  41. return R.ok().data(getTree);
  42. }
  43. /**
  44. * 获取用户权限
  45. * @return
  46. */
  47. @PostMapping(value = "getPrivilegesOfCurrentUserAll")
  48. public R getPrivilegesOfCurrentUserAll() {
  49. JSONObject json = null;
  50. try {
  51. json = menuOperationService.getPrivilegesOfCurrentUserAll(request);
  52. } catch (Exception e) {
  53. log.error("错误",e);
  54. return R.error().customError("获取用户权限获取失败");
  55. }
  56. return R.ok().data(json);
  57. }
  58. }