Skip to content

Commit f836f7b

Browse files
committed
fix: saveOrUpdate逻辑优化,支持查询数据库中的记录,设置主键错误
1 parent 7c81972 commit f836f7b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/app/myoss/cloud/mybatis/repository/service/impl/BaseCrudServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ public <I> Result<I> saveOrUpdate(T record, Object optionParam) {
659659
}
660660
T exist = exists.get(0);
661661
if (exist != null) {
662-
primaryKeyValue = getPrimaryKeyValue(record, result);
662+
primaryKeyValue = getPrimaryKeyValue(exist, result);
663663
setPrimaryKeyValue(record, primaryKeyValue.getValue());
664664
Result<Boolean> updateResult = updateByPrimaryKey(record, optionParam);
665665
result.setSuccess(updateResult.isSuccess())

0 commit comments

Comments
 (0)