| <?xml version="1.0" encoding="UTF-8" ?> |
| PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| <mapper namespace="com.pt5.pthouduan.mapper.CommentMapper"> |
| <insert id="save" parameterType="com.pt5.pthouduan.entity.Comment"> |
| INSERT INTO comment (commentid, userid, postid, post_commentcontent, commenttime) |
| VALUES (#{commentid}, #{userid}, #{postid}, #{postCommentcontent}, #{commenttime}) |
| <delete id="deleteByCommentid" parameterType="int"> |
| DELETE FROM comment WHERE commentid = #{commentid} |
| <update id="updateComment" parameterType="com.pt5.pthouduan.entity.Comment"> |
| post_commentcontent = #{postCommentcontent}, |
| commenttime = #{commenttime} |
| WHERE commentid = #{commentid} |
| <select id="selectByPostid" parameterType="int" resultType="com.pt5.pthouduan.entity.Comment"> |
| <update id="incrementLikes" parameterType="int"> |
| WHERE commentid = #{commentid} |
| <update id="decrementLikes" parameterType="int"> |
| WHEN likes > 0 THEN likes - 1 |
| WHERE commentid = #{commentid} |