package com.sckw.fleet.repository;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sckw.fleet.dao.KwTruckAxleNumMapper;
import com.sckw.fleet.model.TmsTruckAxleNum;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Set;


/**
 * @author PC
 * 车辆轴数接口
 */
@Repository
public class KwfTruckAxleNumRepository extends ServiceImpl<KwTruckAxleNumMapper, TmsTruckAxleNum> {

    public TmsTruckAxleNum getOneById(Integer id) {
        return getOne(Wrappers.<TmsTruckAxleNum>lambdaQuery()
                .eq(TmsTruckAxleNum::getStatus,1)
                .eq(TmsTruckAxleNum::getId, id)
                .last("limit 1"));
    }

    public List<TmsTruckAxleNum> queryByIds(Set<Integer> carAxisIds) {
        return  list(Wrappers.<TmsTruckAxleNum>lambdaQuery()
                .eq(TmsTruckAxleNum::getStatus,1)
                .in(TmsTruckAxleNum::getId, carAxisIds));
    }
}
