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






基于javaweb的SpringBoot汽车配件销售管理系统(java+springboot+layui+html+thymeleaf+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
前端:HTML+CSS+JavaScript+layui
使用说明
运行项目,输入localhost:8081/ 登录
管理员: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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| */ @ApiOperation(value = "配件类型保存接口",notes = "根据前台传入的json数据对象进行保存配件类型") @PostMapping("/admin/goodsType/save") public String addGoodsType(@RequestBody GoodsType goodsType) { logger.info("goodsType===" + goodsType); int insert = goodsTypeService.insert(goodsType); if (insert > 0) { return "success"; } return "error"; }
@ApiOperation(value = "配件类型删除接口",notes = "根据配件ID删除配件类型") @GetMapping("/admin/goodsType/del") public String delGoodsType(@RequestParam(value = "id") Integer id) { logger.info("删除的配件类型ID=" + id); int del = goodsTypeService.deleteByPrimaryKey(id); if (del > 0) { return "success"; } return "error"; }
@ApiOperation(value = "配件类型接口",notes = "根据json数据更新配件类型") @PostMapping("/admin/goodsType/update") public String updateGoodsType(@RequestBody GoodsType goodsType) { logger.info("更新配件类型数据=" + goodsType); int update = goodsTypeService.updateByPrimaryKey(goodsType); if (update > 0) { return "success"; } return "error"; }
|
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
| * 根据用户传入的对象进行更新 * * @param user * @return */ @ApiOperation(value = "用户对象更新", notes = "根据用户对象更新") @PostMapping("/admin/user/update") public String updateUser(@RequestBody User user) {
if (user != null) { User user1 = userService.selectByPrimaryKey(user.getId()); if (user1 != null) { user.setPassword(user1.getPassword()); int update = userService.updateByPrimaryKey(user); if (update > 0) { return "success"; } } } return "error"; }
@ApiOperation(value = "重置密码接口", notes = "根据用户ID查询用户重置密码为123456,最后进行MD5加密") @GetMapping("/admin/user/resetPwd") public String restPwd(@RequestParam("id") Integer id) { if (id != null && id > 0) { User user = userService.selectByPrimaryKey(id); user.setPassword("123456");
|
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
|
@Api("配件接口API") @RestController public class GoodsController { private Logger logger = LoggerFactory.getLogger(this.getClass()); @Autowired private GoodsService goodsService;
private String image = "";
@ApiOperation(value = "配件列表接口", notes = "配件结果集列表") @GetMapping("/admin/goodsList") public ServerLayResult<Goods> list(@RequestParam(value = "page", defaultValue = "1") Integer page, @RequestParam(value = "limit", defaultValue = "10") Integer limit) { int count = goodsService.count(); List<Goods> goods = goodsService.selectAll(page, limit); ServerLayResult result = new ServerLayResult(0, "", count, goods); return result; }
@ApiOperation(value = "配件删除接口", notes = "根据配件ID删除配件") @GetMapping("/admin/goods/del") public String delete(Integer id) { System.out.println("id = " + id); int row = goodsService.deleteByPrimaryKey(id); if (row > 0) { return "success"; } return "error"; }
@ApiOperation(value = "配件更新接口", notes = "根据json数据对象来更新接口") @PostMapping("/admin/goods/update") public String update(@RequestBody JSONObject ob) { com.alibaba.fastjson.JSONObject json = JSON.parseObject(ob.toJSONString()); logger.info(ob.toJSONString()); String gname = json.getString("gname"); Integer id = json.getInteger("id");
|
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
| logger.info("更新配件类型数据=" + goodsType); int update = goodsTypeService.updateByPrimaryKey(goodsType); if (update > 0) { return "success"; } return "error"; }
} package com.jacklin.myshop.controller;
@Api(value = "公告模块AIP接口") @RestController public class NoticeController {
@Autowired private NoticeService noticeService;
@SuppressWarnings("rawtypes") @ApiOperation(value = "公告模块接口",notes = "公告结果列表")
|
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
| public String orderDel(@RequestParam(value = "id") Integer id) { logger.info("订单id----" + id); if (id != null && id > 0) { int index = orderDetailService.deleteByOrderId(id); if (index > 0) { int delete = orderService.deleteByPrimaryKey(id); if (delete > 0) { return "success"; } } } return "error"; } } package com.jacklin.myshop.interceptor;
public class LoginInterceptor implements HandlerInterceptor {
private Logger logger = LoggerFactory.getLogger(this.getClass());
@Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { logger.info("LoginInterceptor.preHandle拦截器执行"); AdminUser loginName = (AdminUser) request.getSession().getAttribute("loginName"); if (loginName == 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
| * 登入拦截器 */ public class LoginInterceptor implements HandlerInterceptor {
private Logger logger = LoggerFactory.getLogger(this.getClass());
@Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { logger.info("LoginInterceptor.preHandle拦截器执行"); AdminUser loginName = (AdminUser) request.getSession().getAttribute("loginName"); if (loginName == null) { response.sendRedirect("/admin/login"); return false; } return true;
}
@Override public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
}
@Override public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
} } package com.jacklin.myshop.controller;
@Api("主页接口") @Controller
|
——————————PayStart——————————
项目链接:
https://javayms.github.io?id=111422322105200jt
https://javayms.pages.dev?id=111422322105200jt