@Test public void insertAppGroupTest() throws SQLException { AppGroup appGroup = AppGroup.builder().id(1L).build(); ServiceResult<String> sr = appGroupService.insertAppGroup(appGroup); Assert.assertTrue(sr.getCode() == ServiceResult.SUCCESS); }
public ServiceResult<String> insertAppGroup(AppGroup appGroup) throws SQLException { boolean isSussess = appGroupDao.getDasClient().execute(() -> { Long id = appGroupDao.insertAppGroup(appGroup); if (id <= 0) { throw new TransactionException(message.db_message_add_operation_failed); } appGroup.setId(id); Set<Long> projectIds = appGroup.getItems().stream().map(e -> e.getId()).collect(Collectors.toSet()); if (CollectionUtils.isNotEmpty(projectIds)) { int rs = projectDao.updateProjectAppGroupIdById(id, projectIds); System.out.println(rs); } return true; }); if (isSussess) { return ServiceResult.success(); } return ServiceResult.fail(message.db_message_update_operation_failed); }
AppGroupService { public ServiceResult<String> insertAppGroup(AppGroup appGroup) throws SQLException { boolean isSussess = appGroupDao.getDasClient().execute(() -> { Long id = appGroupDao.insertAppGroup(appGroup); if (id <= 0) { throw new TransactionException(message.db_message_add_operation_failed); } appGroup.setId(id); Set<Long> projectIds = appGroup.getItems().stream().map(e -> e.getId()).collect(Collectors.toSet()); if (CollectionUtils.isNotEmpty(projectIds)) { int rs = projectDao.updateProjectAppGroupIdById(id, projectIds); System.out.println(rs); } return true; }); if (isSussess) { return ServiceResult.success(); } return ServiceResult.fail(message.db_message_update_operation_failed); } }
AppGroupService { public ServiceResult<String> insertAppGroup(AppGroup appGroup) throws SQLException { boolean isSussess = appGroupDao.getDasClient().execute(() -> { Long id = appGroupDao.insertAppGroup(appGroup); if (id <= 0) { throw new TransactionException(message.db_message_add_operation_failed); } appGroup.setId(id); Set<Long> projectIds = appGroup.getItems().stream().map(e -> e.getId()).collect(Collectors.toSet()); if (CollectionUtils.isNotEmpty(projectIds)) { int rs = projectDao.updateProjectAppGroupIdById(id, projectIds); System.out.println(rs); } return true; }); if (isSussess) { return ServiceResult.success(); } return ServiceResult.fail(message.db_message_update_operation_failed); }  }
AppGroupService { public ServiceResult<String> insertAppGroup(AppGroup appGroup) throws SQLException { boolean isSussess = appGroupDao.getDasClient().execute(() -> { Long id = appGroupDao.insertAppGroup(appGroup); if (id <= 0) { throw new TransactionException(message.db_message_add_operation_failed); } appGroup.setId(id); Set<Long> projectIds = appGroup.getItems().stream().map(e -> e.getId()).collect(Collectors.toSet()); if (CollectionUtils.isNotEmpty(projectIds)) { int rs = projectDao.updateProjectAppGroupIdById(id, projectIds); System.out.println(rs); } return true; }); if (isSussess) { return ServiceResult.success(); } return ServiceResult.fail(message.db_message_update_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> insertAppGroup(AppGroup appGroup) throws SQLException { boolean isSussess = appGroupDao.getDasClient().execute(() -> { Long id = appGroupDao.insertAppGroup(appGroup); if (id <= 0) { throw new TransactionException(message.db_message_add_operation_failed); } appGroup.setId(id); Set<Long> projectIds = appGroup.getItems().stream().map(e -> e.getId()).collect(Collectors.toSet()); if (CollectionUtils.isNotEmpty(projectIds)) { int rs = projectDao.updateProjectAppGroupIdById(id, projectIds); System.out.println(rs); } return true; }); if (isSussess) { return ServiceResult.success(); } return ServiceResult.fail(message.db_message_update_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);  }