Skip to content

Commit 3fc3c62

Browse files
committed
fix: 保存前根据主键查询是否存在,应忽略删除标记字段
1 parent f59f2a2 commit 3fc3c62

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

mybatis-xml-fast-develop-core/src/main/java/com/wangshu/base/service/AbstractBaseDataService.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ public int _save(@NotNull T model) {
7575
throw new IException(HttpStatus.INTERNAL_SERVER_ERROR);
7676
}
7777
Object primaryValue = model.safeModelAnyValueByFieldName(modelPrimaryField.getName());
78-
if (!StrUtil.isBlankIfStr(primaryValue) && Objects.nonNull(_select(modelPrimaryField.getName(), primaryValue))) {
78+
if (!StrUtil.isBlankIfStr(primaryValue) && Objects.nonNull(getMapper()._select(new HashMap<>() {{
79+
put(modelPrimaryField.getName(), primaryValue);
80+
}}))) {
7981
return _update(model);
8082
}
8183
model = saveParamFilter(model);

0 commit comments

Comments
 (0)