基于javaweb的SSM+Maven校园共享自行车管理系统(java+ssm+jsp+easyui+bootstrap+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

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

适用

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

功能说明

510023362402

520023362402

530023362402

540023362402

550023362402

560023362402

基于javaweb的SSM+Maven校园共享自行车管理系统(java+ssm+jsp+easyui+bootstrap+mysql)

项目介绍

管理员角色包含以下功能: 管理员登录,用户管理,服务点管理,共享单车管理,车辆分类管理,学生管理,自行车租赁管理,统计信息,密码修改等功能。

用户角色包含以下功能: 用户登录,基本信息查看等功能。

环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可 4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;  5.数据库:MySql 5.7版本; 6.是否Maven项目:是;

技术栈

  1. 后端:Spring+SpringMVC+Mybatis 2. 前端:JSP+EasyUI+BootStrap+jQuery

使用说明

  1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中jdbc.properties配置文件中的数据库配置改为自己的配置; 4. 运行项目,输入localhost:8080/ 登录

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

JsonResult deleteById(Integer aid);

List<Place> loadPlace();

JsonResult update(MultipartFile adminIcon, Admin admin, HttpServletRequest request);

JsonResult add(MultipartFile adminIcon, Admin admin, HttpServletRequest request);
}
package com.webike.service;



/**
*/
public interface BikeService {



JsonResult add(MultipartFile bikeIcon, Bike bike, HttpServletRequest request,Integer bCount);

JsonResult update(MultipartFile bikeIcon,Bike bike,HttpServletRequest request);

Page<Bike> findAllToPage(Integer page, Integer rows);

//当前bike d掉 和 更新该分类的数量
JsonResult deleteById(String bids,String cids);

Bike findById(Integer bid);
}
package com.webike.web;


/**
*/
@Controller
@RequestMapping("total")
public class TotalController {
@Autowired
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
        }
}catch (Exception e){
e.printStackTrace();
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return new JsonResult(false,ResultEnum.SYSTEM_ERROR);
}

}

@Override
public JsonResult update(MultipartFile bikeIcon, Bike bike, HttpServletRequest request) {
try{
if(!bikeIcon.isEmpty()){
//更新首先要先删除原来的文件
if(bike.getbIcon() != null){
File file = new File(request.getServletContext().getRealPath("/" + bike.getbIcon()));
// if(file != null) file.delete();
}
String path = FileUtil.uploadImage(bikeIcon, "bikeIcon", request);
if(path == null) return new JsonResult(false, ResultEnum.UPLOAD_TYPE_ERROR);
bike.setbIcon(path);
}
bike.setbUpdateTime(new Date());
int i = bikeMapper.updateByPrimaryKeySelective(bike);
return i > 0 ? new JsonResult(false, ResultEnum.UPDATE_SUCCESS)
: new JsonResult(false, ResultEnum.UPDATE_FAIL);
}catch (Exception e){
e.printStackTrace();
return new JsonResult(false, ResultEnum.SYSTEM_ERROR);
}
}

@Override
public Page<Bike> findAllToPage(Integer page, Integer rows) {
Page<Bike> bPage = new Page<>();
List<Bike> lists = bikeMapper.findToPage((page-1)*rows,rows);
bPage.setRows(lists);
bPage.setTotal(bikeMapper.countByExample(new BikeExample()));
return bPage;
}
//事务控制 该单车的分类剩余量减size
@Transactional
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

//回显 指定一个student数据到student页面的弹出框表单中
@RequestMapping("/loadForm")
@ResponseBody
public Student loadForm(Integer sid){
return studentService.findById(sid);
}








}
package com.webike.web;



/**
*/
@Controller
@RequestMapping("/category")
public class CategoryController {

@Autowired
private CategoryService categoryService;


//跳转到category页面
@RequestMapping("/categoryManage")
public String categoryMange(){
return "category";
}

//显示所有分类
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
     */
public static String uploadImage(MultipartFile multipartFile,String saveDir, HttpServletRequest request){
if(!multipartFile.getContentType().startsWith("image/"))
return null;
String filename = multipartFile.getOriginalFilename();
String type = filename.substring(filename.lastIndexOf("."));
String newFilename = UUIDUtil.getUUIDByTime()+type;
String path = request.getServletContext().getRealPathhttps://yms-1257401191.cos.ap-nanjing.myqcloud.com/"+saveDir)+"/"+newFilename;
try{
FileCopyUtils.copy(multipartFile.getInputStream(), new FileOutputStream(path));
return "images/"+saveDir+"/"+newFilename;
}catch (IOException e){
e.printStackTrace();
return null;
}

}
}
package com.webike.service;



/**
*/
public interface AdminService {


//验证登陆
public String checkUserPwd(Admin admin);

//更新
public boolean upDate(Admin admin);

//
public Admin findByUsername(String username);
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
    return sPage;
}

@Override
public JsonResult add(MultipartFile studentIcon, Student student,HttpServletRequest request) {
if(!studentIcon.isEmpty()){
String path = FileUtil.uploadImage(studentIcon, "studentIcon", request);
if(path == null) return new JsonResult(false, ResultEnum.UPLOAD_TYPE_ERROR);
student.setsIcon(path);
}

student.setsCreateTime(new Date());
student.setsUpdateTime(new Date());
if(student.getsSex() == null) student.setsSex("男");
try{
int i = studentMapper.insertSelective(student);
return i > 0 ? new JsonResult(true, ResultEnum.ADD_SUCCESS)
: new JsonResult(false, ResultEnum.ADD_FAIL);
}catch (Exception e){
e.printStackTrace();
return new JsonResult(false, ResultEnum.REPEAT_ERROR);
}
}

@Override
public JsonResult removeById(Integer sid) {
if(sid == null) return new JsonResult(false, ResultEnum.DELETE_FAIL);
int i = studentMapper.deleteByPrimaryKey(sid);
return i > 0 ? new JsonResult(true, ResultEnum.DELETE_SUCCESS) : new JsonResult(false, ResultEnum.DELETE_FAIL);
}

@Override
public Student findById(Integer sid) {
if(sid != null){
return studentMapper.selectByPrimaryKey(sid);
}
return null;
}

@Override
public JsonResult update(MultipartFile studentIcon,Student student,HttpServletRequest request) {
try{
if(!studentIcon.isEmpty()){
//更新首先要先删除原来的文件
if(student.getsIcon() != null){
File file = new File(request.getServletContext().getRealPath("/" + student.getsIcon()));
// if(file != null) file.delete();
}
String path = FileUtil.uploadImage(studentIcon, "studentIcon", request);
if(path == null) return new JsonResult(false, ResultEnum.UPLOAD_TYPE_ERROR);
student.setsIcon(path);
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
    @RequestMapping(value = "/addOrUpdate",method = RequestMethod.POST)
@ResponseBody
public JsonResult addOrUpdate(MultipartFile bikeIcon, Bike bike, HttpServletRequest request,Integer bCount){
if(bCount != null) return bikeService.add(bikeIcon,bike,request,bCount);
return bikeService.update(bikeIcon,bike,request);
}

//showAll bike
@RequestMapping("/showAll")
@ResponseBody
public Page<Bike> show(Integer page, Integer rows){
return bikeService.findAllToPage(page,rows);
}

//删除单车和更新单车的分类
@RequestMapping(value = "/remove",method = RequestMethod.POST)
@ResponseBody
public JsonResult remove(String bids,String cids){
return bikeService.deleteById(bids,cids);
}
//点击修改回显bike弹出表单
@RequestMapping("/loadForm")
@ResponseBody
public Bike loadForm(Integer bid){
return bikeService.findById(bid);
}

//回显bike分类
@RequestMapping(value = "/loadCategory",method = RequestMethod.POST)
@ResponseBody
public List<Category> loadCategory(){
return categoryService.findAll();
}



}
package com.webike.web;



/**


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