| | |
| | | |
| | | @Override |
| | | public AiProductRole getById(String id) { |
| | | return this.getById(id); |
| | | return aiProductRoleMapper.selectById(id); |
| | | } |
| | | |
| | | @Override |
| | | public List<AiProductRole> getByCompanyId(String companyId) { |
| | | LambdaQueryWrapper<AiProductRole> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(AiProductRole::getCompanyId, companyId); |
| | | queryWrapper.orderByDesc(AiProductRole::getCreatedTime); |
| | | return this.list(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<AiProductRole> getByProductId(String productId) { |
| | | LambdaQueryWrapper<AiProductRole> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(AiProductRole::getProductId, productId); |
| | | queryWrapper.orderByDesc(AiProductRole::getCreatedTime); |
| | | return this.list(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<AiProductRole> getByName(String name) { |
| | | LambdaQueryWrapper<AiProductRole> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.like(AiProductRole::getName, name); |
| | | queryWrapper.orderByDesc(AiProductRole::getCreatedTime); |
| | | return this.list(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<AiProductRole> getByCompanyIdAndProductId(String companyId, String productId) { |
| | | LambdaQueryWrapper<AiProductRole> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(AiProductRole::getCompanyId, companyId); |
| | | queryWrapper.eq(AiProductRole::getProductId, productId); |
| | | queryWrapper.orderByDesc(AiProductRole::getCreatedTime); |
| | | return this.list(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean saveProductRole(AiProductRole aiProductRole) { |
| | | try { |
| | | return this.save(aiProductRole); |
| | | } catch (Exception e) { |
| | | log.error("保存AI产品角色失败: ", e); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean saveBatchProductRoles(List<AiProductRole> productRoles) { |
| | | try { |
| | | return this.saveBatch(productRoles); |
| | | } catch (Exception e) { |
| | | log.error("批量保存AI产品角色失败: ", e); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean updateProductRole(AiProductRole aiProductRole) { |
| | | try { |
| | | return this.updateById(aiProductRole); |
| | | } catch (Exception e) { |
| | | log.error("更新AI产品角色失败: ", e); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean deleteById(String id) { |
| | | try { |
| | | return this.removeById(id); |
| | | } catch (Exception e) { |
| | | log.error("删除AI产品角色失败: ", e); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean deleteByProductId(String productId) { |
| | | try { |
| | | LambdaQueryWrapper<AiProductRole> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(AiProductRole::getProductId, productId); |
| | | return this.remove(queryWrapper); |
| | | } catch (Exception e) { |
| | | log.error("根据AI产品ID删除AI产品角色失败: ", e); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean deleteByCompanyId(String companyId) { |
| | | try { |
| | | LambdaQueryWrapper<AiProductRole> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(AiProductRole::getCompanyId, companyId); |
| | | return this.remove(queryWrapper); |
| | | } catch (Exception e) { |
| | | log.error("根据公司ID删除AI产品角色失败: ", e); |
| | | return false; |
| | | } |
| | | } |
| | | } |