| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.common.annotation.DataScope; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.constant.UserConstants; |
| | | import com.ruoyi.common.core.domain.PageQuery; |
| | | import com.ruoyi.common.core.domain.entity.SysRole; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.LoginUtils; |
| | | import com.ruoyi.common.utils.PageUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.spring.SpringUtils; |
| | | import com.ruoyi.system.domain.SysRoleDept; |
| | |
| | | private SysRoleDeptMapper roleDeptMapper; |
| | | |
| | | @Override |
| | | @DataScope(deptAlias = "d") |
| | | public TableDataInfo<SysRole> selectPageRoleList(SysRole role) { |
| | | return PageUtils.buildDataInfo(baseMapper.selectPageRoleList(PageUtils.buildPage(), role)); |
| | | public TableDataInfo<SysRole> selectPageRoleList(SysRole role, PageQuery pageQuery) { |
| | | Page<SysRole> page = baseMapper.selectPageRoleList(pageQuery.build(), role); |
| | | return TableDataInfo.build(page); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return 角色数据集合信息 |
| | | */ |
| | | @Override |
| | | @DataScope(deptAlias = "d") |
| | | public List<SysRole> selectRoleList(SysRole role) { |
| | | return baseMapper.selectRoleList(role); |
| | | } |
| | |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int insertRole(SysRole role) { |
| | | // 新增角色信息 |
| | | baseMapper.insert(role); |
| | |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int updateRole(SysRole role) { |
| | | // 修改角色信息 |
| | | baseMapper.updateById(role); |
| | |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int authDataScope(SysRole role) { |
| | | // 修改角色信息 |
| | | baseMapper.updateById(role); |
| | |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int deleteRoleById(Long roleId) { |
| | | // 删除角色与菜单关联 |
| | | roleMenuMapper.delete(new LambdaQueryWrapper<SysRoleMenu>().eq(SysRoleMenu::getRoleId, roleId)); |
| | |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int deleteRoleByIds(Long[] roleIds) { |
| | | for (Long roleId : roleIds) { |
| | | checkRoleAllowed(new SysRole(roleId)); |