|
@@ -4,6 +4,7 @@ import com.firerock.webttkuaiban.demos.pojo.Article;
|
|
|
import org.apache.ibatis.annotations.Mapper;
|
|
|
import org.apache.ibatis.annotations.Param;
|
|
|
import org.apache.ibatis.annotations.Select;
|
|
|
+import org.apache.ibatis.annotations.Update;
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
@@ -19,4 +20,10 @@ public interface ArticleMapper {
|
|
|
|
|
|
@Select("select id,title,content,category_ids,create_time,product_id,profile from article where id = #{id}")
|
|
|
Article getArticleById(Integer id);
|
|
|
+
|
|
|
+ @Update(" update article set view_count = view_count + 1 where id= #{id}")
|
|
|
+ void updateViewCountById(Integer id);
|
|
|
+
|
|
|
+ @Select("SELECT id,view_count FROM article WHERE id = #{articleId} FOR UPDATE")
|
|
|
+ Article selectForUpdate(Integer articleId);
|
|
|
}
|