class AttrCategoryServiceImpl implements AttrCategoryService {

    @Autowired
    private AttrCategoryMapper attrCategoryMapper;

    @Override
    public void save(Long attrId, List<Long> categoryIds) {
        attrCategoryMapper.saveBatch(attrId, categoryIds);
    }

    @Override
    public List<Long> update(Long attrId, List<Long> categoryIds) {<FILL_FUNCTION_BODY>}

    @Override
    public List<CategoryVO> listByAttrId(Long attrId) {
        return attrCategoryMapper.listByAttrId(attrId);
    }
}

        if (CollUtil.isEmpty(categoryIds)) {
            return new ArrayList<>();
        }
        List<Long> dbCategoryIds = attrCategoryMapper.getCategoryIdsByAttrId(attrId);
        List<Long> addList = new ArrayList<>(categoryIds.size());
        addList.addAll(categoryIds);
        addList.removeAll(dbCategoryIds);
        if (CollUtil.isNotEmpty(addList)) {
            attrCategoryMapper.saveBatch(attrId, addList);
        }
        dbCategoryIds.removeAll(categoryIds);
        if (CollUtil.isNotEmpty(dbCategoryIds)) {
            attrCategoryMapper.deleteBatch(attrId, dbCategoryIds);
        }
        return dbCategoryIds;
    
<no_super_class>