Revert "!734 update 重写selectOne方法"

This reverts commit f2e0361fb6.
master
疯狂的狮子Li 4 months ago
parent 655e84012c
commit 2258962770

@ -6,11 +6,9 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
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.Constants;
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.apache.ibatis.annotations.Param;
import org.apache.ibatis.logging.Log;
import org.apache.ibatis.logging.LogFactory;
import org.dromara.common.core.utils.MapstructUtils;
@ -132,7 +130,7 @@ public interface BaseMapperPlus<T, V> extends BaseMapper<T> {
* @return VO
*/
default V selectVoById(Serializable id) {
return this.selectVoById(id, this.currentVoClass());
return selectVoById(id, this.currentVoClass());
}
/**
@ -158,7 +156,7 @@ public interface BaseMapperPlus<T, V> extends BaseMapper<T> {
* @return VO
*/
default List<V> selectVoByIds(Collection<? extends Serializable> idList) {
return this.selectVoByIds(idList, this.currentVoClass());
return selectVoByIds(idList, this.currentVoClass());
}
/**
@ -184,7 +182,7 @@ public interface BaseMapperPlus<T, V> extends BaseMapper<T> {
* @return VO
*/
default List<V> selectVoByMap(Map<String, Object> map) {
return this.selectVoByMap(map, this.currentVoClass());
return selectVoByMap(map, this.currentVoClass());
}
/**
@ -210,7 +208,7 @@ public interface BaseMapperPlus<T, V> extends BaseMapper<T> {
* @return VO
*/
default V selectVoOne(Wrapper<T> wrapper) {
return this.selectVoOne(wrapper, this.currentVoClass());
return selectVoOne(wrapper, this.currentVoClass());
}
/**
@ -221,7 +219,7 @@ public interface BaseMapperPlus<T, V> extends BaseMapper<T> {
* @return VO
*/
default V selectVoOne(Wrapper<T> wrapper, boolean throwEx) {
return this.selectVoOne(wrapper, this.currentVoClass(), throwEx);
return selectVoOne(wrapper, this.currentVoClass(), throwEx);
}
/**
@ -233,7 +231,7 @@ public interface BaseMapperPlus<T, V> extends BaseMapper<T> {
* @return VOVO
*/
default <C> C selectVoOne(Wrapper<T> wrapper, Class<C> voClass) {
return this.selectVoOne(wrapper, voClass, true);
return selectVoOne(wrapper, voClass, true);
}
/**
@ -253,33 +251,13 @@ public interface BaseMapperPlus<T, V> extends BaseMapper<T> {
return MapstructUtils.convert(obj, voClass);
}
/**
* 1 {@code throwEx}
*
* <p>
* <strong></strong>
* 1. 使 {@code Page<>(1, 1)} SQL {@code LIMIT 1} {@code throwEx}
* 2. {@code throwEx}
* </p>
*
* @param queryWrapper null
* @param throwEx <del></del>
* @return null
*/
@Override
default T selectOne(@Param(Constants.WRAPPER) Wrapper<T> queryWrapper, boolean throwEx) {
// 强制分页查询LIMIT 1确保最多返回 1 条记录
List<T> list = this.selectList(new Page<>(1, 1), queryWrapper);
return CollUtil.isEmpty(list) ? null : list.get(0);
}
/**
* VO
*
* @return VO
*/
default List<V> selectVoList() {
return this.selectVoList(new QueryWrapper<>(), this.currentVoClass());
return selectVoList(new QueryWrapper<>(), this.currentVoClass());
}
/**
@ -316,7 +294,7 @@ public interface BaseMapperPlus<T, V> extends BaseMapper<T> {
* @return VO
*/
default <P extends IPage<V>> P selectVoPage(IPage<T> page, Wrapper<T> wrapper) {
return this.selectVoPage(page, wrapper, this.currentVoClass());
return selectVoPage(page, wrapper, this.currentVoClass());
}
/**

Loading…
Cancel
Save