|
|
|
@ -14,8 +14,11 @@ import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
import com.ruoyi.common.constant.UserConstants; |
|
|
|
|
import com.ruoyi.common.utils.SecurityUtils; |
|
|
|
|
import com.ruoyi.common.utils.ServletUtils; |
|
|
|
|
import com.ruoyi.framework.aspectj.lang.annotation.Log; |
|
|
|
|
import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
|
|
|
|
import com.ruoyi.framework.security.LoginUser; |
|
|
|
|
import com.ruoyi.framework.security.service.TokenService; |
|
|
|
|
import com.ruoyi.framework.web.controller.BaseController; |
|
|
|
|
import com.ruoyi.framework.web.domain.AjaxResult; |
|
|
|
|
import com.ruoyi.project.system.domain.SysMenu; |
|
|
|
@ -33,6 +36,9 @@ public class SysMenuController extends BaseController |
|
|
|
|
@Autowired |
|
|
|
|
private ISysMenuService menuService; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private TokenService tokenService; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取菜单列表 |
|
|
|
|
*/ |
|
|
|
@ -40,7 +46,9 @@ public class SysMenuController extends BaseController |
|
|
|
|
@GetMapping("/list") |
|
|
|
|
public AjaxResult list(SysMenu menu) |
|
|
|
|
{ |
|
|
|
|
List<SysMenu> menus = menuService.selectMenuList(menu); |
|
|
|
|
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); |
|
|
|
|
Long userId = loginUser.getUser().getUserId(); |
|
|
|
|
List<SysMenu> menus = menuService.selectMenuList(menu, userId); |
|
|
|
|
return AjaxResult.success(menuService.buildMenuTree(menus)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -58,9 +66,11 @@ public class SysMenuController extends BaseController |
|
|
|
|
* 获取菜单下拉树列表 |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/treeselect") |
|
|
|
|
public AjaxResult treeselect(SysMenu dept) |
|
|
|
|
public AjaxResult treeselect(SysMenu menu) |
|
|
|
|
{ |
|
|
|
|
List<SysMenu> menus = menuService.selectMenuList(dept); |
|
|
|
|
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); |
|
|
|
|
Long userId = loginUser.getUser().getUserId(); |
|
|
|
|
List<SysMenu> menus = menuService.selectMenuList(menu, userId); |
|
|
|
|
return AjaxResult.success(menuService.buildMenuTreeSelect(menus)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|