菜单&数据权限新增(展开/折叠 全选/全不选 父子联动)

This commit is contained in:
RuoYi
2020-09-19 13:42:37 +08:00
parent 0ecf27f8d6
commit 478fae0d28
12 changed files with 150 additions and 39 deletions

View File

@ -23,9 +23,10 @@ public interface SysDeptMapper
* 根据角色ID查询部门树信息
*
* @param roleId 角色ID
* @param deptCheckStrictly 部门树选择项是否关联显示
* @return 选中部门列表
*/
public List<Integer> selectDeptListByRoleId(Long roleId);
public List<Integer> selectDeptListByRoleId(@Param("roleId") Long roleId, @Param("deptCheckStrictly") boolean deptCheckStrictly);
/**
* 根据部门ID查询信息

View File

@ -59,11 +59,12 @@ public interface SysMenuMapper
/**
* 根据角色ID查询菜单树信息
*
*
* @param roleId 角色ID
* @param menuCheckStrictly 菜单树选择项是否关联显示
* @return 选中菜单列表
*/
public List<Integer> selectMenuListByRoleId(Long roleId);
public List<Integer> selectMenuListByRoleId(@Param("roleId") Long roleId, @Param("menuCheckStrictly") boolean menuCheckStrictly);
/**
* 根据菜单ID查询信息

View File

@ -10,9 +10,11 @@ import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.domain.TreeSelect;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.exception.CustomException;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.mapper.SysDeptMapper;
import com.ruoyi.system.mapper.SysRoleMapper;
import com.ruoyi.system.service.ISysDeptService;
/**
@ -26,6 +28,9 @@ public class SysDeptServiceImpl implements ISysDeptService
@Autowired
private SysDeptMapper deptMapper;
@Autowired
private SysRoleMapper roleMapper;
/**
* 查询部门管理数据
*
@ -93,7 +98,8 @@ public class SysDeptServiceImpl implements ISysDeptService
@Override
public List<Integer> selectDeptListByRoleId(Long roleId)
{
return deptMapper.selectDeptListByRoleId(roleId);
SysRole role = roleMapper.selectRoleById(roleId);
return deptMapper.selectDeptListByRoleId(roleId, role.isDeptCheckStrictly());
}
/**

View File

@ -13,12 +13,14 @@ import org.springframework.stereotype.Service;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.domain.TreeSelect;
import com.ruoyi.common.core.domain.entity.SysMenu;
import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.vo.MetaVo;
import com.ruoyi.system.domain.vo.RouterVo;
import com.ruoyi.system.mapper.SysMenuMapper;
import com.ruoyi.system.mapper.SysRoleMapper;
import com.ruoyi.system.mapper.SysRoleMenuMapper;
import com.ruoyi.system.service.ISysMenuService;
@ -35,6 +37,9 @@ public class SysMenuServiceImpl implements ISysMenuService
@Autowired
private SysMenuMapper menuMapper;
@Autowired
private SysRoleMapper roleMapper;
@Autowired
private SysRoleMenuMapper roleMenuMapper;
@ -124,7 +129,8 @@ public class SysMenuServiceImpl implements ISysMenuService
@Override
public List<Integer> selectMenuListByRoleId(Long roleId)
{
return menuMapper.selectMenuListByRoleId(roleId);
SysRole role = roleMapper.selectRoleById(roleId);
return menuMapper.selectMenuListByRoleId(roleId, role.isMenuCheckStrictly());
}
/**