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

package com.luozhihui.project.mapper;

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

public interface ModeMapper {
    @Select({"select mode.*,p.parkingName from  `mode` JOIN car.parking p on p.id = mode.parking_id LIMIT #{pageNum}, #{pageSize}"})
    List<Mode> FindAllModepage(@Param("pageNum") int pageNum, @Param("pageSize") int pageSize);

    @Select({"select mode.*,p.parkingName from  `mode` JOIN car.parking p on p.id = mode.parking_id"})
    List<Mode> FindAllMode();

    @Select({"select * from  `mode` where `ModeId`=#{ModeId}"})
    List<Mode> FindModedById(String Id);

    @Select({"select mode.*,p.parkingName,p.type from `mode` JOIN car.parking p on p.id=mode.parking_id where `parking_id`=#{parking_id}"})
    List<Mode> FindModedByParkingId(String parking_id);

    @Insert({"insert into `mode` (`BetMoney`,`DayMoney`,`HourMoney`,`MonthMoney`,`Description`,`ModeStatus`,`parking_id`,`ModeName`,`ModeImg`,`ModeNum`) VALUES(#{BetMoney},#{DayMoney},#{HourMoney},#{MonthMoney},#{Description},#{ModeStatus},#{parking_id},#{ModeName},#{ModeImg},#{ModeNum})"})
    @Transactional
    void addMode(Mode mode);

    @Delete({"delete  from  `mode` where `ModeId`=#{ModeId}"})
    boolean DeleteModeById(String Id);

    @Select({"select * from  `mode` where `ModeId`=#{ModeId}"})
    Mode ModeId(Integer ModeId);

    @Update({"UPDATE mode SET BetMoney = #{BetMoney}, DayMoney = #{DayMoney}, HourMoney = #{HourMoney}, MonthMoney = #{MonthMoney},Description=#{Description},ModeStatus=#{ModeStatus},parking_id=#{parking_id},ModeName=#{ModeName},ModeImg=#{ModeImg},ModeNum=#{ModeNum} where `ModeId`=#{ModeId}"})
    void update(Mode mode);

    @Select({" SELECT COUNT(*) FROM `mode`"})
    int countMode();
}
