Skip to content

Commit

Permalink
修复数据变动插件更新无主键报错.
Browse files Browse the repository at this point in the history
  • Loading branch information
nieqiurong committed Jan 10, 2025
1 parent 1946656 commit 7ffc2e5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import java.util.concurrent.ConcurrentHashMap;

import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import net.sf.jsqlparser.statement.select.Values;
import org.apache.ibatis.executor.statement.StatementHandler;
import org.apache.ibatis.mapping.BoundSql;
Expand Down Expand Up @@ -663,7 +664,7 @@ private Columns2SelectItemsResult buildColumns2SelectItems(String tableName, Lis
selectItems.add(new SelectItem<>(column));
}
TableInfo tableInfo = getTableInfoByTableName(tableName);
if (tableInfo == null) {
if (tableInfo == null || StringUtils.isBlank(tableInfo.getKeyColumn())) {
return Columns2SelectItemsResult.build(selectItems, 0);
}
Column pk = new Column(tableInfo.getKeyColumn());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import java.util.concurrent.ConcurrentHashMap;

import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import net.sf.jsqlparser.statement.select.Values;
import org.apache.ibatis.executor.statement.StatementHandler;
import org.apache.ibatis.mapping.BoundSql;
Expand Down Expand Up @@ -663,7 +664,7 @@ private Columns2SelectItemsResult buildColumns2SelectItems(String tableName, Lis
selectItems.add(new SelectItem<>(column));
}
TableInfo tableInfo = getTableInfoByTableName(tableName);
if (tableInfo == null) {
if (tableInfo == null || StringUtils.isBlank(tableInfo.getKeyColumn())) {
return Columns2SelectItemsResult.build(selectItems, 0);
}
Column pk = new Column(tableInfo.getKeyColumn());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import java.util.concurrent.ConcurrentHashMap;

import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import net.sf.jsqlparser.statement.select.Values;
import org.apache.ibatis.executor.statement.StatementHandler;
import org.apache.ibatis.mapping.BoundSql;
Expand Down Expand Up @@ -663,7 +664,7 @@ private Columns2SelectItemsResult buildColumns2SelectItems(String tableName, Lis
selectItems.add(new SelectItem<>(column));
}
TableInfo tableInfo = getTableInfoByTableName(tableName);
if (tableInfo == null) {
if (tableInfo == null || StringUtils.isBlank(tableInfo.getKeyColumn())) {
return Columns2SelectItemsResult.build(selectItems, 0);
}
Column pk = new Column(tableInfo.getKeyColumn());
Expand Down

0 comments on commit 7ffc2e5

Please sign in to comment.