class 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);
    }

}