基于javaweb的SSM+Maven垃圾分类管理系统(java+ssm+bootstrap+html+jquery+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

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

适用

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

功能说明

140023222402

150023222402

160023222402

170023222402

180023222402

190023222402

基于javaweb的SSM+Maven垃圾分类管理系统(java+ssm+bootstrap+html+jquery+mysql)

项目介绍

垃圾分类管理系统采用的是B/S的结构。系统管理员具有小区管理、垃圾分类信息、垃圾站信息、垃圾运输信息、垃圾信息、报修管理,投诉管理等功能。本系统界面简单直观,易于操作和使用,交互性强。

环境需要

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.是否Maven项目: 是;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目 

6.数据库:MySql 5.7版本;

技术栈

  1. 后端:Spring SpringMVC MyBatis 2. 前端:HTML+CSS+Javascript+jQuery+bootstrap

使用说明

  1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;

  2. 将项目中yml配置文件中的数据库配置改为自己的配置

  3. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;

   若为maven项目,导入成功后请执行maven clean;maven install命令,配置tomcat,然后运行;

  1. 运行项目,输入localhost:8080/ 登录

  2. 账户admin 密码123123

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
 *
*/
public class MultipartFileUtil {

public static final Logger logger = LoggerFactory.getLogger(MultipartFileUtil.class);

/**
* 根据文件名称获取后缀名
*
* @param fileName 文件名称
* @return 结果
*/
public static String getSuffix(String fileName) {
return fileName.substring(fileName.lastIndexOf(".") + 1);
}

/**
* 获取项目根路径
*
* @return 结果
*/
public static String getRootPath(HttpServletRequest request) {
String classPath = request.getSession().getServletContext().getRealPath( "/" );
String rootPath = "";
//windows下
if ("\\".equals(File.separator)) {
// rootPath = classPath.substring(1, classPath.indexOf("/WEB-INF/classes"));
rootPath = classPath;
rootPath = rootPath.replace("/", "\\");
}
//linux下
if ("/".equals(File.separator)) {
rootPath = classPath.substring(0, classPath.indexOf("/WEB-INF/classes"));
rootPath = rootPath.replace("\\", "/");
}
return rootPath;
}

/**
* 判断文件是否未空,或者没有数据
*
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


/**
* 运输站信息
*
*/
@RestController
@RequestMapping("record")
public class RecordController extends AbstractController {
@Autowired
private RecordService recordService;

/**
* 列表
*/
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params){

if (super.getUserId() > 1)
params.put("user", super.getUserId());


//查询列表数据
Query query = new Query(params);

List<RecordEntity> recordList = recordService.queryList(query);
int total = recordService.queryTotal(query);

PageUtils pageUtil = new PageUtils(recordList, total, query.getLimit(), query.getPage());

return R.ok().put("page", pageUtil);
}


/**
* 列表
*/
@RequestMapping("/list2")
public R list2(@RequestParam Map<String, Object> params){
Query query = new Query(params);
List<RecordEntity> recordList = recordService.queryList(query);
return R.ok().put("list", recordList );
}


/**
* 信息
*/
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
		}

if(menu.getParentId() == null){
throw new RRException("上级菜单不能为空");
}

//菜单
if(menu.getType() == Constant.MenuType.MENU.getValue()){
if(StringUtils.isBlank(menu.getUrl())){
throw new RRException("菜单URL不能为空");
}
}

//上级菜单类型
int parentType = Constant.MenuType.CATALOG.getValue();
if(menu.getParentId() != 0){
SysMenuEntity parentMenu = sysMenuService.queryObject(menu.getParentId());
parentType = parentMenu.getType();
}

//目录、菜单
if(menu.getType() == Constant.MenuType.CATALOG.getValue() ||
menu.getType() == Constant.MenuType.MENU.getValue()){
if(parentType != Constant.MenuType.CATALOG.getValue()){
throw new RRException("上级菜单只能为目录类型");
}
return ;
}

//按钮
if(menu.getType() == Constant.MenuType.BUTTON.getValue()){
if(parentType != Constant.MenuType.MENU.getValue()){
throw new RRException("上级菜单只能为菜单类型");
}
return ;
}
}
}
package com.learn.controller;

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
public R list2(@RequestParam Map<String, Object> params) {

//查询列表数据
Query query = new Query(params);
List<SysUserEntity> userList = sysUserService.queryList(query);

return R.ok().put("list", userList);
}

/**
* 获取登录的用户信息
*/
@RequestMapping("/info")
public R info() {
return R.ok().put("user", this.sysUserService.queryObject(getUser().getUserId()));
}

/**
* 修改登录用户密码
*/
@SysLog("修改密码")
@RequestMapping("/password")
public R password(String password, String newPassword) {
Assert.isBlank(newPassword, "新密码不为能空");

//sha256加密
//password = new Sha256Hash(password).toHex();
//sha256加密
//newPassword = new Sha256Hash(newPassword).toHex();

//更新密码
int count = sysUserService.updatePassword(getUserId(), password, newPassword);
if (count == 0) {
return R.error("原密码不正确");
}

//退出
ShiroUtils.logout();

return R.ok();
}

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
		return R.ok().put("ts", ts);
}

/**
* 保存
*/
@RequestMapping("/save")
public R save(@RequestBody TsEntity ts){

if (ts.getUser() == null)
ts.setUser(super.getUserId());


tsService.save(ts);

return R.ok();
}

/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody TsEntity ts){
tsService.update(ts);

return R.ok();
}

/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
tsService.deleteBatch(ids);

return R.ok();
}

}
package com.learn.controller;

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
53
54
	@Autowired
private SysRoleMenuService sysRoleMenuService;

/**
* 角色列表
*/
@RequestMapping("/list")
@RequiresPermissions("sys:role:list")
public R list(@RequestParam Map<String, Object> params){
//如果不是超级管理员,则只查询自己创建的角色列表
// if(getUserId() != Constant.SUPER_ADMIN){
// params.put("createUserId", getUserId());
// }

//查询列表数据
Query query = new Query(params);
List<SysRoleEntity> list = sysRoleService.queryList(query);
int total = sysRoleService.queryTotal(query);

PageUtils pageUtil = new PageUtils(list, total, query.getLimit(), query.getPage());

return R.ok().put("page", pageUtil);
}

/**
* 角色列表
*/
@RequestMapping("/select")
@RequiresPermissions("sys:role:select")
public R select(){
Map<String, Object> map = new HashMap<>();

//如果不是超级管理员,则只查询自己所拥有的角色列表
// if(getUserId() != Constant.SUPER_ADMIN){
// map.put("createUserId", getUserId());
// }
List<SysRoleEntity> list = sysRoleService.queryList(map);

return R.ok().put("list", list);
}

/**
* 角色信息
*/
@RequestMapping("/info/{roleId}")
@RequiresPermissions("sys:role:info")
public R info(@PathVariable("roleId") Long roleId){
SysRoleEntity role = sysRoleService.queryObject(roleId);

//查询角色对应的菜单
List<Long> menuIdList = sysRoleMenuService.queryMenuIdList(roleId);
role.setMenuIdList(menuIdList);

return R.ok().put("role", role);


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