Article
-
首先要知道在pojo层文章新增两个属性就是
标签集合 类别集合
用于记录和管理关联表当中本文章的标签和类别 在增加文章 和 更改文章的时候不要忘记对这两个属性赋值 也要对这两个集合所在的关联表去更新 -
查找出来的文章必须都status=1
- 增加文章
article初始化 进行set赋值 之后遍历两个集合生成关联对象插入到对应表当中
- 删除文章
- 批量删除文章
- 修改文章详细信息
牵动了两个关联表 把旧有关系删除后 遍历新的关系集合向数据表中插入值
- 修改文章简单信息 不改标签和类别
- 更新文章评论数量 关联评论表更新评论总数
- 分页查看文章
com.github.pageHelper
- 文章详情页面显示 返回的文章属性带上标签集合 类别集合
- 根据用户查找文章
- 根据关键字查找文章
- 根据类别(集合)查找文章 --返回的时候对数量加限制
limit
- 根据标签(集合)查找文章
- 统计有这个分类的文章数
categort-article-ref -> id=category-id
- 统计有这个标签的文章数
- 根据文章ID获得分类ID列表
- 查看文章评论数
- 查看文章浏览数
- 查看文章点赞数
- 随机查看文章
- 上一篇文章
- 下一篇文章
- 浏览量最高的文章
- 获得最后更新记录 根据更新时间找max的
- 根据状态获取整个站点的文章总数
select count (*) from article
- 获取整个站点的留言总数
select sum (atricle_comment_count)
- 获取整个站点的浏览总数
select sum(article_view_count)
- 获得最新的文章
select * from order by article_id DESC limit #{value}
根据类别集合查找文章.sql
<select id="" parameterType="">
select article的字段 from article, article_category-ref
<where> article.article_status=1
and article.arctile_id= article_category-ref.arctile_id
and article_category-ref.category_id in
<if test="categoryIDList!=null">
<foreach collection="categoryIDList" item="categoryID" open="(" close=")" separator=",">
#{categoID}
</foreach>
</if>
</where>
limit #{limit}
</select>
8.sql
<select id="" paramterType="">
select article.字段 from article ,article-tag-ref
where article.article_status=1
and article.article_id=article-tag-ref.article_id
and article-tag-ref.tagID in
<if test="tagList!=null">
<foreach collection="tagList" item="tagID" open="(" close=")"
separator=",">
#{tagID}
</if>
</where>
limit #{limit}
</select>
Category类别
获得分类总数
获得分类列表order by category_order desc,category_id asc
获得分类列表(设置分类下的文章数)
根据用户ID获得分类列表
删除分类
根据分类ID查询
添加分类
编辑分类
根据名称查询分类limit 1
TagService
1.CRUD
Comment
- 添加评论 insert comment
- 根据文章ID获得评论列表
List<Comment> listCommentByArticleId
- 根据评论ID获得评论 Comment getCommentById()
- 获得所有评论
新回复在上 ORDER BY comment_id DESC +分页PageInfo<Comment> listCommentByPage
获得评论列表
删除评论
更新评论
统计评论数
获得评论子评论
获得最新评论
根据文章列表ID查找评论列表