mirror of
https://gitee.com/ssssssss-team/magic-api.git
synced 2026-05-18 22:26:16 +08:00
优化单表API中insert接口,在驱动不支持返回主键时返回设定的主键值。
This commit is contained in:
@@ -258,7 +258,11 @@ public class NamedTable extends Attributes<Object> {
|
||||
builder.append(") values (");
|
||||
builder.append(StringUtils.join(Collections.nCopies(entries.size(), "?"), ","));
|
||||
builder.append(")");
|
||||
return sqlModule.insert(new BoundSql(runtimeContext, builder.toString(), entries.stream().map(Map.Entry::getValue).collect(Collectors.toList()), sqlModule), this.primary);
|
||||
Object value = sqlModule.insert(new BoundSql(runtimeContext, builder.toString(), entries.stream().map(Map.Entry::getValue).collect(Collectors.toList()), sqlModule), this.primary);
|
||||
if(value == null && StringUtils.isNotBlank(this.primary)){
|
||||
return this.columns.get(this.primary);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
@Comment("执行delete语句")
|
||||
|
||||
Reference in New Issue
Block a user