
package com.tmerclub.cloud.multishop.feign;

import com.tmerclub.cloud.api.multishop.feign.ShopRefundAddrFeignClient;
import com.tmerclub.cloud.api.multishop.vo.ShopRefundAddrVO;
import com.tmerclub.cloud.common.response.ServerResponseEntity;
import com.tmerclub.cloud.common.security.AuthUserContext;
import com.tmerclub.cloud.multishop.service.ShopRefundAddrService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * @author tmerclub
 * @date 2020/11/23
 */
@DubboService
public class ShopRefundAddrController implements ShopRefundAddrFeignClient {

    @Autowired
    private ShopRefundAddrService shopRefundAddrService;

    @Override
    public ServerResponseEntity<ShopRefundAddrVO> getShopRefundAddrByRefundAddrId(Long refundAddrId) {
        Long shopId = AuthUserContext.get().getTenantId();
        ShopRefundAddrVO shopRefundAddr = shopRefundAddrService.getByShopRefundAddrId(refundAddrId, shopId);
        return ServerResponseEntity.success(shopRefundAddr);
    }

    @Override
    public ServerResponseEntity<List<ShopRefundAddrVO>> listByShopId(Long shopId) {
        List<ShopRefundAddrVO> list = shopRefundAddrService.listByShopId(shopId);
        return ServerResponseEntity.success(list);
    }
}
