
package com.tmerclub.cloud.combo.feign;

import com.tmerclub.cloud.api.combo.feign.ComboFeignClient;
import com.tmerclub.cloud.combo.service.ComboService;
import com.tmerclub.cloud.common.product.vo.ComboVO;
import com.tmerclub.cloud.common.response.ServerResponseEntity;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * @author xxw
 * @date 2022/8/16 15:00
 */
@DubboService
public class ComboFeignController implements ComboFeignClient {
    @Autowired
    private ComboService comboService;

    @Override
    public ServerResponseEntity<List<ComboVO>> listComboInfoBySpuId(Long shopId, Long spuId) {
        return ServerResponseEntity.success(comboService.listComboInfoBySpuId(shopId, spuId));
    }

    @Override
    public ServerResponseEntity<List<ComboVO>> comboVoListBySpuId(Long spuId) {
        return ServerResponseEntity.success(comboService.comboVoListBySpuId(spuId));
    }

    @Override
    public void offComboMainSpu(Long spuId) {
        comboService.offComboMainSpu(spuId);
    }

    @Override
    public ServerResponseEntity<Boolean> checkComboSpu(Long spuId, Long shopId) {
        return ServerResponseEntity.success(comboService.checkComboSpu(spuId, shopId));
    }

    @Override
    public ServerResponseEntity<Integer> checkComboIsUsable(List<Long> comboIdList) {
        return ServerResponseEntity.success(comboService.checkComboIsUsable(comboIdList));
    }

    @Override
    public void removeComboSpuCache(Long spuId) {
        comboService.removeComboSpuCache(spuId);
    }

}
