service层

Article

  • 首先要知道在pojo层文章新增两个属性就是标签集合 类别集合用于记录和管理关联表当中本文章的标签和类别 在增加文章 和 更改文章的时候不要忘记对这两个属性赋值 也要对这两个集合所在的关联表去更新

  • 查找出来的文章必须都status=1

  1. 增加文章article初始化 进行set赋值 之后遍历两个集合生成关联对象插入到对应表当中
  2. 删除文章
  3. 批量删除文章
  4. 修改文章详细信息 牵动了两个关联表 把旧有关系删除后 遍历新的关系集合向数据表中插入值
  5. 修改文章简单信息 不改标签和类别
  6. 更新文章评论数量 关联评论表更新评论总数
  7. 分页查看文章com.github.pageHelper
  8. 文章详情页面显示 返回的文章属性带上标签集合 类别集合
  9. 根据用户查找文章
  10. 根据关键字查找文章
  11. 根据类别(集合)查找文章 --返回的时候对数量加限制limit
  12. 根据标签(集合)查找文章
  13. 统计有这个分类的文章数categort-article-ref -> id=category-id
  14. 统计有这个标签的文章数
  15. 根据文章ID获得分类ID列表
  16. 查看文章评论数
  17. 查看文章浏览数
  18. 查看文章点赞数
  19. 随机查看文章
  20. 上一篇文章
  21. 下一篇文章
  22. 浏览量最高的文章
  23. 获得最后更新记录 根据更新时间找max的
  24. 根据状态获取整个站点的文章总数select count (*) from article
  25. 获取整个站点的留言总数select sum (atricle_comment_count)
  26. 获取整个站点的浏览总数select sum(article_view_count)
  27. 获得最新的文章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查找评论列表
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值