package cn.seecoder.fdroidrepository.Mapper; import cn.seecoder.fdroidrepository.DataObject.Comment; import cn.seecoder.fdroidrepository.Service.CommentService; import org.apache.ibatis.annotations.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import java.util.List; @Mapper public interface CommentMapper { @Select("SELECT * FROM comments WHERE post_id = #{postId}") @Results({ @Result(property = "commentId", column = "comment_id"), @Result(property = "postId", column = "post_id"), @Result(property = "userId", column = "user_id"), @Result(property = "content", column = "content"), @Result(property = "createdAt", column = "created_at") }) List findByPostId(Long postId); @Insert("INSERT INTO comments (post_id, user_id, content, created_at) " + "VALUES (#{postId}, #{userId}, #{content}, #{createdAt})") void save(Comment comment); }