fix 迁移后系统问题修改
parent
a5129fdc25
commit
ba417747c5
@ -0,0 +1,35 @@
|
|||||||
|
package org.dromara.auth.domain.convert;
|
||||||
|
|
||||||
|
import org.dromara.auth.domain.vo.TenantListVo;
|
||||||
|
import org.dromara.system.api.domain.vo.RemoteTenantVo;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户vo转换器
|
||||||
|
* @author zhujie
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface TenantVoConvert {
|
||||||
|
|
||||||
|
TenantVoConvert INSTANCE = Mappers.getMapper(TenantVoConvert.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RemoteTenantVoToTenantListVo
|
||||||
|
* @param remoteTenantVo 待转换对象
|
||||||
|
* @return 转换后对象
|
||||||
|
*/
|
||||||
|
TenantListVo convert(RemoteTenantVo remoteTenantVo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RemoteTenantVoToTenantListVo
|
||||||
|
* @param remoteTenantVo 待转换对象
|
||||||
|
* @return 转换后对象
|
||||||
|
*/
|
||||||
|
List<TenantListVo> convertList(List<RemoteTenantVo> remoteTenantVo);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -1,54 +0,0 @@
|
|||||||
package org.dromara.system.domain;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 当前在线会话
|
|
||||||
*
|
|
||||||
* @author Lion Li
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class SysUserOnline {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 会话编号
|
|
||||||
*/
|
|
||||||
private String tokenId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 部门名称
|
|
||||||
*/
|
|
||||||
private String deptName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户名称
|
|
||||||
*/
|
|
||||||
private String userName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 登录IP地址
|
|
||||||
*/
|
|
||||||
private String ipaddr;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 登录地址
|
|
||||||
*/
|
|
||||||
private String loginLocation;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 浏览器类型
|
|
||||||
*/
|
|
||||||
private String browser;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 操作系统
|
|
||||||
*/
|
|
||||||
private String os;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 登录时间
|
|
||||||
*/
|
|
||||||
private Long loginTime;
|
|
||||||
|
|
||||||
}
|
|
@ -1,26 +0,0 @@
|
|||||||
package org.dromara.system.service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通用 数据权限 服务
|
|
||||||
*
|
|
||||||
* @author Lion Li
|
|
||||||
*/
|
|
||||||
public interface ISysDataScopeService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取角色自定义权限
|
|
||||||
*
|
|
||||||
* @param roleId 角色id
|
|
||||||
* @return 部门id组
|
|
||||||
*/
|
|
||||||
String getRoleCustom(Long roleId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取部门及以下权限
|
|
||||||
*
|
|
||||||
* @param deptId 部门id
|
|
||||||
* @return 部门id组
|
|
||||||
*/
|
|
||||||
String getDeptAndChild(Long deptId);
|
|
||||||
|
|
||||||
}
|
|
@ -1,61 +0,0 @@
|
|||||||
package org.dromara.system.service.impl;
|
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
|
||||||
import cn.hutool.core.convert.Convert;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.dromara.common.core.utils.StreamUtils;
|
|
||||||
import org.dromara.common.mybatis.helper.DataBaseHelper;
|
|
||||||
import org.dromara.system.domain.SysDept;
|
|
||||||
import org.dromara.system.domain.SysRoleDept;
|
|
||||||
import org.dromara.system.mapper.SysDeptMapper;
|
|
||||||
import org.dromara.system.mapper.SysRoleDeptMapper;
|
|
||||||
import org.dromara.system.service.ISysDataScopeService;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 数据权限 实现
|
|
||||||
* <p>
|
|
||||||
* 注意: 此Service内不允许调用标注`数据权限`注解的方法
|
|
||||||
* 例如: deptMapper.selectList 此 selectList 方法标注了`数据权限`注解 会出现循环解析的问题
|
|
||||||
*
|
|
||||||
* @author Lion Li
|
|
||||||
*/
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
@Service("sdss")
|
|
||||||
public class SysDataScopeServiceImpl implements ISysDataScopeService {
|
|
||||||
|
|
||||||
private final SysRoleDeptMapper roleDeptMapper;
|
|
||||||
private final SysDeptMapper deptMapper;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getRoleCustom(Long roleId) {
|
|
||||||
List<SysRoleDept> list = roleDeptMapper.selectList(
|
|
||||||
new LambdaQueryWrapper<SysRoleDept>()
|
|
||||||
.select(SysRoleDept::getDeptId)
|
|
||||||
.eq(SysRoleDept::getRoleId, roleId));
|
|
||||||
if (CollUtil.isNotEmpty(list)) {
|
|
||||||
return StreamUtils.join(list, rd -> Convert.toStr(rd.getDeptId()));
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getDeptAndChild(Long deptId) {
|
|
||||||
List<SysDept> deptList = deptMapper.selectList(new LambdaQueryWrapper<SysDept>()
|
|
||||||
.select(SysDept::getDeptId)
|
|
||||||
.apply(DataBaseHelper.findInSet(deptId, "ancestors")));
|
|
||||||
List<Long> ids = StreamUtils.toList(deptList, SysDept::getDeptId);
|
|
||||||
ids.add(deptId);
|
|
||||||
List<SysDept> list = deptMapper.selectList(new LambdaQueryWrapper<SysDept>()
|
|
||||||
.select(SysDept::getDeptId)
|
|
||||||
.in(SysDept::getDeptId, ids));
|
|
||||||
if (CollUtil.isNotEmpty(list)) {
|
|
||||||
return StreamUtils.join(list, d -> Convert.toStr(d.getDeptId()));
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue