基于javaweb的SpringBoot汽车配件销售管理系统(java+springboot+layui+html+thymeleaf+maven+mysql)

运行环境

Java≥8、MySQL≥5.7

开发工具

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

适用

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

功能说明

140023272402

150023272402

160023272402

170023272402

190023272402

200023272402

基于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版本;

技术栈

  1. 后端:SpringBoot

  2. 前端:HTML+CSS+JavaScript+layui

使用说明
运行项目,输入localhost:8081/ 登录

管理员:admin/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
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";
}

/**
* 根据id删除配件类型
*
* @param id
* @return
*/
@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";
}

/**
* 根据配件类型删除
*
* @param goodsType
* @return
*/
@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) {
//根据用户对象的id 查询用户的密码,防止密码丢失
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";
}

/**
* 重置用户密码
*
* @param id
* @return
*/
@ApiOperation(value = "重置密码接口", notes = "根据用户ID查询用户重置密码为123456,最后进行MD5加密")
@GetMapping("/admin/user/resetPwd")
public String restPwd(@RequestParam("id") Integer id) {
if (id != null && id > 0) {
//根据id查询出用户
User user = userService.selectByPrimaryKey(id);
//开始重置密码,重置密码使用的Spring提供的工具类进行对密码123456进行加密
//user.setPassword(DigestUtils.md5DigestAsHex("123456".getBytes()));
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);
//组装Json数据
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;

/**
* 查询结果列表
*
* @param page
* @param limit
* @return
*/
@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");
//如果等于Null,则拦截请求
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");
//如果等于Null,则拦截请求
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


项目链接:
https://javayms.github.io?id=111422322105200jt
https://javayms.pages.dev?id=111422322105200jt