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






基于javaweb的SpringBoot在线电子商城管理系统(java+springboot+thymeleaf+bootstrap+thymeleaf+html+layui+maven+mysql)
项目介绍
本项目分为管理员与普通用户两种角色, 管理员角色包含以下功能: 发货,后台登录后首页,商品管理,商城类别增删改查,用户管理,管理员登录,订单管理,资料截图,首页等功能。 用户角色包含以下功能:
查看分类,加入购物车,提交订单,查看商品详情,查看订单,用户登录等功能。
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
4.数据库:MySql 5.7版本;
技术栈
后端:SpringBoot+Thymeleaf
前端:HTML+CSS+JavaScript+bootstrap+jQuery+layui
使用说明
运行项目,在浏览器中输入http://localhost:8082/mall/ 登录 普通用户账号密码: me/123456
管理员账号密码: admin/123456
——————————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
|
@Controller @RequestMapping("/admin/classification") public class AdminClassificationController { @Autowired private ClassificationService classificationService;
@RequestMapping("/toList.html") public String toList(int type) { if (type == 1) { return "admin/category/list"; } else if (type == 2) { return "admin/categorysec/list"; } else { return ""; } }
|
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
| } } package priv.jesse.mall.web.user;
@Controller @RequestMapping("/user") public class UserController { @Autowired private UserService userService;
@RequestMapping("/toRegister.html") public String toRegister() { return "mall/user/register"; }
@RequestMapping("/login.html") public String toLogin() {
|
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
| if (order == null) throw new RuntimeException("订单不存在"); orderDao.updateState(STATE_COMPLETE,order.getId()); } } package priv.jesse.mall.filter;
@WebFilter public class AuthorizationFilter implements Filter {
public AuthorizationFilter() { }
private static final Logger LOGGER = LoggerFactory.getLogger(AuthorizationFilter.class);
@Override public void init(FilterConfig filterConfig) throws ServletException { }
|
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
| List<OrderItem> list = orderService.findItems(orderId); return new ResultBean<>(list); }
@ResponseBody @RequestMapping("/send.do") public ResultBean<Boolean> send(int id) { orderService.updateStatus(id,3); return new ResultBean<>(true); } } package priv.jesse.mall.aspect;
@Aspect @Order(5) @Component public class WebLogAspect {
|
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
| } package priv.jesse.mall.service.impl;
@Service public class OrderServiceImpl implements OrderService { @Autowired private OrderDao orderDao; @Autowired private OrderItemDao orderItemDao; @Autowired private ProductDao productDao; @Autowired private ShopCartService shopCartService;
@Override public Order findById(int id) { return orderDao.getOne(id); }
@Override public Page<Order> findAll(Pageable pageable) { return orderDao.findAll(pageable); }
@Override public List<Order> findAllExample(Example<Order> example) { return orderDao.findAll(example); }
@Override
|
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
| e.printStackTrace(); ResultBean<String> r = new ResultBean<>(e); r.setData(req.getRequestURI()); return r; }
@ExceptionHandler(value = RuntimeException.class) public void runtimeExceptionHandler(HttpServletRequest req, HttpServletResponse res, Exception e) throws Exception { LOGGER.error(e.getMessage(), e); req.setAttribute("msg", e.getMessage()); req.getRequestDispatcher("/mall/user/error.html").forward(req, res); }
@ExceptionHandler(value = ConstraintViolationException.class) @ResponseBody public ResultBean<String> validationExceptionHandler(HttpServletRequest req, ConstraintViolationException e) throws Exception { Set<ConstraintViolation<?>> violations = e.getConstraintViolations(); StringBuilder strBuilder = new StringBuilder(); for (ConstraintViolation<?> violation : violations) { strBuilder.append(violation.getMessage() + ","); } LOGGER.error(strBuilder.toString(), e); ResultBean<String> r = new ResultBean(strBuilder.toString()); r.setData(req.getRequestURI()); return r; }
} package priv.jesse.mall.web.admin;
|
——————————PayStart——————————
项目链接:
https://javayms.github.io?id=031422282105200ce
https://javayms.pages.dev?id=031422282105200ce