基于javaweb+mysql的springboot网上书城管理系统(java+springboot+vue+elementui+axios+mysql)
私信源码获取及调试交流
运行环境
Java≥8、MySQL≥5.7、Node.js≥10
开发工具
后端:eclipse/idea/myeclipse/sts等均可配置运行
前端:WebStorm/VSCode/HBuilderX等均可
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb的SpringBoot网上书城管理系统(java+springboot+vue+elementui+axios+mysql)
项目介绍
基于SpringBoot+Vue的网上书城系统(前后端分离项目) 本项目分为前后台,前台为普通用户登录,后台为管理员登录; 角色:管理员、用户 功能:首页推荐(默认根据用户买过的商品进行推荐,如果没买过则根据商品销量推荐)、轮播图管理、商品、订单、购物车、商品评论、商品评论点赞、商品收藏、商品点赞、订单支付、公告、权限控制等。
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 4.数据库:MySql 5.7/8.0版本均可; 5.是否Maven项目:是; 6.是否为前后端分离项目:是
技术栈
后台:SpringBoot+Mybatis-plus+Mybatis+lombok插件
前台:Vue+Vue Router+ELementUI+Axios
使用说明
先启动后端再启动前端 后端: 1. 使用Navicat或者其它工具,在mysql中创建对应sql文件名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入后端项目end文件夹,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中application.yml配置文件中的数据库配置改为自己的配置; 4. 运行项目,后端运行成功后再运行前端项目;
前端: 1、确保安装好node及npm,命令行切换到front所在路径 2、执行npm run serve启动项目
后台地址:http://localhost:8001/login 用户: tom/123456 管理员: admin/admin
书城首页展示:
添加购物车展示:
订单页面列表展示:
收藏夹页面展示:
后台管理统计页面:
后台管理订单管理页面:
轮播图展示管理:
后台商品管理展示:
后台登录页面展示:
@Autowired
private ISupplierService iSupplierService;
/**
* 图书列表
* @param model
* @return
*/
@GetMapping("/home")
public String toAdminHome(
@RequestParam(defaultValue = "1") Integer num,
@RequestParam(defaultValue = "5")Integer size,
Model model
) {
PageInfo<OrderForm> orderFormPageInfo = new PageInfo<>(orderFormList);
return orderFormPageInfo;
/**
* 新增订单
* 1、将商品销售增加
* 2、剩余量减少
* 3、产生订单
* @param orderForm
* @return
*/
@PostMapping("/saveOrderForm")
@SessionAttributes({"bookTypeList"})
public class BookController {
@Autowired
private IBookTypeService iBookTypeService;
@Autowired
private IBookService iBookService;
@Autowired
private ISupplierService iSupplierService;
/**
* 图书列表
* @param model
* @return
*/
@RequestMapping("/users")
@SessionAttributes({"userId","userName","password","adminId","adminName","adminpassword"})
public class UserController {
@Autowired
private IUserService iUserService;
/**
* 跳转用户登录页面
* @return
*/
@GetMapping("/login")
public String login() {
/**
* 返回JSON
* 查询所有图书类型
*/
@GetMapping("/findAllBookType1")
public @ResponseBody PageInfo<BookType> findAllBookType1(
@RequestParam(defaultValue = "1") Integer num,
@RequestParam(defaultValue = "5")Integer size
) {
List<BookType> bookTypeList = iBookTypeService.findAllBookType(num,size);
PageInfo<BookType> bookTypePageInfo = new PageInfo<>(bookTypeList);
return bookTypePageInfo;
model.addAttribute("booksPageInfo", booksPageInfo);
return "/backstage/home";
/**
* 图书列表
* @param model
* @return
*/
@GetMapping("/home1")
public @ResponseBody PageInfo<Books> toAdminHome1(
@RequestParam(defaultValue = "1") Integer num,
@RequestParam(defaultValue = "5")Integer size,
Model model
@PostMapping("/saveBook")
public String saveBook(Books books) {
// System.out.println("Books:="+books);
iBookService.saveBook(books);
return "redirect:/book/home";
/**
* 前台首页
* @return
*/
@GetMapping("/qiantai")
public String updatePwd(User u) {
// System.out.println("User:"+u);
// 判断是否为管理员还是用户
if (u.getTag() != 1) {
int i = iUserService.updatePwd(u);
// System.out.println("ipwd=="+i);
if (i != 1) {
System.out.println("个人信息修改失败");
return "/frontdesk/update_pwd";
return "redirect:/users/toLoginOut";
// System.out.println("User:"+u);
int i = iUserService.updatePwd(u);
*/
@GetMapping("/home1")
public @ResponseBody PageInfo<Books> toAdminHome1(
@RequestParam(defaultValue = "1") Integer num,
@RequestParam(defaultValue = "5")Integer size,
Model model
) {
// 获取导航栏
List<BookType> bookTypeList = iBookTypeService.findAllBookType(1,100);
model.addAttribute("bookTypeList", bookTypeList);
// 获取供应商
List<Supplier> supplierList = iSupplierService.findAllSupplier(1,100 );
model.addAttribute("supplierList", supplierList);
// 获取图书
@GetMapping("/findAllBookType1")
public @ResponseBody PageInfo<BookType> findAllBookType1(
@RequestParam(defaultValue = "1") Integer num,
@RequestParam(defaultValue = "5")Integer size
) {
List<BookType> bookTypeList = iBookTypeService.findAllBookType(num,size);
PageInfo<BookType> bookTypePageInfo = new PageInfo<>(bookTypeList);
return bookTypePageInfo;
/**
* 新增图书类型
* @param bookType
*/
@PostMapping("/updateOrderForm")
public @ResponseBody int updateOrderForm(OrderForm orderForm) {
int i = iOrderFormService.updateOrderForm(orderForm);
return i;
/**
* 移除该用户的某一订单
* @param id
* @return
*/
@PostMapping("/deleteShopping/{uid}/{id}")
public @ResponseBody int findByUid(@PathVariable Integer uid,@PathVariable Integer id) {
int i = iOrderFormService.deleteOrderForm(uid,id);
@Autowired
private ISupplierService iSupplierService;
/**
* 图书列表
* @param model
* @return
*/
@GetMapping("/home")
public String toAdminHome(
@RequestParam(defaultValue = "1") Integer num,
@RequestParam(defaultValue = "5")Integer size,
List<Books> booksList = iBookService.findAllBook(num,size);
PageInfo<Books> booksPageInfo = new PageInfo<>(booksList);
model.addAttribute("booksPageInfo", booksPageInfo);
return "/backstage/home";
/**
* 图书列表
* @param model
* @return
*/
@GetMapping("/home1")
public @ResponseBody PageInfo<Books> toAdminHome1(
@RequestParam(defaultValue = "1") Integer num,
@RequestParam(defaultValue = "5")Integer size,
System.out.println("个人信息修改失败");
return "/backstage/update_pwd";
return "redirect:/users/toAdminLoginOut";
/**
* 退出登录
* @return
*/
@GetMapping("/toLoginOut")
public String toLoginOut(SessionStatus status) {
status.setComplete();
boolean complete = status.isComplete();
if (complete) {
System.out.println("退出成功");
* 跳转用户注册页面
* @return
*/
@GetMapping("/register")
public String register() {
return "/frontdesk/register";
/**
* 用户注册
* @return
*/
@PostMapping("/toRegister")
public String toRegister(User u) {
// System.out.println("注册信息:"+u);
int i = iUserService.toRegister(u);
* @return
*/
@PostMapping("/uploaddetail")
public @ResponseBody int uploaddetail(HttpServletRequest request, MultipartFile file) {
int i = iBookService.uploaddetail(request,file);
return i;
/**
*新增图书
* @return
*/
@PostMapping("/saveBook")
public String saveBook(Books books) {
// System.out.println("Books:="+books);
* 通过图书类型Id查询图书
* @param tid
* @param model
* @return
*/
@GetMapping("/findByTid/{tid}")
public String findByTid(@PathVariable Integer tid,@RequestParam(defaultValue = "1") Integer num,@RequestParam(defaultValue = "10")Integer size,Model model) {
List<Books> booksList = iBookService.findByTid(tid,num,size);
PageInfo<Books> booksPageInfo = new PageInfo<>(booksList);
model.addAttribute("booksPageInfo", booksPageInfo);
model.addAttribute("tid",tid);
return "/frontdesk/home";
@PostMapping("/deleteBook/{id}")