package com.ruoyi.system.controller.sys;
|
|
import com.ruoyi.common.core.web.domain.AjaxResult;
|
import com.ruoyi.common.security.utils.SecurityUtils;
|
import com.ruoyi.system.api.domain.poji.sys.SysUser;
|
import com.ruoyi.system.domain.pojo.sys.SysMenu;
|
import com.ruoyi.system.service.sys.ISysMenuService;
|
import com.ruoyi.system.service.sys.ISysUserService;
|
import io.swagger.annotations.ApiOperation;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import java.util.List;
|
|
import static com.ruoyi.common.core.web.domain.AjaxResult.success;
|
|
/**
|
* @ClassName StaffMenuController
|
* @Description TODO
|
* @Author jqs
|
* @Date 2023/6/25 16:19
|
* @Version 1.0
|
*/
|
@RestController
|
@RequestMapping("/staffMenu")
|
public class StaffMenuController {
|
|
|
@Autowired
|
private ISysMenuService menuService;
|
|
@Autowired
|
private ISysUserService sysUserService;
|
|
|
|
|
@ApiOperation(value = "加载对应部门员工菜单列表树")
|
@GetMapping(value = "/roleStaffMenuTreeselect/{deptId}")
|
public AjaxResult deptStaffMenuTreeselect(@PathVariable("deptId") Long deptId)
|
{
|
Long userId = SecurityUtils.getUserId();
|
List<SysMenu> menus = menuService.selectStaffMenuList(userId);
|
AjaxResult ajax = success();
|
ajax.put("checkedKeys", menuService.selectStaffMenuListByDeptId(deptId));
|
ajax.put("menus", menuService.buildMenuTreeSelect(menus));
|
return ajax;
|
}
|
|
|
@ApiOperation(value = "加载对应部门用户员工菜单列表树")
|
@GetMapping(value = "/deptUserStaffMenuTreeselect/{deptUserId}")
|
public AjaxResult deptUserStaffMenuTreeselect(@PathVariable("deptUserId") Long deptUserId)
|
{
|
Long userId = SecurityUtils.getUserId();
|
SysUser sysUser = sysUserService.selectUserById(deptUserId);
|
List<SysMenu> menus = menuService.selectStaffDeptMenuList(deptUserId);
|
AjaxResult ajax = success();
|
ajax.put("checkedKeys", menuService.selectStaffMenuListByDeptUserId(deptUserId));
|
ajax.put("menus", menuService.buildMenuTreeSelect(menus));
|
ajax.put("dataScopeEmployee", sysUser.getDataScopeEmployee());
|
return ajax;
|
}
|
|
/**
|
* 获取菜单下拉树列表
|
*/
|
@GetMapping("/treedeptselect")
|
public AjaxResult treedeptselect(SysMenu menu)
|
{
|
Long userId = SecurityUtils.getUserId();
|
List<SysMenu> menus = menuService.selectStaffMenuList(menu, userId);
|
return success(menuService.buildMenuTreeSelect(menus));
|
}
|
}
|