From 25836328835ca4f017658ab546b654a5e5b92c09 Mon Sep 17 00:00:00 2001 From: 疯狂的狮子Li <15040126243@163.com> Date: 星期四, 25 四月 2024 12:50:42 +0800 Subject: [PATCH] update springboot 3.2.4 => 3.2.5 update mybatis-plus 3.5.5 => 3.5.6 适配更改代码 update springdoc 2.4.0 => 2.5.0 update easyexcel 3.3.3 => 3.3.4 update redisson 3.27.2 => 3.29.0 update lombok 1.18.30 => 1.18.32 update sms4j 3.2.0 => 3.2.1 --- ruoyi-common/ruoyi-common-mybatis/src/main/java/org/dromara/common/mybatis/core/mapper/BaseMapperPlus.java | 21 ++++++++++++++++----- 1 files changed, 16 insertions(+), 5 deletions(-) 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 b2b74a0..08723f6 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 @@ -6,12 +6,12 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.core.toolkit.ReflectionKit; +import com.baomidou.mybatisplus.core.toolkit.reflect.GenericTypeUtils; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.toolkit.Db; -import org.dromara.common.core.utils.MapstructUtils; import org.apache.ibatis.logging.Log; import org.apache.ibatis.logging.LogFactory; +import org.dromara.common.core.utils.MapstructUtils; import java.io.Serializable; import java.util.Collection; @@ -35,11 +35,11 @@ Log log = LogFactory.getLog(BaseMapperPlus.class); default Class<V> currentVoClass() { - return (Class<V>) ReflectionKit.getSuperClassGenericType(this.getClass(), BaseMapperPlus.class, 1); + return (Class<V>) GenericTypeUtils.resolveTypeArguments(this.getClass(), BaseMapperPlus.class)[1]; } default Class<T> currentModelClass() { - return (Class<T>) ReflectionKit.getSuperClassGenericType(this.getClass(), BaseMapperPlus.class, 0); + return (Class<T>) GenericTypeUtils.resolveTypeArguments(this.getClass(), BaseMapperPlus.class)[0]; } default List<T> selectList() { @@ -144,11 +144,22 @@ return selectVoOne(wrapper, this.currentVoClass()); } + default V selectVoOne(Wrapper<T> wrapper, boolean throwEx) { + return selectVoOne(wrapper, this.currentVoClass(), throwEx); + } + /** * 鏍规嵁 entity 鏉′欢锛屾煡璇竴鏉¤褰� */ default <C> C selectVoOne(Wrapper<T> wrapper, Class<C> voClass) { - T obj = this.selectOne(wrapper); + return selectVoOne(wrapper, voClass, true); + } + + /** + * 鏍规嵁 entity 鏉′欢锛屾煡璇竴鏉¤褰� + */ + default <C> C selectVoOne(Wrapper<T> wrapper, Class<C> voClass, boolean throwEx) { + T obj = this.selectOne(wrapper, throwEx); if (ObjectUtil.isNull(obj)) { return null; } -- Gitblit v1.9.3