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

package com.luozhihui.project.mapper;

import com.luozhihui.project.entity.Order;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.transaction.annotation.Transactional;

public interface CarRentMapper {
        @Insert({"insert into `order`(`UserId`,`CarId`,`OrderMoney`,`OutPicture`,`OutTime`,`Mode`,`OrderStatus`,`modeId`,`parking_id`) VALUES (#{UserId},#{CarId},#{OrderMoney},#{OutPicture},NOW(),#{Mode},#{OrderStatus},#{modeId},#{parking_id})"})
        @Transactional
        void addorder(Order order);

        @Update({"update `car` set `CarStatus` = 1 where `CarId` = #{CarId}"})
        void updateCarStatus(Integer carId);

        @Update({"update `order` SET `OrderMoney`=#{OrderMoney},`InPicture`=#{InPicture},`InTime`=NOW()  WHERE `OrderId` = #{OrderId} "})
        void carRented(Order order);

        @Update({"update `order` set `OrderStatus` = 1 where `OrderId` = #{OrderId}"})
        void finishOrder(String orderId);

        @Update({"update `car` set `CarStatus` = 0, `parking_id` = #{parking_id} where `CarId` = #{carId}"})
        void endCarStatus(@Param("carId") String carId, @Param("parking_id") String parkingId);
}
