package com.jwipc.sys.logic.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jwipc.constant.EnableStatus;
import com.jwipc.sys.convert.ExpressCompanyConvert;
import com.jwipc.sys.dto.ExpressCompanyBaseDTO;
import com.jwipc.sys.entity.ExpressCompany;
import com.jwipc.sys.logic.ExpressCompanyLogic;
import com.jwipc.sys.service.IExpressCompanyService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * <p> </p>
 *
 * @author BOGON
 * @version 1.0
 * @since JDK 1.8
 */
@Service
@RequiredArgsConstructor
public class ExpressCompanyLogicImpl implements ExpressCompanyLogic {
    private final ExpressCompanyConvert expressCompanyConvert;
    private final IExpressCompanyService expressCompanyService;

    @Override
    public List<ExpressCompanyBaseDTO> listAll() {
        final List<ExpressCompany> list = expressCompanyService.list(
                new LambdaQueryWrapper<ExpressCompany>().eq(ExpressCompany::getStatus,
                        EnableStatus.ENABLE.getStatus()));

        return expressCompanyConvert.entities2Dtos(list);
    }
}