From 29ba565bbf53ab1d1e6876742708fbf25e854698 Mon Sep 17 00:00:00 2001 From: smallchill Date: Wed, 10 Jul 2024 18:21:17 +0800 Subject: [PATCH] =?UTF-8?q?:zap:=20=E4=BC=98=E5=8C=96saveOrUpdate=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/springblade/core/mp/base/BaseServiceImpl.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/blade-core-mybatis/src/main/java/org/springblade/core/mp/base/BaseServiceImpl.java b/blade-core-mybatis/src/main/java/org/springblade/core/mp/base/BaseServiceImpl.java index 2f61b44..ba8c27e 100644 --- a/blade-core-mybatis/src/main/java/org/springblade/core/mp/base/BaseServiceImpl.java +++ b/blade-core-mybatis/src/main/java/org/springblade/core/mp/base/BaseServiceImpl.java @@ -67,6 +67,15 @@ public class BaseServiceImpl, T extends BaseEntity> exte return super.updateBatchById(entityList, batchSize); } + @Override + public boolean saveOrUpdate(T entity) { + if (entity.getId() == null) { + return this.save(entity); + } else { + return this.updateById(entity); + } + } + @Override public boolean deleteLogic(@NotEmpty List ids) { return super.removeByIds(ids);