package com.luozhihui.project.mapper;
import com.luozhihui.project.entity.Parking;
import com.luozhihui.project.entity.Brand;
import org.apache.ibatis.annotations.*;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public interface ParkingMapper {
    // 查询所有车辆信息
    @Select("select * from  `parking`")
    List<Parking> FindAllParking();
    @Select("select * from  `parking` where `id`=#{id}")
    List<Brand> FindParkingById(String Id);
    @Insert("insert into `parking`(`parkingName`,`address`,`type`,`carsNumber`,`enable`,`coord`) VALUES(#{parkingName},#{address},#{type},#{carsNumber},#{enable},#{coord})")
    @Transactional
    void addParking(Parking parking);

    //通过id删除信息
    @Delete("delete  from  `parking` where `id`=#{id}")
    boolean DeleteParkingById(String Id);
    //通过id查询信息
    @Select("select * from  `parking` where `id`=#{id}")
    Parking ParkingId(Integer Id);
    //    更新品牌信息
    @Update("UPDATE `parking` SET parkingName = #{parkingName},  address = #{address}, type = #{type}, carsNumber = #{carsNumber}, enable = #{enable}, coord = #{coord} where id = #{id}")
    void update(Parking parking);

}
