package com.luozhihui.project.mapper;
import com.luozhihui.project.entity.Pact;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface PactShowMapper {
    // 查询所有车辆信息r
    @Select("select * from  `pact`")
    List<Pact> FindAllPact();

    @Select("select * from  `pact` where `UserId`=#{UserId}")
    List<Pact> FindPactById(String OrderId);

//    @Select("select *,`car`.  from  `pact` where `PactId`=#{PactId}")
@Select("SELECT `pact`.`PactId` , `pact`.`CarId`,`pact`.`UserId`,`pact`.`PactMoney` ,`pact`.`OutTime` , `pact`.`InTime`,"
        +" `user`.UserName,`car`.CarModel,`car`.CarLicense  FROM `pact` "
        +"JOIN `car` ON `car`.CarId=`pact`.CarId "
        +" JOIN `user` ON `user`.UserId=`pact`.UserId "
        +" Where `pact`.`PactId`=#{PactId} ")
    List<Pact> FindPactByPactId(String PactId);
}
