|
@@ -4,10 +4,7 @@ import com.bizmatics.common.core.exception.BusinessException;
|
|
|
import com.bizmatics.common.spring.util.SpringContextUtils;
|
|
|
import com.bizmatics.model.constants.UserConstants;
|
|
|
import com.bizmatics.model.system.*;
|
|
|
-import com.bizmatics.persistence.mapper.system.SysRoleDeptMapper;
|
|
|
-import com.bizmatics.persistence.mapper.system.SysRoleMapper;
|
|
|
-import com.bizmatics.persistence.mapper.system.SysRoleMenuMapper;
|
|
|
-import com.bizmatics.persistence.mapper.system.SysUserRoleMapper;
|
|
|
+import com.bizmatics.persistence.mapper.system.*;
|
|
|
import com.bizmatics.service.aop.DataScope;
|
|
|
import com.bizmatics.service.system.ISysRoleService;
|
|
|
import com.bizmatics.service.util.SecurityUtils;
|
|
@@ -36,6 +33,9 @@ public class SysRoleServiceImpl implements ISysRoleService
|
|
|
@Autowired
|
|
|
private SysRoleDeptMapper roleDeptMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private SysUserMapper userMapper;
|
|
|
+
|
|
|
/**
|
|
|
* 根据条件分页查询角色数据
|
|
|
*
|
|
@@ -46,8 +46,11 @@ public class SysRoleServiceImpl implements ISysRoleService
|
|
|
@DataScope(deptAlias = "d")
|
|
|
public List<SysRole> selectRoleList(SysRole role)
|
|
|
{
|
|
|
- String createByOne = SecurityUtils.getLoginUser().getUser().getUserName();
|
|
|
- role.setCreateByOne(createByOne);
|
|
|
+// String createByOne = SecurityUtils.getLoginUser().getUser().getUserName();
|
|
|
+// role.setCreateByOne(createByOne);
|
|
|
+ Long userId = SecurityUtils.getLoginUser().getUser().getUserId();
|
|
|
+ List<SysUser> sysMenuList = userMapper.getTenantId(userId);
|
|
|
+ role.setTenantId(sysMenuList.get(0).getTenantId());
|
|
|
return roleMapper.selectRoleList(role);
|
|
|
}
|
|
|
|
|
@@ -204,6 +207,9 @@ public class SysRoleServiceImpl implements ISysRoleService
|
|
|
@Transactional
|
|
|
public int insertRole(SysRole role)
|
|
|
{
|
|
|
+ Long userId = SecurityUtils.getLoginUser().getUser().getUserId();
|
|
|
+ List<SysUser> sysMenuList = userMapper.getTenantId(userId);
|
|
|
+ role.setTenantId(sysMenuList.get(0).getTenantId());
|
|
|
// 新增角色信息
|
|
|
roleMapper.insertRole(role);
|
|
|
return insertRoleMenu(role);
|