错误提示

This commit is contained in:
yulichang 2022-12-16 17:29:37 +08:00
parent 09e8037ff1
commit f558466fb2
4 changed files with 9 additions and 6 deletions

View File

@ -33,7 +33,7 @@ public class LogicInfoUtils implements Constants {
private static String getLogicStr(String tableIndex, Class<?> clazz) {
String logicStr;
TableInfo tableInfo = TableInfoHelper.getTableInfo(clazz);
Assert.notNull(tableInfo, "%s 不是数据库实体或没有注册到mybatis plus中", clazz.getName());
Assert.notNull(tableInfo, "table not find by class <%s>", clazz.getSimpleName());
if (tableInfo.isWithLogicDelete() && Objects.nonNull(tableInfo.getLogicDeleteFieldInfo())) {
final String value = tableInfo.getLogicDeleteFieldInfo().getLogicNotDeleteValue();
if (NULL.equalsIgnoreCase(value)) {

View File

@ -2,11 +2,9 @@ package com.github.yulichang.wrapper;
import com.baomidou.mybatisplus.core.conditions.SharedString;
import com.baomidou.mybatisplus.core.conditions.segments.MergeSegments;
import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.baomidou.mybatisplus.core.metadata.TableInfoHelper;
import com.baomidou.mybatisplus.core.toolkit.ArrayUtils;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.*;
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import com.github.yulichang.config.ConfigProperties;
import com.github.yulichang.toolkit.Constant;
@ -202,7 +200,9 @@ public class MPJLambdaWrapper<T> extends MPJAbstractLambdaWrapper<T, MPJLambdaWr
if (StringUtils.isBlank(from.getStringValue())) {
StringBuilder value = new StringBuilder();
for (MPJLambdaWrapper<?> wrapper : onWrappers) {
String tableName = TableInfoHelper.getTableInfo(wrapper.getJoinClass()).getTableName();
TableInfo info = TableInfoHelper.getTableInfo(wrapper.getJoinClass());
Assert.notNull(info, "table not find by class <%s>", wrapper.getJoinClass().getSimpleName());
String tableName = info.getTableName();
value.append(StringPool.SPACE)
.append(wrapper.getKeyWord())
.append(StringPool.SPACE)

View File

@ -3,6 +3,7 @@ package com.github.yulichang.wrapper.interfaces;
import com.baomidou.mybatisplus.core.metadata.TableFieldInfo;
import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.baomidou.mybatisplus.core.metadata.TableInfoHelper;
import com.baomidou.mybatisplus.core.toolkit.Assert;
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import com.github.yulichang.toolkit.LambdaUtils;
import com.github.yulichang.toolkit.MPJReflectionKit;
@ -48,6 +49,7 @@ public interface Query<Children> extends Serializable {
*/
default <E> Children select(Class<E> entityClass, Predicate<TableFieldInfo> predicate) {
TableInfo info = TableInfoHelper.getTableInfo(entityClass);
Assert.notNull(info, "table not find by class <%s>", entityClass.getSimpleName());
Map<String, SelectCache> cacheMap = ColumnCache.getMapField(entityClass);
info.getFieldList().stream().filter(predicate).collect(Collectors.toList()).forEach(
i -> getSelectColum().add(new SelectNormal(cacheMap.get(i.getProperty()), getIndex())));

View File

@ -212,6 +212,7 @@ public class MybatisLabel<E, T> {
private void autoBuild(boolean auto, Class<E> entityClass, Class<T> tagClass) {
TableInfo tableInfo = TableInfoHelper.getTableInfo(entityClass);
Assert.notNull(tableInfo, "table not find by class <%s>", entityClass.getSimpleName());
Map<String, Field> tagMap = MPJReflectionKit.getFieldMap(tagClass);
if (auto && !tagMap.isEmpty()) {
List<SelectCache> listField = ColumnCache.getListField(entityClass);