[重大更新] 集成 mybatis-plus-join 重构项目代码(实验性功能不稳定)

This commit is contained in:
疯狂的狮子Li
2026-03-13 17:46:23 +08:00
parent 068e2de831
commit 916282ba68
28 changed files with 585 additions and 553 deletions

View File

@@ -4,11 +4,11 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.reflect.GenericTypeUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.github.yulichang.base.MPJBaseMapper;
import org.apache.ibatis.logging.Log;
import org.apache.ibatis.logging.LogFactory;
import org.dromara.common.core.utils.MapstructUtils;
@@ -29,7 +29,7 @@ import java.util.function.Function;
* @since 2021-05-13
*/
@SuppressWarnings("unchecked")
public interface BaseMapperPlus<T, V> extends BaseMapper<T> {
public interface BaseMapperPlus<T, V> extends MPJBaseMapper<T> {
Log log = LogFactory.getLog(BaseMapperPlus.class);

View File

@@ -198,13 +198,22 @@ public class PlusDataPermissionHandler {
if (!access.constrained()) {
return roles;
}
Map<Long, RoleDTO> allRoleMap = new LinkedHashMap<>();
if (CollUtil.isNotEmpty(roles)) {
roles.forEach(role -> allRoleMap.put(role.getRoleId(), role));
}
Map<Long, RoleDTO> roleMap = new LinkedHashMap<>();
Map<String, List<RoleDTO>> dataScopeRoleMap = user.getDataScopeRoleMap();
Map<String, List<Long>> dataScopeRoleMap = user.getDataScopeRoleMap();
if (CollUtil.isNotEmpty(dataScopeRoleMap)) {
access.perms().forEach(perm -> {
List<RoleDTO> roleList = dataScopeRoleMap.get(perm);
if (CollUtil.isNotEmpty(roleList)) {
roleList.forEach(role -> roleMap.putIfAbsent(role.getRoleId(), role));
List<Long> roleIds = dataScopeRoleMap.get(perm);
if (CollUtil.isNotEmpty(roleIds)) {
roleIds.forEach(roleId -> {
RoleDTO role = allRoleMap.get(roleId);
if (role != null) {
roleMap.putIfAbsent(role.getRoleId(), role);
}
});
}
});
}