package com.sckw.transport.dubbo;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.sckw.transport.api.dubbo.RemoteTransportLineFreightRateService;
import com.sckw.transport.dao.KwtLogisticsOrderLineFreightRateMapper;
import com.sckw.transport.model.KwtLogisticsOrderLineFreightRate;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author lfdc
 * @description 物流订单线路dubbo实现
 * @date 2024-03-13 10:03:45
 */
@Slf4j
@Service
@DubboService(group = "design", version = "1.0.0",timeout = 50000)
public class TransportRemoteLineFreightRateServiceImpl implements RemoteTransportLineFreightRateService {

    @Autowired
    KwtLogisticsOrderLineFreightRateMapper lineFreightRateMapper;

    @Override
    public Boolean getRemoteLineFreightRateIsUse(List<Long> lineFreightRateIds) {
        int count = lineFreightRateMapper.selectCount(new LambdaQueryWrapper<KwtLogisticsOrderLineFreightRate>()
                .in(KwtLogisticsOrderLineFreightRate::getLineFreightRateId, lineFreightRateIds)
                .eq(KwtLogisticsOrderLineFreightRate::getDelFlag, 0)).intValue();
        if (count > 0) {
            return true;
        }
        return false;
    }
}
