MyBatis中字段自加1
复制java<update id="updateArticleLikeCount">
<!-- 点赞还是取消赞 1取消赞 -1, 2点赞 +1 -->
UPDATE lx_article SET
<if test="type == 1" >
article_like_count=article_like_count-1
</if>
<if test="type == 2" >
article_like_count=article_like_count+1
</if>
WHERE article_id=#{articleId};
</update>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11