package com.template.controller;
import com.muyu.common.core.domain.Result;
import com.template.domain.CarType;
import com.template.domain.SysCar;
import com.template.service.CarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
 * @Author：liuxinyue
 * @Package：com.template.controller
 * @Project：cloud-server
 * @name：CarController
 * @Date：2024/9/21 9:25
 */
@RestController
@RequestMapping("/car")
public class CarController {

    @Autowired
    private CarService carService;
    /**
     * 根据VIN码查询车信息
     * @param carVin
     * @return
     */
    @PostMapping("/findCarByVin")
    public Result<SysCar> findCarByVin(@RequestParam String carVin){
        return Result.success(carService.findCarByVin(carVin));
    }

    /**
     * 根据类型ID获取车辆类型
     * @param carTypeId
     * @return
     */
    @PostMapping("/findCarTypeById")
    public Result<CarType> findCarTypeById(@RequestParam Long carTypeId) {
        return Result.success(carService.findCarTypeById(carTypeId));
    }

}
