基于javaweb的在线小说阅读系统(前后端分离+java+vue+springboot+ssm+mysql+redis)

基于javaweb的在线小说阅读系统(前后端分离+java+vue+springboot+ssm+mysql+redis)

运行环境

Java≥8、MySQL≥5.7、Node.js≥10

开发工具

后端:eclipse/idea/myeclipse/sts等均可配置运行

前端:WebStorm/VSCode/HBuilderX等均可

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

20220819220111

20220819220112

20220819220113

20220819220114

基于javaweb+mysql的在线小说阅读系统(前后端分离+java+vue+Springboot+ssm+mysql+maven+redis)

一、项目简述

本系统功能包括: 普通用户端登录注册,小说的分类,日榜,月榜,年榜, 小说的阅读,分章节,小说的评论,收藏,推荐等等,以 及后台小说的维护,上架,编辑等等。

二、项目运行

环境配置: Jdk1.8 + Tomcat8.5 + Mysql + HBuilderX (Webstorm也 行)+ Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts都支 持)。

项目技术: Springboot + Maven + Mybatis + Vue + Redis, B/S 模式+ Maven等等

商品分类控制器:

@RestController

@RequestMapping(“/api/category”)

@Api(tags = “共同前缀:/api/category”, descriiption = “CategoryController”)

@Slf4j

public class CategoryController {

@Autowired

CategoryService categoryService;

@PostMapping

@ApiOperation(“新增Category”)

@PreAuthorize(“hasAnyAuthority(‘ROLE_ADMIN’)”)

public ResponseObject post(@RequestBody Category category) {

log.info(“新增Category”);

if (category.getId() != null) {

throw new ControllerException(“id必须为null”);

} else if (category.getRank() == null) {

throw new ControllerException(“rank不可为null”);

} else if (category.getName() == null || category.getName().equals(“”)) {

throw new ControllerException(“name不可为null,也不可为空字符串”);

} else if (category.getParent_id() == null) {

throw new ControllerException(“parent_id不可为null”);

} else if (categoryService.selectByParent_idName(category.getParent_id(), category.getName()) != null) {

throw new ControllerException(“name不可重复”);

} else {

return new ResponseObject(“200”, “操作成功”, categoryService.insert(category));

@PutMapping(“/{id:[0-9]+}”)

@ApiOperation(“修改Category”)

@PreAuthorize(“hasAnyAuthority(‘ROLE_ADMIN’)”)

public ResponseObject putById(@PathVariable Integer id, @RequestBody HashMap<String, String> data) {

log.info(“修改Category”);

Category category = categoryService.selectById(id);

if (category == null) {

throw new ControllerException(“使用该id的Category不存在”);

} else if (categoryService.selectByParent_idName(category.getParent_id(), data.get(“name”)) != null) {

throw new ControllerException(“同一个分类下的name不可重复”);

} else {

category.setName(data.get(“name”));

return new ResponseObject(“200”, “操作成功”, categoryService.update(category));

@GetMapping

@ApiOperation(“查询Category”)

public ResponseObject getByParent_id(Integer rank, Integer parent_id) {

log.info(“查询Category”);

if (rank != null && parent_id != null) {

return new ResponseObject(“200”, “操作成功”, categoryService.selectByRankParent_id(rank, parent_id));

} else if (rank != null && parent_id == null) {

return new ResponseObject(“200”, “操作成功”, categoryService.selectByRank(rank));

} else if (rank == null && parent_id != null) {

return new ResponseObject(“200”, “操作成功”, categoryService.selectByParent_id(parent_id));

} else {

throw new ControllerException(“rank或者parent_id至少要有一个不为null”);

@GetMapping(“/{id:[0-9]+}”)

@ApiOperation(“查询Category”)

public ResponseObject getById(@PathVariable Integer id) {

log.info(“查询Category”);

if (id != null) {

return new ResponseObject(“200”, “操作成功”, categoryService.selectById(id));

} else {

throw new ControllerException(“id不可为null”);

用户信息控制器:

@RestController

@RequestMapping(“/api/user”)

@Api(tags = “共同前缀:/api/user”, descriiption = “UserController”)

@Slf4j

public class UserController {

@Autowired

UserService userService;

@PostMapping

@ApiOperation(“新增User”)

public ResponseObject post(String username, String password) {

log.info(“新增User”);

if (username == null || username.equals(“”)) {

throw new ControllerException(“username不可为null,也不可为空字符串”);

} else if (password == null || password.equals(“”)) {

throw new ControllerException(“password不可为null,也不可为空字符串”);

} else if (userService.selectByUsername(username) != null) {

throw new ControllerException(“该username已被使用”);

} else {

User user = new User();

user.setUsername(username);

user.setPassword(password);

user.setRole(“VIP1”);

user.setNickname(new Date().getTime() + “”);

user.setImage(“default_user_image.png”);

user.setEmail(“该用户没有填写邮箱”);

user.setPhone(“该用户没有填写手机号码”);

user.setProfile(“该用户没有填写个人简介”);

return new ResponseObject(“200”, “操作成功”, userService.insert(user));

@GetMapping(“/{id:[0-9]+}”)

@ApiOperation(“查询User”)

public ResponseObject getById(@PathVariable Integer id) {

log.info(“查询User”);

return new ResponseObject(“200”, “操作成功”, userService.selectById(id));

@PutMapping

@ApiOperation(“修改User”)

@PreAuthorize(“isAuthenticated()”)

public ResponseObject put(User user) {

log.info(“修改User”);

if (user.getNickname() == null || user.getNickname().equals(“”)) {

throw new ControllerException(“nickname不可为null,也不可为空字符串”);

} else if (user.getProfile() == null || user.getProfile().equals(“”)) {

throw new ControllerException(“profile不可为null,也不可为空字符串”);

} else if (user.getPhone() == null || user.getPhone().equals(“”)) {

throw new ControllerException(“phone不可为null,也不可为空字符串”);

} else if (user.getEmail() == null || user.getEmail().equals(“”)) {

throw new ControllerException(“email不可为null,也不可为空字符串”);

} else {

User user2 = userService

.selectByUsername((String) SecurityContextHolder.getContext().getAuthentication().getPrincipal());

user2.setNickname(user.getNickname());

user2.setProfile(user.getProfile());

user2.setPhone(user.getPhone());

user2.setEmail(user.getEmail());

return new ResponseObject(“200”, “操作成功”, userService.update(user2));

收藏控制器:

@RestController

@RequestMapping(“/api/collection”)

@Api(tags = “共同前缀:/api/collection”, descriiption = “CollectionController”)

@Slf4j

public class CollectionController {

@Autowired

CollectionService collectionService;

@Autowired

UserService userService;

@Autowired

NovelService novelService;

@PostMapping

@ApiOperation(“新增Collection”)

@PreAuthorize(“isAuthenticated()”)

public ResponseObject post(Collection collection) {

log.info(“新增Collection”);

if (collection.getId() != null) {

throw new ControllerException(“id必须为null”);

} else if (collection.getNovel_id() == null) {

throw new ControllerException(“novel_id不可为null”);

} else {

collection.setUser_id(userService

.selectByUsername((String) SecurityContextHolder.getContext().getAuthentication().getPrincipal())

.getId());

if (collectionService.selectByUser_idNovel_id(collection.getUser_id(), collection.getNovel_id()) != null) {

throw new ControllerException(“该用户已经收藏过该小说了,不可重复收藏”);

} else {

return new ResponseObject(“200”, “操作成功”, collectionService.insert(collection));

@GetMapping

@ApiOperation(“查询Collection”)

public ResponseObject get(Integer novel_id, Integer user_id) {

log.info(“查询Collection”);

if (novel_id != null && user_id != null) {

return new ResponseObject(“200”, “操作成功”, collectionService.selectByUser_idNovel_id(user_id, novel_id));

} else if (novel_id != null && user_id == null) {

return new ResponseObject(“200”, “操作成功”, collectionService.selectByNovel_id(novel_id));

} else if (novel_id == null && user_id != null) {

return new ResponseObject(“200”, “操作成功”, collectionService.selectByUser_id(user_id));

} else {

throw new ControllerException(“novel_id与user_id不可同时为null”);

@GetMapping(“/novel”)

@ApiOperation(“查询Collection的Novel”)

public ResponseObject getNovel(Integer user_id) {

log.info(“查询Collection的Novel”);

if (user_id == null) {

throw new ControllerException(“user_id不可为null”);

} else {

return new ResponseObject(“200”, “操作成功”, novelService.selectByUser_idOfCollection(user_id));

@DeleteMapping

@ApiOperation(“删除Collection”)

@PreAuthorize(“isAuthenticated()”)

public ResponseObject delete(Integer novel_id, Integer user_id) {

log.info(“删除Collection”);

if (novel_id == null) {

throw new ControllerException(“novel_id不可为null”);

} else if (user_id == null) {

throw new ControllerException(“user_id不可为null”);

} else {

Collection collection = collectionService.selectByUser_idNovel_id(user_id, novel_id);

if (collection == null) {

throw new ControllerException(“该用户还未收藏该小说,无法取消收藏”);

} else {

User user = userService.selectByUsername(

(String) SecurityContextHolder.getContext().getAuthentication().getPrincipal());

if (user.getId() == user_id || user.getRole().equals(“ADMIN”)) {

collectionService.deleteById(collection.getId());

return new ResponseObject(“200”, “操作成功”, null);

} else {

throw new ControllerException(“该用户无权限取消收藏”);

@GetMapping(“/count”)

@ApiOperation(“查询Collection”)

public ResponseObject getCount(Integer novel_id) {

log.info(“查询Collection”);

if (novel_id == null) {

throw new ControllerException(“novel_id不可为null”);

} else {

return new ResponseObject(“200”, “操作成功”, collectionService.selectByNovel_id(novel_id).size());


  • 0
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
网选课系统是一个非常实用的系统,可以方便学生进行选课操作,也可以方便教师进行课程管理。下面是一个基于JavaWeb的网上选课系统的设计思路: 1. 系统架构 该系统采用 B/S 架构,即浏览器/服务器架构。前端使用 HTML、CSS、JavaScript 和 JQuery,后端使用 Java+SSM 框架和 MySQL 数据库。 2. 系统功能 (1)学生模块:学生可以登录系统后进行选课操作,查看已选课程,并对已选课程进行退选操作。 (2)教师模块:教师可以登录系统后进行课程管理操作,包括添加课程、修改课程、删除课程等操作。 (3)管理员模块:管理员可以登录系统后对学生和教师进行管理,包括添加学生、添加教师、修改学生信息、修改教师信息等操作。 (4)公告管理:管理员可以发布公告,学生和教师可以浏览公告。 (5)选课规则管理:管理员可以设置选课规则,例如每个学生最多选择多少门课程,每门课程最多选多少人等。 3. 数据库设计 该系统需要设计以下数据库表: (1)学生表:包括学生编号、学生姓名、学生性别、学生年龄、所在班级等字段。 (2)教师表:包括教师编号、教师姓名、教师性别、所教课程、教龄等字段。 (3)课程表:包括课程编号、课程名称、授课教师、上课时间、选课人数等字段。 (4)选课记录表:包括学生编号、课程编号等字段。 (5)公告表:包括公告编号、公告内容、发布时间等字段。 4. 技术实现 该系统采用 Java+SSM 框架进行实现,其中: (1)后端技术:采用 SpringMVC 框架进行控制器的开发,采用 MyBatis 框架进行数据库操作。 (2)前端技术:采用 HTML、CSS、JavaScript 和 JQuery 进行页面布局和交互效果的实现。 (3)数据库技术:采用 MySQL 数据库进行数据存储和管理。 5. 总结 网上选课系统是一个非常实用的系统,它可以方便学生进行选课操作,也可以方便教师进行课程管理。该系统采用 B/S 架构,采用 Java+SSM 框架进行开发,实现了学生模块、教师模块、管理员模块、公告管理和选课规则管理等功能。在实现时需要注意数据库表的设计和技术实现。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值