
package com.tmerclub.cloud.delivery.feign;


import cn.hutool.core.collection.CollectionUtil;
import com.tmerclub.cloud.api.delivery.feign.AreaFeignClient;
import com.tmerclub.cloud.common.order.vo.AreaVO;
import com.tmerclub.cloud.common.util.BeanUtil;
import com.tmerclub.cloud.delivery.service.AreaService;
import io.seata.common.util.CollectionUtils;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.ArrayList;
import java.util.List;


/**
 * @author YXF
 * @date 2021/06/02
 */
@DubboService
public class AreaFeignController implements AreaFeignClient {

    @Autowired
    private AreaService areaService;


    @Override
    public List<AreaVO> listProvinceArea() {
        return BeanUtil.mapAsList(areaService.getAreaListInfo(), AreaVO.class);
    }

    @Override
    public List<AreaVO> listByAreaIdList(List<Long> areaIdList) {
        if (CollectionUtils.isEmpty(areaIdList)) {
            return new ArrayList<>();
        }
        return areaService.listByAreaIdList(areaIdList);
    }
}
