基于javaweb的SpringBoot汽车租赁管理系统(java+springboot+maven+ssm+jsp+js+mysql)

运行环境

Java≥8、MySQL≥5.7

开发工具

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

适用

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

功能说明

472323471807

482323471807

492323471807

502323471807

512323471807

522323471807

基于javaweb的SpringBoot汽车租赁管理系统(java+springboot+maven+ssm+jsp+js+mysql)

项目介绍角色:管理员、用户

用户登录进入汽车租赁系统 可以查看首页、个人中心、租赁信息管理、续租信息管理、归还信息管理、违章记录管理

管理员登录进入汽车租赁系统可以查看首页、个人中心、汽车类型管理,汽车信息管理,租赁信息管理,用户管理、续租信息管理、归还信息管理、保险信息管理、违章记录管理、留言板管理、系统管理等

环境需要
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等版本均可;

技术栈 后端:SpringBoot+SSM(Spring+SpringMVC+Mybatis)+JSP

使用说明 1. 使用Navicat或者其它工具,在mysql中创建对应sql文件名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,修改配置,运行项目;  

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
        RespResult respResult = new RespResult();
User user = (User) session.getAttribute(SessionConstant.KEY_USER);
Collect c = collectMapper.selectByUserId(collect.getCommodityId(), user.getId());
// 判断是否已经收藏过
if (c == null) {
collect.setUserId(user.getId());
collectMapper.insertSelective(collect);

// 收藏量 + 1
Commodity commodity = commodityMapper.selectByPrimaryKey(collect.getCommodityId());
commodity.setCollectCount(commodity.getCollectCount() + 1);
commodityMapper.updateByPrimaryKeySelective(commodity);
} else {
respResult.error("收藏失败:不可重复收藏");
}
return respResult;
}

// 删除
@ResponseBody
@RequestMapping("/delete")
public RespResult delete(@RequestBody Integer id) {
collectMapper.deleteByPrimaryKey(id);
return new RespResult();
}

}



@Controller
@RequestMapping("/likes")
public class LikesController {

private String prefix = "/user/likes/";

@Resource
private LikesMapper likesMapper;
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
46
47
48
49
50
51
52
    int count = articleMapper.selectCountByPaging(title);
RespResult respResult = new RespResult();
respResult.success(data, count);
return respResult;
}

// 添加
@RequestMapping("/add.html")
public String addHtml() {
return prefix + "add";
}

@ResponseBody
@RequestMapping("/add")
public RespResult add(@RequestBody Article article, HttpSession session) {
User user = (User) session.getAttribute(SessionConstant.KEY_USER);
article.setUserId(user.getId());
article.setCreatDate(new Date());
articleMapper.insertSelective(article);
return new RespResult();
}

// 编辑
@RequestMapping("/edit.html")
public String editHtml(@RequestParam("id") int id, Model model) {
Article article = articleMapper.selectByPrimaryKey(id);
model.addAttribute("article", article);
return prefix + "edit";
}

@ResponseBody
@RequestMapping("/edit")
public RespResult edit(@RequestBody Article article) {
articleMapper.updateByPrimaryKeySelective(article);
return new RespResult();
}

// 查看详情
@RequestMapping("/item.html")
public String itemHtml(@RequestParam("id") int id, Model model) {
Article article = articleMapper.selectById(id);
model.addAttribute("article", article);
return prefix + "item";
}

// 删除
@ResponseBody
@RequestMapping("/delete")
public RespResult delete(@RequestBody int id) {
articleMapper.deleteByPrimaryKey(id);
return new RespResult();
}
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
46
47
48
49
50
51
            limit,
categoryId,
brandId,
name,
content,
user.getId()
);
int count = commentMapper.selectCountByPaging(
categoryId,
brandId,
name,
content,
user.getId()
);
RespResult respResult = new RespResult();
respResult.success(data, count);
return respResult;
}

// 添加
@ResponseBody
@RequestMapping("/add")
public RespResult add(@RequestBody Comment comment, HttpSession session) {
RespResult respResult = new RespResult();
User user = (User) session.getAttribute(SessionConstant.KEY_USER);
int count = ordersMapper.selectCountByUserId(user.getId(), comment.getCommodityId());
if (count == 0) {
respResult.error("评价失败:您还未租赁过此汽车");
} else {
comment.setUserId(user.getId());
comment.setCreatTime(new Date());
commentMapper.insertSelective(comment);

// 计算评分
List<Comment> commentList = commentMapper.selectListByCommodityId(comment.getCommodityId());
double score = 0;
for (Comment item : commentList) {
score += item.getScore();
}
Commodity commodity = commodityMapper.selectByPrimaryKey(comment.getCommodityId());
commodity.setCommentCount(commodity.getCommentCount() + 1);
commodity.setScore((int)(score / commentList.size()));
commodityMapper.updateByPrimaryKeySelective(commodity);
}
return respResult;
}

// 删除
@ResponseBody
@RequestMapping("/delete")
public RespResult delete(@RequestBody Integer 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
    }

if (name != null) model.addAttribute("name", name);
if (color != null) model.addAttribute("color", color);
if (types != null) model.addAttribute("types", types);
if (seat != null) model.addAttribute("seat", seat);

model.addAttribute("brandList", brandList);
model.addAttribute("categoryList", categoryList);
model.addAttribute("commodityList", commodityList);
return prefix + "search";
}

// 分页数据
@ResponseBody
@RequestMapping("/data")
public RespResult pageData(@RequestParam("page") Integer page,
@RequestParam("limit") Integer limit,
@RequestParam(value = "categoryId", required = false) Integer categoryId,
@RequestParam(value = "brandId", required = false) Integer brandId,
@RequestParam(value = "status", required = false) Integer status,
@RequestParam(value = "gasoline", required = false) Integer gasoline,
@RequestParam(value = "name", required = false, defaultValue = "") String name,
@RequestParam(value = "color", required = false, defaultValue = "") String color,
@RequestParam(value = "types", required = false, defaultValue = "") String types,
@RequestParam(value = "seat", required = false, defaultValue = "") String seat) {
if (name.equals("")) name = null;
if (color.equals("")) color = null;
if (types.equals("")) types = null;
if (seat.equals("")) seat = null;
List<Commodity> data = commodityMapper.selectListByPaging(
(page - 1) * limit,
limit,
categoryId,
brandId,
1,
gasoline,
name,
color,
types,
seat
);
int count = commodityMapper.selectCountByPaging(
categoryId,
brandId,
1,
gasoline,
name,
color,
types,
seat
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

@Controller
@RequestMapping("/orders")
public class OrdersController {

private String prefix = "/user/orders/";

@Resource
private OrdersMapper ordersMapper;
@Resource
private CommodityMapper commodityMapper;
@Resource
private CategoryMapper categoryMapper;
@Resource
private UserMapper userMapper;

// 我的订单
@RequestMapping("/manage.html")
public String manageHtml(Model model) {
return prefix + "orders";
}

// 分页数据
@ResponseBody
@RequestMapping("/data")
public RespResult pageData(@RequestParam("page") Integer page,
@RequestParam("limit") Integer limit,
@RequestParam(value = "categoryId", required = false) Integer categoryId,
@RequestParam(value = "brandId", required = false) Integer brandId,
@RequestParam(value = "status", required = false) Integer status,
@RequestParam(value = "number", required = false, defaultValue = "") String number,
@RequestParam(value = "name", required = false, defaultValue = "") String name,
HttpSession session) {
User user = (User) session.getAttribute(SessionConstant.KEY_USER);
if (number.equals("")) number = null;
if (name.equals("")) name = null;
List<Orders> data = ordersMapper.selectListByPaging(
(page - 1) * limit,
limit,
number,
status,
categoryId,
brandId,
name,
user.getId()


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