package com.payment_system.mapper;

import com.payment_system.entity.Car;
import com.payment_system.entity.CarInfo;
import org.apache.ibatis.annotations.*;


@Mapper
public interface CarMapper {
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into car(user_id,number,car_type,bind_time) values(#{userId},#{number},#{carType},#{bindTime}) ")
    void insert(Car car);

    @Delete("delete from car where user_id=#{userId}")
    void delete(Long userId);

    @Select("select * from car where user_id = #{userId}")
    Car findById(long userId);

    @Select("select * from car where number = #{number}")
    Car findByNo(String number);

    @Select("select number,car_type,bind_time from car where user_id = #{userId}")
    CarInfo query(long userId);
}
