| | |
| | | |
| | | private final AiProductQuestionLinkMapper aiProductQuestionLinkMapper; |
| | | |
| | | @Override |
| | | public AiProductQuestionLink getById(String id) { |
| | | return this.getById(id); |
| | | } |
| | | |
| | | @Override |
| | | public List<AiProductQuestionLink> getByCompanyId(String companyId) { |
| | | LambdaQueryWrapper<AiProductQuestionLink> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(AiProductQuestionLink::getCompanyId, companyId); |
| | | queryWrapper.orderByDesc(AiProductQuestionLink::getCreatedTime); |
| | | return this.list(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<AiProductQuestionLink> getByProductQuestionId(String productQuestionId) { |
| | | LambdaQueryWrapper<AiProductQuestionLink> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(AiProductQuestionLink::getProductQuestionId, productQuestionId); |
| | | queryWrapper.orderByDesc(AiProductQuestionLink::getCreatedTime); |
| | | return this.list(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<AiProductQuestionLink> getByProductId(String productId) { |
| | | LambdaQueryWrapper<AiProductQuestionLink> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(AiProductQuestionLink::getProductId, productId); |
| | | queryWrapper.orderByDesc(AiProductQuestionLink::getCreatedTime); |
| | | return this.list(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<AiProductQuestionLink> getByCompanyIdAndProductId(String companyId, String productId) { |
| | | LambdaQueryWrapper<AiProductQuestionLink> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(AiProductQuestionLink::getCompanyId, companyId); |
| | | queryWrapper.eq(AiProductQuestionLink::getProductId, productId); |
| | | queryWrapper.orderByDesc(AiProductQuestionLink::getCreatedTime); |
| | | return this.list(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<AiProductQuestionLink> getByCompanyIdAndProductQuestionId(String companyId, String productQuestionId) { |
| | | LambdaQueryWrapper<AiProductQuestionLink> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(AiProductQuestionLink::getCompanyId, companyId); |
| | | queryWrapper.eq(AiProductQuestionLink::getProductQuestionId, productQuestionId); |
| | | queryWrapper.orderByDesc(AiProductQuestionLink::getCreatedTime); |
| | | return this.list(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<AiProductQuestionLink> getByProductIdAndProductQuestionId(String productId, String productQuestionId) { |
| | | LambdaQueryWrapper<AiProductQuestionLink> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(AiProductQuestionLink::getProductId, productId); |
| | | queryWrapper.eq(AiProductQuestionLink::getProductQuestionId, productQuestionId); |
| | | queryWrapper.orderByDesc(AiProductQuestionLink::getCreatedTime); |
| | | return this.list(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean saveProductQuestionLink(AiProductQuestionLink aiProductQuestionLink) { |
| | | try { |
| | | return this.save(aiProductQuestionLink); |
| | | } catch (Exception e) { |
| | | log.error("保存产品题目关系失败: ", e); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean saveBatchProductQuestionLinks(List<AiProductQuestionLink> productQuestionLinks) { |
| | | try { |
| | | return this.saveBatch(productQuestionLinks); |
| | | } catch (Exception e) { |
| | | log.error("批量保存产品题目关系失败: ", e); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean updateProductQuestionLink(AiProductQuestionLink aiProductQuestionLink) { |
| | | try { |
| | | return this.updateById(aiProductQuestionLink); |
| | | } catch (Exception e) { |
| | | log.error("更新产品题目关系失败: ", e); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean deleteById(String id) { |
| | | try { |
| | | return this.removeById(id); |
| | | } catch (Exception e) { |
| | | log.error("删除产品题目关系失败: ", e); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean deleteByProductId(String productId) { |
| | | try { |
| | | LambdaQueryWrapper<AiProductQuestionLink> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(AiProductQuestionLink::getProductId, productId); |
| | | return this.remove(queryWrapper); |
| | | } catch (Exception e) { |
| | | log.error("根据产品ID删除产品题目关系失败: ", e); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean deleteByProductQuestionId(String productQuestionId) { |
| | | try { |
| | | LambdaQueryWrapper<AiProductQuestionLink> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(AiProductQuestionLink::getProductQuestionId, productQuestionId); |
| | | return this.remove(queryWrapper); |
| | | } catch (Exception e) { |
| | | log.error("根据产品题目ID删除产品题目关系失败: ", e); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean deleteByCompanyId(String companyId) { |
| | | try { |
| | | LambdaQueryWrapper<AiProductQuestionLink> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(AiProductQuestionLink::getCompanyId, companyId); |
| | | return this.remove(queryWrapper); |
| | | } catch (Exception e) { |
| | | log.error("根据公司ID删除产品题目关系失败: ", e); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean deleteByProductIdAndProductQuestionId(String productId, String productQuestionId) { |
| | | try { |
| | | LambdaQueryWrapper<AiProductQuestionLink> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(AiProductQuestionLink::getProductId, productId); |
| | | queryWrapper.eq(AiProductQuestionLink::getProductQuestionId, productQuestionId); |
| | | return this.remove(queryWrapper); |
| | | } catch (Exception e) { |
| | | log.error("根据产品ID和产品题目ID删除产品题目关系失败: ", e); |
| | | return false; |
| | | } |
| | | } |
| | | } |