diff --git a/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/impls/PermissionPartnerManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/impls/PermissionPartnerManagerImpl.java index da9c7f111..089fe8c13 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/impls/PermissionPartnerManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/impls/PermissionPartnerManagerImpl.java @@ -115,7 +115,9 @@ public class PermissionPartnerManagerImpl implements PermissionPartnerManager { } @Override + @Transactional public void permissionClientModuleSave(int clientId, String clientMoniker) { + permissionClientModulesService.removeByClientMoniker(clientMoniker); List moduleId = permissionPartnerModuleMapper.list(); for (JSONObject moduleClientAdd : moduleId) { moduleClientAdd.put("client_id", clientId); diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/SysPermissionClientModulesMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/SysPermissionClientModulesMapper.java index b9ce4eba3..11d41797b 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/SysPermissionClientModulesMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/SysPermissionClientModulesMapper.java @@ -24,6 +24,8 @@ public interface SysPermissionClientModulesMapper { void delete(@Param("module_name") String moduleName); + void deleteByClientMoniker(@Param("client_moniker") String client_moniker); + @AutoSql(type = SqlType.SELECT) List listByClientId(@Param("client_id") int client_id); diff --git a/src/main/java/au/com/royalpay/payment/manage/system/core/PermissionClientModulesService.java b/src/main/java/au/com/royalpay/payment/manage/system/core/PermissionClientModulesService.java index 7e9d97220..984eb440a 100644 --- a/src/main/java/au/com/royalpay/payment/manage/system/core/PermissionClientModulesService.java +++ b/src/main/java/au/com/royalpay/payment/manage/system/core/PermissionClientModulesService.java @@ -19,4 +19,5 @@ public interface PermissionClientModulesService { void switchValid(Long id,boolean isValid,JSONObject account); + void removeByClientMoniker(String clientMoniker); } \ No newline at end of file diff --git a/src/main/java/au/com/royalpay/payment/manage/system/core/impl/PermissionClientModulesServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/system/core/impl/PermissionClientModulesServiceImpl.java index 05a99e1f0..20c8dbdce 100644 --- a/src/main/java/au/com/royalpay/payment/manage/system/core/impl/PermissionClientModulesServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/system/core/impl/PermissionClientModulesServiceImpl.java @@ -72,6 +72,11 @@ public class PermissionClientModulesServiceImpl implements PermissionClientModul } + @Override + public void removeByClientMoniker(String clientMoniker) { + permissionClientModulesMapper.deleteByClientMoniker(clientMoniker); + } + private void saveMongoLog(JSONObject account, JSONObject oldRecord, JSONObject modifyData, String business) { try { modifyData.remove("id"); diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/SysPermissionClientModulesMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/SysPermissionClientModulesMapper.xml index b396def8c..4a329d96e 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/SysPermissionClientModulesMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/SysPermissionClientModulesMapper.xml @@ -28,4 +28,9 @@ delete from sys_permission_partner_modules_clients where module_id = (SELECT id from sys_permission_partner_modules where module_name=#{module_name}) + + + delete from sys_permission_partner_modules_clients + where client_moniker= #{client_moniker} + \ No newline at end of file