package com.muyu.enterprise.mapper.car;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.github.yulichang.base.MPJBaseMapper;
import com.muyu.enterprise.domain.car.Vehicle;
import com.muyu.enterprise.domain.req.car.VehicleManageReq;
import com.muyu.enterprise.domain.resp.car.VehicleManageResp;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 车辆管理持久层
 * @Author：李庆帅
 * @Package：com.muyu.car.mapper
 * @Project：cloud-server
 * @name：VehicleMapper
 * @Date：2024/9/26 22:26
 * @Description: 车辆管理持久层
 */
@Mapper
public interface VehicleMapper  extends MPJBaseMapper<Vehicle>
{
    /**
     * 查询车辆管理列表
     * @param vehicleManageReq 请求对象
     * @return 返回结果
     */
    List<VehicleManageResp> findAll(VehicleManageReq vehicleManageReq);
    /**
     * 通过车辆vin码查询模板id
     * @param vehicleVin 请求对象
     * @return 返回结果
     */
    @Select("SELECT t.message_template_id FROM vehicle v LEFT JOIN vehicle_type t ON v.vehicle_type_id = t.vehicle_type_id WHERE v.vehicle_vin = #{vehicleVin}")
    Long findByVehicleVin(String vehicleVin);
}
