//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.luozhihui.project.mapper;

import com.luozhihui.project.entity.Car;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.transaction.annotation.Transactional;

public interface CarShowMapper {
    @Select({"select car.*,`parking`.parkingName,`parking`.parkingName from  `car` JOIN `parking` ON `car`.parking_id=`parking`.id"})
    List<Car> FindAllCar();

    @Select({"select * from  `car` where `CarId`=#{CarId}"})
    List<Car> FindCarById(String CarId);

    @Insert({"insert into `car`(`CarContent`,`CarStatus`,`CarPhoto`,`parking_id`,`CarNumber`) VALUES(#{CarContent},#{CarStatus},#{CarPhoto},#{parking_id},#{CarNumber})"})
    @Transactional
    void addCar(Car car);

    @Delete({"delete  from  `car` where `CarId`=#{CarId}"})
    boolean DeleteCarById(String CarId);

    @Select({"select * from  `car` where `CarId`=#{CarId}"})
    Car CarId(Integer CarId);

    @Update({"UPDATE car SET CarContent = #{CarContent}, CarStatus = #{CarStatus}, CarPhoto = #{CarPhoto}, parking_id = #{parking_id}, CarNumber = #{CarNumber}  where CarId = #{CarId}"})
    void update(Car car);

    @Select({"SELECT `car`.* FROM `car` WHERE parking_id=#{parking_id}"})
    List<Car> findCarsByParkingId(Integer parking_id);
}
