40 lines
1016 B
Java
40 lines
1016 B
Java
package com.onixbyte.helix.controller;
|
|
|
|
import com.onixbyte.helix.domain.entity.Menu;
|
|
import com.onixbyte.helix.domain.common.TreeNode;
|
|
import com.onixbyte.helix.service.MenuService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import java.util.List;
|
|
|
|
/**
|
|
* This controller provides entry points to manipulate menus.
|
|
*
|
|
* @author zihluwang
|
|
* @author siujamo
|
|
*/
|
|
@RestController
|
|
@RequestMapping("/menus")
|
|
public class MenuController {
|
|
|
|
private final MenuService menuService;
|
|
|
|
@Autowired
|
|
public MenuController(MenuService menuService) {
|
|
this.menuService = menuService;
|
|
}
|
|
|
|
/**
|
|
* Get menu tree.
|
|
*
|
|
* @return available menu tree for the current user
|
|
*/
|
|
@GetMapping
|
|
public List<TreeNode<Menu>> getMenuTree() {
|
|
return menuService.getMenuTree();
|
|
}
|
|
}
|