package com.xiaopeng.operation.controller;
|
|
import com.xiaopeng.api.model.operation.SysMenu;
|
import com.xiaopeng.common.core.domain.R;
|
import com.xiaopeng.common.core.web.controller.BaseController;
|
import com.xiaopeng.operation.service.ISysMenuService;
|
import io.swagger.annotations.ApiOperation;
|
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import javax.annotation.Resource;
|
import java.util.ArrayList;
|
import java.util.List;
|
|
/**
|
* 菜单信息
|
*
|
* @author ruoyi
|
*/
|
@RestController
|
public class SysMenuController extends BaseController
|
{
|
@Resource
|
private ISysMenuService menuService;
|
|
/**
|
* 根据菜单ID列表获取菜单列表
|
* 内部服务调用接口
|
*
|
* @param menuIds 菜单ID列表
|
* @return 菜单列表
|
*/
|
@PostMapping("/menu/getMenusByMenuIds")
|
@ApiOperation(value = "根据菜单ID列表获取菜单列表", tags = {"内部服务调用"})
|
public R<List<SysMenu>> getMenusByMenuIds(@RequestBody List<Long> menuIds) {
|
if (menuIds == null || menuIds.isEmpty()) {
|
return R.ok(new ArrayList<>());
|
}
|
List<SysMenu> menus = menuService.selectMenusByMenuIds(menuIds);
|
return R.ok(menus);
|
}
|
|
/**
|
* 获取全部菜单树
|
* @return
|
*/
|
@GetMapping("/api/v1/getMenuTree")
|
@ApiOperation(value = "获取全部菜单树", tags = {"管理后台-权限组设置"})
|
public R<List<SysMenu>> getMenuTree() {
|
List<SysMenu> menus = menuService.getMenuTree();
|
return R.ok(menus);
|
}
|
|
@GetMapping("/api/v1/getPermission")
|
@ApiOperation(value = "获取获取当前登录用户菜单列表", tags = {"管理后台-菜单管理"})
|
public R<List<SysMenu>> getPermission(){
|
return R.ok(menuService.getPermission());
|
}
|
|
}
|