mirror of
https://gitee.com/dromara/dax-pay
synced 2026-08-08 14:15:34 +08:00
feat(mybatis): BaseManager 提供 findByIdNotTenant 通用忽略租户主键查询
运行态认证/支付解析等无租户上下文场景可直接使用,避免各 Manager 重复包装 findById + @IgnoreTenant。
This commit is contained in:
@@ -2,6 +2,7 @@ package cn.daxpay.open.platform.common.mybatisplus.impl;
|
||||
|
||||
import cn.daxpay.open.platform.common.mybatisplus.extension.DaxLambdaQueryChainWrapper;
|
||||
import cn.daxpay.open.platform.common.mybatisplus.util.MpUtil;
|
||||
import cn.daxpay.open.platform.core.annotation.IgnoreTenant;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.enums.SqlMethod;
|
||||
@@ -268,6 +269,15 @@ public class BaseManager<M extends MPJBaseMapper<T>, T> {
|
||||
return Optional.ofNullable(baseMapper.selectById(id));
|
||||
}
|
||||
|
||||
/// 按主键查询(忽略租户隔离)
|
||||
///
|
||||
/// 运行态认证/支付解析/网关引导等无租户上下文时使用;配置态 CRUD 请用 [findById]。
|
||||
/// 须经 Spring 注入的 Manager Bean 外部调用(同类 this 自调用不走 AOP)。
|
||||
@IgnoreTenant
|
||||
public Optional<T> findByIdNotTenant(Serializable id) {
|
||||
return findById(id);
|
||||
}
|
||||
|
||||
/// 根据字段查询唯一值
|
||||
/// @param field 字段
|
||||
/// @param fieldValue 字段数据
|
||||
|
||||
Reference in New Issue
Block a user