package com.muyu.server.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.common.domain.CarType;
import com.muyu.common.domain.resp.CarTypeResp;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 车辆类型Mapper接口
 * @author  sx
 * @package com.muyu.server.mapper
 * @name CarTypeMapper
 * @Date 2024/9/29 12:06
 */
@Mapper
public interface CarTypeMapper extends BaseMapper<CarType> {

    @Select(" SELECT *,t_template.template_name FROM car_type LEFT JOIN t_template ON car_type.template_id = t_template.template_id where car_type.id=#{id}")
    CarTypeResp selectCarTypeRespList(@Param("id")Long id);

    @Select(" SELECT car_type.*,t_template.template_name FROM car_type LEFT JOIN t_template ON car_type.template_id = t_template.template_id")
    List<CarTypeResp> findAllCars();

}
