fix(tenant-withdraw): 增加下级租户提现订单数据权限过滤
This commit is contained in:
@@ -111,4 +111,7 @@ public class KeyboardTenantWithdrawOrderPageReqVO extends PageParam {
|
||||
@Schema(description = "更新时间")
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
@Schema(description = "租户ID列表(用于下级租户过滤)", hidden = true)
|
||||
private List<Long> tenantIds;
|
||||
|
||||
}
|
||||
@@ -19,6 +19,7 @@ public interface KeyboardTenantWithdrawOrderMapper extends BaseMapperX<KeyboardT
|
||||
|
||||
default PageResult<KeyboardTenantWithdrawOrderDO> selectPage(KeyboardTenantWithdrawOrderPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<KeyboardTenantWithdrawOrderDO>()
|
||||
.inIfPresent(KeyboardTenantWithdrawOrderDO::getTenantId, reqVO.getTenantIds())
|
||||
.eqIfPresent(KeyboardTenantWithdrawOrderDO::getWithdrawNo, reqVO.getWithdrawNo())
|
||||
.eqIfPresent(KeyboardTenantWithdrawOrderDO::getBizNo, reqVO.getBizNo())
|
||||
.eqIfPresent(KeyboardTenantWithdrawOrderDO::getCurrency, reqVO.getCurrency())
|
||||
|
||||
@@ -7,9 +7,11 @@ import com.yolo.keyboard.dal.dataobject.tenantwithdraworder.KeyboardTenantWithdr
|
||||
import com.yolo.keyboard.dal.mysql.tenantwithdraworder.KeyboardTenantWithdrawOrderMapper;
|
||||
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
||||
import com.yolo.keyboard.framework.common.util.object.BeanUtils;
|
||||
import com.yolo.keyboard.framework.tenant.core.context.TenantContextHolder;
|
||||
import com.yolo.keyboard.module.system.dal.dataobject.tenant.TenantDO;
|
||||
import com.yolo.keyboard.module.system.dal.mysql.tenant.TenantMapper;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -84,6 +86,26 @@ public class KeyboardTenantWithdrawOrderServiceImpl implements KeyboardTenantWit
|
||||
|
||||
@Override
|
||||
public PageResult<KeyboardTenantWithdrawOrderRespVO> getTenantWithdrawOrderPage(KeyboardTenantWithdrawOrderPageReqVO pageReqVO) {
|
||||
// 根据当前租户级别过滤下级租户的提现申请
|
||||
Long currentTenantId = TenantContextHolder.getTenantId();
|
||||
if (currentTenantId != null) {
|
||||
TenantDO currentTenant = tenantMapper.selectById(currentTenantId);
|
||||
if (currentTenant != null && currentTenant.getTenantLevel() != null
|
||||
&& currentTenant.getTenantLevel() != 0) {
|
||||
// 非系统管理员:只能查看直属下级租户的提现申请
|
||||
List<TenantDO> subordinateTenants = tenantMapper.selectList(
|
||||
new LambdaQueryWrapper<TenantDO>().eq(TenantDO::getParentId, currentTenantId));
|
||||
List<Long> subordinateTenantIds = subordinateTenants.stream()
|
||||
.map(TenantDO::getId)
|
||||
.collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(subordinateTenantIds)) {
|
||||
// 没有下级租户,返回空结果
|
||||
return PageResult.empty(0L);
|
||||
}
|
||||
pageReqVO.setTenantIds(subordinateTenantIds);
|
||||
}
|
||||
}
|
||||
|
||||
// 分页查询租户提现订单数据
|
||||
PageResult<KeyboardTenantWithdrawOrderDO> pageResult = tenantWithdrawOrderMapper.selectPage(pageReqVO);
|
||||
if (CollUtil.isEmpty(pageResult.getList())) {
|
||||
|
||||
Reference in New Issue
Block a user