|
@@ -113,17 +113,13 @@ public class MybatisDefaultParameterHandler extends DefaultParameterHandler {
|
|
|
if (tableInfo != null) {
|
|
|
MetaObject metaObject = ms.getConfiguration().newMetaObject(parameterObject);
|
|
|
if (SqlCommandType.INSERT == ms.getSqlCommandType()) {
|
|
|
- // input none 且id为空 或者 无主键放入insert填充
|
|
|
// 使用insert填充
|
|
|
if (tableInfo.isWithInsertFill()) {
|
|
|
handlerFill(ms, metaObject, tableInfo);
|
|
|
} else {
|
|
|
- // 兼容旧操作
|
|
|
String keyProperty = tableInfo.getKeyProperty();
|
|
|
- //无主键的要兼容旧的骚操作,只能走完insert填充
|
|
|
- if (StringUtils.isBlank(keyProperty)) {
|
|
|
- handlerFill(ms, metaObject, tableInfo);
|
|
|
- } else {
|
|
|
+ if (StringUtils.isNotBlank(keyProperty)) {
|
|
|
+ // 兼容旧操作 id类型为input或none的要用填充器处理一下
|
|
|
Object value = metaObject.getValue(keyProperty);
|
|
|
if (value == null && (IdType.NONE == tableInfo.getIdType() || IdType.INPUT == tableInfo.getIdType())) {
|
|
|
handlerFill(ms, metaObject, tableInfo);
|