From 36af846a3673a110fd7b6e1af1918d435d64454a Mon Sep 17 00:00:00 2001 From: DaxPay Dev Date: Fri, 10 Jul 2026 17:00:39 +0800 Subject: [PATCH] =?UTF-8?q?feat(mybatis):=20BaseManager=20=E6=8F=90?= =?UTF-8?q?=E4=BE=9B=20findByIdNotTenant=20=E9=80=9A=E7=94=A8=E5=BF=BD?= =?UTF-8?q?=E7=95=A5=E7=A7=9F=E6=88=B7=E4=B8=BB=E9=94=AE=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 运行态认证/支付解析等无租户上下文场景可直接使用,避免各 Manager 重复包装 findById + @IgnoreTenant。 --- .../platform/common/mybatisplus/impl/BaseManager.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/daxpay-platform/daxpay-platform-common/common-mybatis-plus/src/main/java/cn/daxpay/open/platform/common/mybatisplus/impl/BaseManager.java b/daxpay-platform/daxpay-platform-common/common-mybatis-plus/src/main/java/cn/daxpay/open/platform/common/mybatisplus/impl/BaseManager.java index 10cb800f4..483db0ae8 100644 --- a/daxpay-platform/daxpay-platform-common/common-mybatis-plus/src/main/java/cn/daxpay/open/platform/common/mybatisplus/impl/BaseManager.java +++ b/daxpay-platform/daxpay-platform-common/common-mybatis-plus/src/main/java/cn/daxpay/open/platform/common/mybatisplus/impl/BaseManager.java @@ -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, T> { return Optional.ofNullable(baseMapper.selectById(id)); } + /// 按主键查询(忽略租户隔离) + /// + /// 运行态认证/支付解析/网关引导等无租户上下文时使用;配置态 CRUD 请用 [findById]。 + /// 须经 Spring 注入的 Manager Bean 外部调用(同类 this 自调用不走 AOP)。 + @IgnoreTenant + public Optional findByIdNotTenant(Serializable id) { + return findById(id); + } + /// 根据字段查询唯一值 /// @param field 字段 /// @param fieldValue 字段数据