Skip to content

Commit

Permalink
修改新增方法名称.
Browse files Browse the repository at this point in the history
  • Loading branch information
nieqiurong committed Jun 8, 2024
1 parent 95ae900 commit c379b64
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ default <P extends IPage<Map<String, Object>>> P selectMapsPage(P page, @Param(C
* @param entity 实体对象 (不能为空)
* @since 3.5.7
*/
default boolean saveOrUpdate(T entity) {
default boolean insertOrUpdate(T entity) {
Class<?> entityClass = GenericTypeUtils.resolveTypeArguments(getClass(), BaseMapper.class)[0];
TableInfo tableInfo = TableInfoHelper.getTableInfo(entityClass);
Assert.notNull(tableInfo, "error: can not execute. because can not find cache of TableInfo for entity!");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ protected String getSqlStatement(SqlMethod sqlMethod) {
*/
@Override
public boolean saveOrUpdate(T entity) {
return getBaseMapper().saveOrUpdate(entity);
return getBaseMapper().insertOrUpdate(entity);
}

@Transactional(rollbackFor = Exception.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public static <T> boolean saveOrUpdate(T entity) {
if (Objects.isNull(entity)) {
return false;
}
return SqlHelper.execute(getEntityClass(entity), baseMapper -> baseMapper.saveOrUpdate(entity));
return SqlHelper.execute(getEntityClass(entity), baseMapper -> baseMapper.insertOrUpdate(entity));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -538,11 +538,11 @@ void testUpdateByWrapper() {
@Test
void testSaveOrUpdate() {
var h2User = new H2User();
userMapper.saveOrUpdate(h2User);
userMapper.insertOrUpdate(h2User);
Assertions.assertNotNull(h2User.getTestId());
Assertions.assertNull(h2User.getLastUpdatedDt());
h2User.setName("test");
userMapper.saveOrUpdate(h2User);
userMapper.insertOrUpdate(h2User);
Assertions.assertNotNull(h2User.getLastUpdatedDt());
}

Expand Down

0 comments on commit c379b64

Please sign in to comment.