数据权限的bug修改260113

This commit is contained in:
1745237360-cloud
2026-01-13 11:32:57 +08:00
parent 935c154136
commit 035593b419
5 changed files with 34 additions and 9 deletions
@@ -146,10 +146,12 @@ public class UserShipperApplicationService {
// 前端传递了 organizationId,使用前端传递的值进行过滤
userShipperDO.setOrganizationId(frontendOrganizationId);
userShipperDO.setTopOrganizationId(null);
log.info("托运人列表查询 - 南光组织查询指定组织:organizationId={}", frontendOrganizationId);
} else {
// 前端没有传递 organizationId,清空组织过滤条件,查询所有组织的数据
userShipperDO.setOrganizationId(null);
userShipperDO.setTopOrganizationId(null);
log.info("托运人列表查询 - 南光组织查询所有组织:不设置组织过滤条件");
}
} else {
// 其他组织:设置 organizationId,只查询当前组织的数据
@@ -177,6 +179,9 @@ public class UserShipperApplicationService {
}
}
log.info("托运人列表查询 - 设置组织ID后,查询参数:organizationId={}, topOrganizationId={}, userId={}",
userShipperDO.getOrganizationId(), userShipperDO.getTopOrganizationId(), userShipperDO.getUserId());
List<UserShipperPo> userShipperList = userShipperDomainService.userShipperList(userShipperDO);
return processShipperList(userShipperList);
}
@@ -54,8 +54,14 @@ public class UserShipperDomainService {
//获取当前登陆人
LoginUser loginUser = SecurityUtils.getLoginUser();
// 如果 organizationId 和 topOrganizationId 都为 null,表示查询所有组织的数据(南光组织查询全部)
// 此时不应该设置 userId 过滤条件,否则会限制查询结果
boolean isQueryAllOrganizations = (userShipperDO.getOrganizationId() == null && userShipperDO.getTopOrganizationId() == null);
if(loginUser != null && loginUser.getUserPo() != null &&
(loginUser.getUserPo().getBusinessType()==1||loginUser.getUserPo().getBusinessType()==3||loginUser.getUserPo().getUserAccountType()==5)){
(loginUser.getUserPo().getBusinessType()==1||loginUser.getUserPo().getBusinessType()==3||loginUser.getUserPo().getUserAccountType()==5) &&
!isQueryAllOrganizations) {
// 只有在不是查询所有组织的情况下,才设置 userId 过滤条件
userShipperDO.setUserId(loginUser.getUserid());
}
return userShipperRepositoryInterface.selectList(userShipperDO);