• SpringBoot+Vue项目在线小说阅读平台


    文末获取源码

    开发语言:Java

    框架:springboot

    JDK版本:JDK1.8

    服务器:tomcat7

    数据库:mysql 5.7/8.0

    数据库工具:Navicat11

    开发软件:eclipse/myeclipse/idea

    Maven包:Maven3.3.9

    浏览器:谷歌浏览器

    前言介绍

    系统采用了Java技术springboot框架,前端使用 element-ui 组件库,选择MySQL作为系统的数据库,开发工具选择 idea来进行系统的设计。基本实现了在线小说阅读平台应有的主要功能模块,本系统有以下功能:

    (1)前台:首页、小说信息、交流论坛、公告资讯、个人中心、后台管理。 

    (2)管理员:首页、个人中心、会员管理、小说分类管理、小说信息管理、小说评分管理、交流论坛、系统管理。

    (3)会员:首页、个人中心。

    系统展示

    前台 

     

    小说信息

     

    公告资讯

    管理员功能

    登录

     

    会员管理

    小说分类管理 

     

    小说信息管理 

    小说评分管理 

    部分核心代码 

     

    1. # Tomcat
    2. server:
    3. tomcat:
    4. uri-encoding: UTF-8
    5. port: 8080
    6. servlet:
    7. context-path: /springbootm3h7l
    8. spring:
    9. datasource:
    10. driverClassName: com.mysql.jdbc.Driver
    11. url: jdbc:mysql://127.0.0.1:3306/springbootm3h7l?useUnicode=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8
    12. username: root
    13. password:
    14. # driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
    15. # url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=springbootm3h7l
    16. # username: sa
    17. # password: 123456
    18. servlet:
    19. multipart:
    20. max-file-size: 300MB
    21. max-request-size: 300MB
    22. resources:
    23. static-locations: classpath:static/,file:static/
    24. #mybatis
    25. mybatis-plus:
    26. mapper-locations: classpath*:mapper/*.xml
    27. #实体扫描,多个package用逗号或者分号分隔
    28. typeAliasesPackage: com.entity
    29. global-config:
    30. #主键类型 0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID";
    31. id-type: 1
    32. #字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断"
    33. field-strategy: 1
    34. #驼峰下划线转换
    35. db-column-underline: true
    36. #刷新mapper 调试神器
    37. refresh-mapper: true
    38. #逻辑删除配置
    39. logic-delete-value: -1
    40. logic-not-delete-value: 0
    41. #自定义SQL注入器
    42. sql-injector: com.baomidou.mybatisplus.mapper.LogicSqlInjector
    43. configuration:
    44. map-underscore-to-camel-case: true
    45. cache-enabled: false
    46. call-setters-on-nulls: true
    47. #springboot 项目mybatis plus 设置 jdbcTypeForNull (oracle数据库需配置JdbcType.NULL, 默认是Other)
    48. jdbc-type-for-null: 'null'
    1. /**
    2. * 小说信息
    3. * 后端接口
    4. * @author
    5. * @email
    6. * @date 2022-05-08 15:02:29
    7. */
    8. @RestController
    9. @RequestMapping("/xiaoshuoxinxi")
    10. public class XiaoshuoxinxiController {
    11. @Autowired
    12. private XiaoshuoxinxiService xiaoshuoxinxiService;
    13. @Autowired
    14. private StoreupService storeupService;
    15. /**
    16. * 后端列表
    17. */
    18. @RequestMapping("/page")
    19. public R page(@RequestParam Map<String, Object> params,XiaoshuoxinxiEntity xiaoshuoxinxi,
    20. HttpServletRequest request){
    21. EntityWrapper<XiaoshuoxinxiEntity> ew = new EntityWrapper<XiaoshuoxinxiEntity>();
    22. PageUtils page = xiaoshuoxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, xiaoshuoxinxi), params), params));
    23. return R.ok().put("data", page);
    24. }
    25. /**
    26. * 前端列表
    27. */
    28. @IgnoreAuth
    29. @RequestMapping("/list")
    30. public R list(@RequestParam Map<String, Object> params,XiaoshuoxinxiEntity xiaoshuoxinxi,
    31. HttpServletRequest request){
    32. EntityWrapper<XiaoshuoxinxiEntity> ew = new EntityWrapper<XiaoshuoxinxiEntity>();
    33. PageUtils page = xiaoshuoxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, xiaoshuoxinxi), params), params));
    34. return R.ok().put("data", page);
    35. }
    36. /**
    37. * 列表
    38. */
    39. @RequestMapping("/lists")
    40. public R list( XiaoshuoxinxiEntity xiaoshuoxinxi){
    41. EntityWrapper<XiaoshuoxinxiEntity> ew = new EntityWrapper<XiaoshuoxinxiEntity>();
    42. ew.allEq(MPUtil.allEQMapPre( xiaoshuoxinxi, "xiaoshuoxinxi"));
    43. return R.ok().put("data", xiaoshuoxinxiService.selectListView(ew));
    44. }
    45. /**
    46. * 查询
    47. */
    48. @RequestMapping("/query")
    49. public R query(XiaoshuoxinxiEntity xiaoshuoxinxi){
    50. EntityWrapper< XiaoshuoxinxiEntity> ew = new EntityWrapper< XiaoshuoxinxiEntity>();
    51. ew.allEq(MPUtil.allEQMapPre( xiaoshuoxinxi, "xiaoshuoxinxi"));
    52. XiaoshuoxinxiView xiaoshuoxinxiView = xiaoshuoxinxiService.selectView(ew);
    53. return R.ok("查询小说信息成功").put("data", xiaoshuoxinxiView);
    54. }
    55. /**
    56. * 后端详情
    57. */
    58. @RequestMapping("/info/{id}")
    59. public R info(@PathVariable("id") Long id){
    60. XiaoshuoxinxiEntity xiaoshuoxinxi = xiaoshuoxinxiService.selectById(id);
    61. xiaoshuoxinxi.setClicknum(xiaoshuoxinxi.getClicknum()+1);
    62. xiaoshuoxinxi.setClicktime(new Date());
    63. xiaoshuoxinxiService.updateById(xiaoshuoxinxi);
    64. return R.ok().put("data", xiaoshuoxinxi);
    65. }
    66. /**
    67. * 前端详情
    68. */
    69. @IgnoreAuth
    70. @RequestMapping("/detail/{id}")
    71. public R detail(@PathVariable("id") Long id){
    72. XiaoshuoxinxiEntity xiaoshuoxinxi = xiaoshuoxinxiService.selectById(id);
    73. xiaoshuoxinxi.setClicknum(xiaoshuoxinxi.getClicknum()+1);
    74. xiaoshuoxinxi.setClicktime(new Date());
    75. xiaoshuoxinxiService.updateById(xiaoshuoxinxi);
    76. return R.ok().put("data", xiaoshuoxinxi);
    77. }
    78. /**
    79. * 后端保存
    80. */
    81. @RequestMapping("/save")
    82. public R save(@RequestBody XiaoshuoxinxiEntity xiaoshuoxinxi, HttpServletRequest request){
    83. xiaoshuoxinxi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
    84. //ValidatorUtils.validateEntity(xiaoshuoxinxi);
    85. xiaoshuoxinxiService.insert(xiaoshuoxinxi);
    86. return R.ok();
    87. }
    88. /**
    89. * 前端保存
    90. */
    91. @RequestMapping("/add")
    92. public R add(@RequestBody XiaoshuoxinxiEntity xiaoshuoxinxi, HttpServletRequest request){
    93. xiaoshuoxinxi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
    94. //ValidatorUtils.validateEntity(xiaoshuoxinxi);
    95. xiaoshuoxinxiService.insert(xiaoshuoxinxi);
    96. return R.ok();
    97. }
    98. /**
    99. * 修改
    100. */
    101. @RequestMapping("/update")
    102. @Transactional
    103. public R update(@RequestBody XiaoshuoxinxiEntity xiaoshuoxinxi, HttpServletRequest request){
    104. //ValidatorUtils.validateEntity(xiaoshuoxinxi);
    105. xiaoshuoxinxiService.updateById(xiaoshuoxinxi);//全部更新
    106. return R.ok();
    107. }
    108. /**
    109. * 删除
    110. */
    111. @RequestMapping("/delete")
    112. public R delete(@RequestBody Long[] ids){
    113. xiaoshuoxinxiService.deleteBatchIds(Arrays.asList(ids));
    114. return R.ok();
    115. }
    116. /**
    117. * 提醒接口
    118. */
    119. @RequestMapping("/remind/{columnName}/{type}")
    120. public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
    121. @PathVariable("type") String type,@RequestParam Map<String, Object> map) {
    122. map.put("column", columnName);
    123. map.put("type", type);
    124. if(type.equals("2")) {
    125. SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
    126. Calendar c = Calendar.getInstance();
    127. Date remindStartDate = null;
    128. Date remindEndDate = null;
    129. if(map.get("remindstart")!=null) {
    130. Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
    131. c.setTime(new Date());
    132. c.add(Calendar.DAY_OF_MONTH,remindStart);
    133. remindStartDate = c.getTime();
    134. map.put("remindstart", sdf.format(remindStartDate));
    135. }
    136. if(map.get("remindend")!=null) {
    137. Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
    138. c.setTime(new Date());
    139. c.add(Calendar.DAY_OF_MONTH,remindEnd);
    140. remindEndDate = c.getTime();
    141. map.put("remindend", sdf.format(remindEndDate));
    142. }
    143. }
    144. Wrapper<XiaoshuoxinxiEntity> wrapper = new EntityWrapper<XiaoshuoxinxiEntity>();
    145. if(map.get("remindstart")!=null) {
    146. wrapper.ge(columnName, map.get("remindstart"));
    147. }
    148. if(map.get("remindend")!=null) {
    149. wrapper.le(columnName, map.get("remindend"));
    150. }
    151. int count = xiaoshuoxinxiService.selectCount(wrapper);
    152. return R.ok().put("count", count);
    153. }
    154. /**
    155. * 前端智能排序
    156. */
    157. @IgnoreAuth
    158. @RequestMapping("/autoSort")
    159. public R autoSort(@RequestParam Map<String, Object> params,XiaoshuoxinxiEntity xiaoshuoxinxi, HttpServletRequest request,String pre){
    160. EntityWrapper<XiaoshuoxinxiEntity> ew = new EntityWrapper<XiaoshuoxinxiEntity>();
    161. Map<String, Object> newMap = new HashMap<String, Object>();
    162. Map<String, Object> param = new HashMap<String, Object>();
    163. Iterator<Map.Entry<String, Object>> it = param.entrySet().iterator();
    164. while (it.hasNext()) {
    165. Map.Entry<String, Object> entry = it.next();
    166. String key = entry.getKey();
    167. String newKey = entry.getKey();
    168. if (pre.endsWith(".")) {
    169. newMap.put(pre + newKey, entry.getValue());
    170. } else if (StringUtils.isEmpty(pre)) {
    171. newMap.put(newKey, entry.getValue());
    172. } else {
    173. newMap.put(pre + "." + newKey, entry.getValue());
    174. }
    175. }
    176. params.put("sort", "clicknum");
    177. params.put("order", "desc");
    178. PageUtils page = xiaoshuoxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, xiaoshuoxinxi), params), params));
    179. return R.ok().put("data", page);
    180. }
    181. }

  • 相关阅读:
    jvm概述
    CNPM、NPM 和 Yarn:JavaScript 包管理器的比较
    Jetson Nano下载C++ 版本的GPIO 并配置进qt项目
    golang 控制并发有两种经典方式:WaitGroup 和 Context
    xcode开发ios应用简介
    【C++】STL详解(七)—— stack和queue的使用及模拟实现
    汇编的指令
    memmove函数详解 看这一篇就够了-C语言(函数讲解、函数实现、使用用法举例、作用、自己实现函数 )
    前端技术选型
    Spring Security学习笔记(一)Spring Security架构原理
  • 原文地址:https://blog.csdn.net/m0_49113107/article/details/126235105