| | |
| | | |
| | | private final AiMemberRoleProductMapper aiMemberRoleProductMapper; |
| | | |
| | | @Override |
| | | public AiMemberRoleProduct getById(String id) { |
| | | return this.getById(id); |
| | | } |
| | | |
| | | @Override |
| | | public List<AiMemberRoleProduct> getByRoleId(String roleId) { |
| | | LambdaQueryWrapper<AiMemberRoleProduct> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(AiMemberRoleProduct::getRoleId, roleId); |
| | | return this.list(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<AiMemberRoleProduct> getByProductId(String productId) { |
| | | LambdaQueryWrapper<AiMemberRoleProduct> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(AiMemberRoleProduct::getProductId, productId); |
| | | return this.list(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<AiMemberRoleProduct> getByCompanyId(String companyId) { |
| | | LambdaQueryWrapper<AiMemberRoleProduct> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(AiMemberRoleProduct::getCompanyId, companyId); |
| | | return this.list(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<AiMemberRoleProduct> getByRoleIdAndProductId(String roleId, String productId) { |
| | | LambdaQueryWrapper<AiMemberRoleProduct> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(AiMemberRoleProduct::getRoleId, roleId); |
| | | queryWrapper.eq(AiMemberRoleProduct::getProductId, productId); |
| | | return this.list(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean saveRoleProduct(AiMemberRoleProduct aiMemberRoleProduct) { |
| | | try { |
| | | return this.save(aiMemberRoleProduct); |
| | | } catch (Exception e) { |
| | | log.error("保存角色产品关联记录失败: ", e); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean saveBatchRoleProducts(List<AiMemberRoleProduct> roleProducts) { |
| | | try { |
| | | return this.saveBatch(roleProducts); |
| | | } catch (Exception e) { |
| | | log.error("批量保存角色产品关联记录失败: ", e); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean updateRoleProduct(AiMemberRoleProduct aiMemberRoleProduct) { |
| | | try { |
| | | return this.updateById(aiMemberRoleProduct); |
| | | } 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 deleteByRoleId(String roleId) { |
| | | try { |
| | | LambdaQueryWrapper<AiMemberRoleProduct> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(AiMemberRoleProduct::getRoleId, roleId); |
| | | return this.remove(queryWrapper); |
| | | } catch (Exception e) { |
| | | log.error("根据角色ID删除角色产品关联记录失败: ", e); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean deleteByProductId(String productId) { |
| | | try { |
| | | LambdaQueryWrapper<AiMemberRoleProduct> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(AiMemberRoleProduct::getProductId, productId); |
| | | return this.remove(queryWrapper); |
| | | } catch (Exception e) { |
| | | log.error("根据产品ID删除角色产品关联记录失败: ", e); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean deleteByRoleIdAndProductId(String roleId, String productId) { |
| | | try { |
| | | LambdaQueryWrapper<AiMemberRoleProduct> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(AiMemberRoleProduct::getRoleId, roleId); |
| | | queryWrapper.eq(AiMemberRoleProduct::getProductId, productId); |
| | | return this.remove(queryWrapper); |
| | | } catch (Exception e) { |
| | | log.error("根据角色ID和产品ID删除角色产品关联记录失败: ", e); |
| | | return false; |
| | | } |
| | | } |
| | | } |