@Test public void deleteAppGroupTest() throws SQLException { AppGroup appGroup = AppGroup.builder().id(1L).build(); ServiceResult<String> sr = appGroupService.deleteAppGroup(appGroup); Assert.assertTrue(sr.getCode() == ServiceResult.SUCCESS); }
public ServiceResult<String> deleteAppGroup(AppGroup appGroup) throws SQLException { boolean isSussess = appGroupDao.getDasClient().execute(() -> { List<Project> list = projectDao.getProjectByAppGroupId(appGroup.getId()); if (CollectionUtils.isNotEmpty(list) && projectDao.deleteProjectAppGroupIdById(appGroup.getId()) <= 0) { throw new TransactionException(message.db_message_delete_operation_failed); } int rs = appGroupDao.deleteAppGroup(appGroup); if (rs <= 0) { throw new TransactionException(message.db_message_delete_operation_failed); } return true; }); if (isSussess) { return ServiceResult.success(); } return ServiceResult.fail(message.db_message_delete_operation_failed); }
AppGroupService { public ServiceResult<String> deleteAppGroup(AppGroup appGroup) throws SQLException { boolean isSussess = appGroupDao.getDasClient().execute(() -> { List<Project> list = projectDao.getProjectByAppGroupId(appGroup.getId()); if (CollectionUtils.isNotEmpty(list) && projectDao.deleteProjectAppGroupIdById(appGroup.getId()) <= 0) { throw new TransactionException(message.db_message_delete_operation_failed); } int rs = appGroupDao.deleteAppGroup(appGroup); if (rs <= 0) { throw new TransactionException(message.db_message_delete_operation_failed); } return true; }); if (isSussess) { return ServiceResult.success(); } return ServiceResult.fail(message.db_message_delete_operation_failed); } }
AppGroupService { public ServiceResult<String> deleteAppGroup(AppGroup appGroup) throws SQLException { boolean isSussess = appGroupDao.getDasClient().execute(() -> { List<Project> list = projectDao.getProjectByAppGroupId(appGroup.getId()); if (CollectionUtils.isNotEmpty(list) && projectDao.deleteProjectAppGroupIdById(appGroup.getId()) <= 0) { throw new TransactionException(message.db_message_delete_operation_failed); } int rs = appGroupDao.deleteAppGroup(appGroup); if (rs <= 0) { throw new TransactionException(message.db_message_delete_operation_failed); } return true; }); if (isSussess) { return ServiceResult.success(); } return ServiceResult.fail(message.db_message_delete_operation_failed); }  }
AppGroupService { public ServiceResult<String> deleteAppGroup(AppGroup appGroup) throws SQLException { boolean isSussess = appGroupDao.getDasClient().execute(() -> { List<Project> list = projectDao.getProjectByAppGroupId(appGroup.getId()); if (CollectionUtils.isNotEmpty(list) && projectDao.deleteProjectAppGroupIdById(appGroup.getId()) <= 0) { throw new TransactionException(message.db_message_delete_operation_failed); } int rs = appGroupDao.deleteAppGroup(appGroup); if (rs <= 0) { throw new TransactionException(message.db_message_delete_operation_failed); } return true; }); if (isSussess) { return ServiceResult.success(); } return ServiceResult.fail(message.db_message_delete_operation_failed); }  ValidatorChain validatePermision(LoginUser user, Errors errors); ListResult<AppGroupView> findProjectGroupPageList(Paging<AppGroup> paging); ServiceResult<String> insertAppGroup(AppGroup appGroup); ServiceResult deleteCheck(Long dbsetId); ServiceResult<String> deleteAppGroup(AppGroup appGroup); ServiceResult<String> updateAppGroup(AppGroup appGroup); boolean isNotExistByName(AppGroup appGroup); }
AppGroupService { public ServiceResult<String> deleteAppGroup(AppGroup appGroup) throws SQLException { boolean isSussess = appGroupDao.getDasClient().execute(() -> { List<Project> list = projectDao.getProjectByAppGroupId(appGroup.getId()); if (CollectionUtils.isNotEmpty(list) && projectDao.deleteProjectAppGroupIdById(appGroup.getId()) <= 0) { throw new TransactionException(message.db_message_delete_operation_failed); } int rs = appGroupDao.deleteAppGroup(appGroup); if (rs <= 0) { throw new TransactionException(message.db_message_delete_operation_failed); } return true; }); if (isSussess) { return ServiceResult.success(); } return ServiceResult.fail(message.db_message_delete_operation_failed); }  ValidatorChain validatePermision(LoginUser user, Errors errors); ListResult<AppGroupView> findProjectGroupPageList(Paging<AppGroup> paging); ServiceResult<String> insertAppGroup(AppGroup appGroup); ServiceResult deleteCheck(Long dbsetId); ServiceResult<String> deleteAppGroup(AppGroup appGroup); ServiceResult<String> updateAppGroup(AppGroup appGroup); boolean isNotExistByName(AppGroup appGroup);  }