From d922f82bf8a0a4c82af8153a4c1925e53764a76e Mon Sep 17 00:00:00 2001 From: shao1121353141 <> Date: Sun, 17 Sep 2023 17:10:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BA=94=E7=94=A8=E4=BF=AE=E6=94=B9=E5=BA=94?= =?UTF-8?q?=E7=94=A8=E7=BB=84=E6=97=B6=E5=88=A0=E9=99=A4=E5=85=B3=E8=81=94?= =?UTF-8?q?=E5=85=B3=E7=B3=BB=EF=BC=8C=E5=B7=B2=E5=88=A0=E9=99=A4=E7=9A=84?= =?UTF-8?q?=E5=BA=94=E7=94=A8=E7=BB=84=E9=99=A4=E5=A4=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repository/app/AppGroupAssociationRepository.java | 6 ++++-- .../employee/console/service/app/impl/AppServiceImpl.java | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppGroupAssociationRepository.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppGroupAssociationRepository.java index 579d0d7f..999187eb 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppGroupAssociationRepository.java +++ b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/AppGroupAssociationRepository.java @@ -64,7 +64,7 @@ public interface AppGroupAssociationRepository extends @Transactional(rollbackFor = Exception.class) @Query(value = "UPDATE app_group_association SET " + SOFT_DELETE_SET + " WHERE app_id = :appId", nativeQuery = true) - void deleteAllByAppId(@Param(value = "appId") Long appId); + void deleteByAppId(@Param(value = "appId") Long appId); /** * 根据应用组ID删除关联 @@ -83,7 +83,9 @@ public interface AppGroupAssociationRepository extends * * @param appId {@link Long} */ - void deleteByAppId(Long appId); + @Modifying + @Query(value = "DELETE FROM app_group_association WHERE app_id = :appId AND is_deleted = '0'", nativeQuery = true) + void deleteAllByAppId(Long appId); /** * 根据应用ID 查询关联信息 diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/service/app/impl/AppServiceImpl.java b/eiam-console/src/main/java/cn/topiam/employee/console/service/app/impl/AppServiceImpl.java index d539015f..19f5b4a4 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/service/app/impl/AppServiceImpl.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/service/app/impl/AppServiceImpl.java @@ -114,7 +114,7 @@ public class AppServiceImpl implements AppService { AppEntity entity = appConverter.appUpdateParamConverterToEntity(param); BeanUtils.merge(entity, app, LAST_MODIFIED_TIME, LAST_MODIFIED_BY); appRepository.save(app); - appGroupAssociationRepository.deleteByAppId(app.getId()); + appGroupAssociationRepository.deleteAllByAppId(app.getId()); List list = new ArrayList<>(); for (String id : param.getGroupIds()) { AppGroupAssociationEntity appGroupAssociationEntity = new AppGroupAssociationEntity(); @@ -139,7 +139,7 @@ public class AppServiceImpl implements AppService { public boolean deleteApp(Long id) { AppEntity app = appRequireNonNull(id); applicationServiceLoader.getApplicationService(app.getTemplate()).delete(id.toString()); - appGroupAssociationRepository.deleteAllByAppId(id); + appGroupAssociationRepository.deleteByAppId(id); AuditContext .setTarget(Target.builder().id(id.toString()).type(TargetType.APPLICATION).build()); return true;