——————————DescriptionStart——————————
运行环境
Java≥8、MySQL≥5.7
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明





基于javaweb的SpringBoot前台展示+后台管理结合的在线购书系统(java+springboot+ssm+mysql+maven)
一、项目简述
功能:一个基于JavaWeb的网上书店的设计与实现,归纳 出了几个模块,首先是登录注册模块,图书查找模块,购物车模块,订单模块,个人中心模块,用户管理模块,图 书管理模块等。 该项目是javaJeb技术的实战操作,采用了MVC设计模 式,包括基本的entity, jscript, servlet,以及ajax异步请 求,查询分页,持久化层方法的封装等等,对javaweb技 术的巩固很有帮助,为J2EE的学习打下基础,适用于课程 设计,毕业设计。
二、项目运行
环境配置: Jdk1.8 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持)
项目技术: JSP +Springboot+ SpringMVC + MyBatis + html+ css + JavaScript + JQuery + Ajax + maven等等
——————————CodeStart——————————
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| PageInfo pageInfo = new PageInfo(orders); return new ResultVO(ResultCode.SUCCESS,(int)pageInfo.getTotal(),orders); }
@PostMapping("/submit") public ResultVO orderSubmit(@RequestBody @Valid Order order, HttpSession session) { User user = (User) session.getAttribute("user"); order.setUserId(user.getUserId()); orderHandleService.createOrder(order); return new ResultVO(ResultCode.SUCCESS,"/"+user.getUserName()+"/orders"); }
@PutMapping("/list/{orderId}") public ResultVO updateOrder(@PathVariable("orderId") Integer orderId,@RequestBody Order order) { Order orders1 = orderService.selectByOrderId(orderId); if(orders1!=null) { order.setOrderId(orderId); int orders = orderService.updateByOrderId(order); return new ResultVO(ResultCode.SUCCESS,null); } else return new ResultVO(ResultCode.RECORD_NOT_FOUND,null); }
@DeleteMapping("/list/{orderId}") public ResultVO deleteOrder(@PathVariable("orderId") Integer orderId) { int orders = orderService.deleteByOrderId(orderId); return new ResultVO(ResultCode.SUCCESS,null);
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| @Controller public class LoginRegisterController {
@Autowired private LoginRegisterService loginRegisterService;
@PostMapping("/user/login") @ResponseBody public ResultVO userLoginHandler(@RequestBody @Valid User user, HttpSession session) { loginRegisterService.userLogin(user,session); return new ResultVO(ResultCode.SUCCESS,"/"); }
@PostMapping("/user/register") @ResponseBody public ResultVO userRegisterHandler(@RequestBody @Valid User user) { loginRegisterService.userRegister(user); return new ResultVO(ResultCode.SUCCESS,"/login"); }
@PostMapping("/admin/login") @ResponseBody public ResultVO adminLoginHandler(@RequestBody Admin admin, HttpSession session) { if(!("admin".equals(admin.getAdminName())&& "123456".equals(admin.getPassword()))){ throw new CustomizeException(ResultCode.FAILED,"管理员账户或密码错误"); } session.setAttribute("admin",admin);
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| public ResultVO bookUpdate(@Valid Book record) { int books = bookService.bookUpdate(record); return new ResultVO(ResultCode.SUCCESS, null); }
@GetMapping("/search") public ResultVO searchBooks(Book book,Integer page, Integer limit) { if(book.getBookName().isEmpty()){ book.setBookName(null); } if(book.getIsbn().isEmpty()){ book.setIsbn(null); } List<Book> books = bookService.searchBooks(book, page, limit); PageInfo pageInfo = new PageInfo(books); return new ResultVO(ResultCode.SUCCESS, (int) pageInfo.getTotal(), books); }
} package com.demo.controller;
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| */ @DeleteMapping("/list/{cartId}") public ResultVO deleteCartItem(@PathVariable("cartId") Integer cartId) { shoppingCartService.deleteShoppingCartByCartId(cartId); return new ResultVO(ResultCode.SUCCESS); }
@DeleteMapping("/list") public ResultVO deleteCartItem(@RequestBody int[] cartIds) { shoppingCartService.deleteShoppingCarts(cartIds); return new ResultVO(ResultCode.SUCCESS); }
} package com.demo.controller;
@RestController @RequestMapping("/user") public class UserController { @Autowired private UserService userService;
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| shoppingCartService.updateShoppingCart(cart); return new ResultVO(ResultCode.SUCCESS); }
@PostMapping("/list") public ResultVO addToShoppingCart(@Valid ShoppingCart cart, HttpSession session) { User user = (User) session.getAttribute("user"); cart.setUserId(user.getUserId()); shoppingCartService.addToShoppingCart(cart); return new ResultVO(ResultCode.SUCCESS); }
@DeleteMapping("/list/{cartId}") public ResultVO deleteCartItem(@PathVariable("cartId") Integer cartId) { shoppingCartService.deleteShoppingCartByCartId(cartId); return new ResultVO(ResultCode.SUCCESS); }
@DeleteMapping("/list") public ResultVO deleteCartItem(@RequestBody int[] cartIds) { shoppingCartService.deleteShoppingCarts(cartIds); return new ResultVO(ResultCode.SUCCESS); }
} package com.demo.controller;
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
@RestController @RequestMapping("category") public class CategoryController { @Autowired private CategoryService categoryService; @Resource private CategoryMapper categoryMapper; @GetMapping("/searchcode") public ResultVO categorySearchByCode(String categoryCode) { Category categories = categoryService.selectByByCategoryCode(categoryCode); if(categories!=null) return new ResultVO(ResultCode.SUCCESS,categories); else return new ResultVO(ResultCode.RECORD_NOT_FOUND,null); } @PostMapping("/delete") public ResultVO categoryDelete(String categoryCode) { int categories = categoryService.deleteByByCategoryCode(categoryCode); return new ResultVO(ResultCode.SUCCESS,null); }
@PostMapping("/insert") public ResultVO categoryInsert(@Valid Category record) {
|
——————————PayStart——————————
项目链接:
https://javayms.github.io?id=021422312105200hk
https://javayms.pages.dev?id=021422312105200hk