后台采用springboot+mybatis

用户可以在线阅读小说

/*** 文章章节 控制器* author qq2803180149*/
@Controller
@RequestMapping("chapter")
public class ChapterController {private final IChapterService iChapterService;private final IFictionService iFictionService;private final IChapterContentService iChapterContentService;private final IFictionShelfService iFictionShelfService;public ChapterController(IChapterService iChapterService, IFictionService iFictionService, IChapterContentService iChapterContentService, IFictionShelfService iFictionShelfService) {this.iChapterService = iChapterService;this.iFictionService = iFictionService;this.iChapterContentService = iChapterContentService;this.iFictionShelfService = iFictionShelfService;}//返回一本小说@RequestMapping(value = "info/{fiction_id}", method = RequestMethod.GET)public String chapter(HttpServletRequest request, @PathVariable("fiction_id") int fiction_id, Model model) {Fiction fiction = iFictionService.getById(fiction_id);//添加点击量iFictionService.addView(fiction);//检查该本小说是否保存在书架int i = iFictionShelfService.isShelf(request, fiction_id);switch (i){case 0: model.addAttribute("presence",0);break;case 1: model.addAttribute("presence",1);break;}model.addAttribute("fiction",fiction);model.addAttribute("title",fiction.getFictionName());return "chapter/info";}//返回一本小说所有章节@RequestMapping(value = "list/{fiction_id}", method = RequestMethod.GET)public String chapterList(@PathVariable("fiction_id") int fiction_id, Model model) {Fiction fiction = iFictionService.getById(fiction_id);List<Chapter> chapterList = iChapterService.queryByFictionIdList(fiction_id);model.addAttribute("fiction",fiction);model.addAttribute("list",chapterList);model.addAttribute("size",chapterList.size());model.addAttribute("title",fiction.getFictionName());return "chapter/list";}//当前小说页@RequestMapping(value = "read/{fiction_id}/{sort}", method = RequestMethod.GET)public String chapterInfo(HttpServletRequest request,Model model, @PathVariable("fiction_id") int fiction_id,@PathVariable("sort") int sort) {//更新用户阅读章节HttpSession session = request.getSession();if (null!=session.getAttribute("id")){int id = iFictionShelfService.updateShelf(fiction_id, (Integer) session.getAttribute("id"), sort);if (id!=1){System.out.println("更新用户章节失败");}}Chapter chapter=iChapterService.netChapter(fiction_id,sort);//获取小说内容ChapterContent chapterContent=iChapterContentService.getById(chapter.getContentId());model.addAttribute("chapter",chapter);model.addAttribute("content",chapterContent);model.addAttribute("title",chapter.getChapterTitle());return "chapter/read";}//上下页@RequestMapping(value = "netRead/{fiction_id}/{sort}/{status}",method = RequestMethod.GET)public String netChapter(@PathVariable("fiction_id") int fiction_id,@PathVariable("sort") int sort,@PathVariable("status") int status,Model model) {if (status==1){if (sort!=1){sort=sort-1;}}else {sort=sort+1;}Chapter chapter = iChapterService.netChapter(fiction_id,sort);//获取小说内容ChapterContent chapterContent=iChapterContentService.getById(chapter.getContentId());model.addAttribute("chapter",chapter);model.addAttribute("content",chapterContent);model.addAttribute("title",chapter.getChapterTitle());return "chapter/read";}
}

javaweb小说阅读网站源码相关推荐

  1. ptcms精美小说阅读网站源码(带采集规则)

    介绍: PTCMS精美小说阅读网站源码,压缩包内自带几条采集规则! 网盘下载地址: http://kekewl.net/WagqGdRfdfw0 图片:

  2. java计算机毕业设计小说阅读网站源码+系统+数据库+lw文档+mybatis+运行部署

    java计算机毕业设计小说阅读网站源码+系统+数据库+lw文档+mybatis+运行部署 java计算机毕业设计小说阅读网站源码+系统+数据库+lw文档+mybatis+运行部署 本源码技术栈: 项目 ...

  3. PTcms精美小说阅读网站源码/带采集规则

    本资源可免费获取,请至尾部读阅! PTcms精美小说阅读网站源码,内附多种采集规格,81中文.88读书.笔趣岛.谷粒网.棉花糖.随梦小说.天籁小说网等,压缩包内自带几条采集规则,不知道有没有失效,大家 ...

  4. Ptcms精美小说阅读网站源码+带采集规则

    正文: Ptcms精美小说阅读网站源码+带采集规则,其它的就没什么好介绍的了,有WAP端UI样式,具体可以看上面的封面. 下载方式: lanzou.com/i4wGO029gd7i

  5. java计算机毕业设计小说阅读网站源码+系统+mysql数据库+lw文档+部署

    java计算机毕业设计小说阅读网站源码+系统+mysql数据库+lw文档+部署 java计算机毕业设计小说阅读网站源码+系统+mysql数据库+lw文档+部署 本源码技术栈: 项目架构:B/S架构 开 ...

  6. springboot vue3 elementui plus小说阅读网站源码

    开发环境及工具: 大等于jdk1.8,大于mysql5.5,nodejs,idea(eclipse),vscode(webstorm) 技术说明: springboot mybatis vue3 el ...

  7. MONKOVEL-安卓端免费的小说阅读器 源码分享

    想了很久,还是决定把我最近的项目的源码发出来,有兴趣的可以共享,学习,交流.希望尊重作者,转载,商用请遵循本人. APP本地小说仅支持txt格式,将小说按章节分割存入数据库,在线小说来源是通过手机模拟 ...

  8. 文件管理系统源码_基于Spring Cloud微服务构建多平台功能完善小说弹幕网站源码分享...

    致力于打造一个完整的可商用.可学习的小说门户平台,重新进行了数据库设计.代码重构和功能增强,提升了程序整体的可读性和性能,增加了很多商用特性. 是一个多平台(web.安卓app.微信小程序).功能完善 ...

  9. 小说阅读Autojs源码学习

    "ui"; var rootUrl = ""; var storaySign = ""; var woolStorage = storage ...

  10. 帝国cms绿色清新情感美文文章阅读网站源码修复版(带手机端)

    帝国cms内核做的新闻文章类网站,修复了很多小bug,模板是清新的绿色美文网,有在线投稿功能,带有手机端,非常适合做文章分享.诗文.历史类文章的站点! 运行环境:php5.2/5.3/5.4+Mysq ...

最新文章

  1. 海思3559A上编译LIVE555源码操作步骤
  2. oracle修改表结构的sql命令是什么,sql语句中修改表结构的命令是什么?
  3. 2020 我的C++学习之路 C++PrimerPlus第四章课后习题
  4. C#new出来的结构体内存分配在堆上
  5. Netty之有效规避内存泄漏
  6. java io系列09之 FileDescriptor总结
  7. goroutine并发扫描MySQL表_goroutine 并发之搜索文件内容
  8. solor mysql_solr 同步 mysql
  9. Android 初探Retrofit2.0.1(最新版)
  10. T-SQL语言(一)
  11. 信息的哲学--从信息到数据存储,再到数据保护
  12. dns缓存时间 linux,如何在Linux服务器上刷新DNS缓存
  13. ARCGIS小工具(插件)免费版_自取_GIS插件_工具_其他
  14. 假设有一个英文文本文件,编写一个程序读取其内容并将里面的大写字母变成小写字母,小写字母变成大写字母
  15. 【考研数学】五. 二重积分
  16. IETester的使用(针对VB.NET视频)
  17. 路由器和计算机的功能有何不同,网关和路由器的区别是什么 两者又有什么不同...
  18. [健康]肾的保健按摩
  19. 《狂人日记》 词语解释 | 经典语录
  20. 对软件公司不要传智播客学生的驳斥

热门文章

  1. 学好平面设计需要哪些技术功底?
  2. 宏想固态无法格式化,SM2258XT主控开卡成功经验,SM2259XT可参考
  3. STM32F103系列控制的OLED IIC 4针
  4. java万能万年历的程序_Java编写多功能万年历程序的实例分享
  5. JavaSE 简单介绍
  6. Javase基础思维导图
  7. wps怎么免费导出简历_简历怎么写 简历模板word免费下载
  8. html留言页面设计,html的留言板制作(js)
  9. Wunderlist1.22(Window版)无法启动的解决方法
  10. 简简单单 谁说雅虎助手卸载不掉(转)