package com.wms.service.serviceImplements;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wms.entity.app.dto.VehicleDto;
import com.wms.entity.table.Vehicle;
import com.wms.mapper.VehicleMapper;
import com.wms.service.VehicleService;
import com.wms.utils.StringUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class VehicleServiceImplements extends ServiceImpl<VehicleMapper, Vehicle> implements VehicleService {
    private final VehicleMapper vehicleMapper;

    @Override
    public List<VehicleDto> selVehicles(Vehicle vehicle) {
        // TODO 具体查询条件待添加
        LambdaQueryWrapper<Vehicle> queryWrapper = new LambdaQueryWrapper<Vehicle>()
                .eq(StringUtils.isNotEmpty(vehicle.getVehicleId()), Vehicle::getVehicleId, vehicle.getVehicleId());
        List<Vehicle> results = super.list(queryWrapper);

        return BeanUtil.copyToList(results, VehicleDto.class);
    }
}
