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

package com.luozhihui.project.mapper;

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

public interface CommentMapper {
    @Insert({"insert into `comments`(`UserName`,`text`,`CarId`,`UserId`,`pub_date`,`parking_id`) VALUES(#{UserName},#{text},#{CarId},#{UserId},NOW(),#{parking_id})"})
    @Transactional
    void save(Comment comment);

    @Select({"SELECT comments.CommentId,comments.text,comments.pub_date,car.CarContent,car.CarNumber,user.UserName FROM `comments` JOIN `user` ON `user`.UserId = `comments`.UserId JOIN `car` ON `car`.CarId = `comments`.CarId  JOIN `parking` ON `car`.CarId = `comments`.CarId"})
    List<Comment> FindAllComment();
}
