From 654b84f4f2eea5b7459f2659e26a897727fbde98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=8B=E8=BE=9E=E6=9C=AA=E5=AF=92?= <545073804@qq.com> Date: Sun, 7 Apr 2024 09:31:58 +0000 Subject: [PATCH] =?UTF-8?q?!510=20add=20BaseMapperPlus=E6=8F=90=E4=BE=9B?= =?UTF-8?q?=E4=B8=80=E7=BB=84=E5=8F=AF=E9=80=89=E6=98=AF=E5=90=A6=E6=8A=9B?= =?UTF-8?q?=E5=87=BA=E5=BC=82=E5=B8=B8=E7=9A=84selectVoOne=E6=96=B9?= =?UTF-8?q?=E6=B3=95=20*=20add=20BaseMapperPlus=E6=8F=90=E4=BE=9B=E4=B8=80?= =?UTF-8?q?=E7=BB=84=E5=8F=AF=E9=80=89=E6=98=AF=E5=90=A6=E6=8A=9B=E5=87=BA?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E7=9A=84selectVoOne=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/mybatis/core/mapper/BaseMapperPlus.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ruoyi-common/ruoyi-common-mybatis/src/main/java/org/dromara/common/mybatis/core/mapper/BaseMapperPlus.java b/ruoyi-common/ruoyi-common-mybatis/src/main/java/org/dromara/common/mybatis/core/mapper/BaseMapperPlus.java index 2e6208196..08723f608 100644 --- a/ruoyi-common/ruoyi-common-mybatis/src/main/java/org/dromara/common/mybatis/core/mapper/BaseMapperPlus.java +++ b/ruoyi-common/ruoyi-common-mybatis/src/main/java/org/dromara/common/mybatis/core/mapper/BaseMapperPlus.java @@ -144,11 +144,22 @@ public interface BaseMapperPlus extends BaseMapper { return selectVoOne(wrapper, this.currentVoClass()); } + default V selectVoOne(Wrapper wrapper, boolean throwEx) { + return selectVoOne(wrapper, this.currentVoClass(), throwEx); + } + /** * 根据 entity 条件,查询一条记录 */ default C selectVoOne(Wrapper wrapper, Class voClass) { - T obj = this.selectOne(wrapper); + return selectVoOne(wrapper, voClass, true); + } + + /** + * 根据 entity 条件,查询一条记录 + */ + default C selectVoOne(Wrapper wrapper, Class voClass, boolean throwEx) { + T obj = this.selectOne(wrapper, throwEx); if (ObjectUtil.isNull(obj)) { return null; }