基于javaweb的SSM公寓房屋出租系统(java+ssm+jsp+easyui+echarts+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

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

适用

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

功能说明

380023372402

390023372402

400023372402

410023372402

420023372402

430023372402

440023372402

基于javaweb的SSM公寓房屋出租系统(java+ssm+jsp+easyui+echarts+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+Echarts+jQuery

使用说明

  1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中db.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
40
41
42
43
44
45
		menuIds += authority.getMenuId() + ",";
}
if(!StringUtils.isEmpty(menuIds)){
menuIds = menuIds.substring(0,menuIds.length()-1);
}
List<Menu> userMenus = menuService.findListByIds(menuIds);
//把角色信息、菜单信息放到session中
request.getSession().setAttribute("admin", findByUsername);
request.getSession().setAttribute("role", role);
request.getSession().setAttribute("userMenus", userMenus);
ret.put("type", "success");
ret.put("msg", "登录成功!");
logService.add("用户名为{"+user.getUsername()+"},角色为{"+role.getName()+"}的用户登录成功!");
return ret;
}

/**
* 后台退出注销功能
* @param request
* @return
*/
@RequestMapping(value="/logout",method=RequestMethod.GET)
public String logout(HttpServletRequest request){
HttpSession session = request.getSession();
session.setAttribute("admin", null);
session.setAttribute("role", null);
request.getSession().setAttribute("userMenus", null);
return "redirect:login";
}

/**
* 修改密码页面
* @param model
* @return
*/
@RequestMapping(value="/edit_password",method=RequestMethod.GET)
public ModelAndView editPassword(ModelAndView model){
model.setViewName("system/edit_password");
return model;
}

@RequestMapping(value="/edit_password",method=RequestMethod.POST)
@ResponseBody
public Map<String, String> editPasswordAct(String newpassword,String oldpassword,HttpServletRequest request){
Map<String, String> ret = new HashMap<String, String>();
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
		ret.put("filepath",request.getServletContext().getContextPath() + "/resources/upload/" + filename );
return ret;
}
/**
* 判断该用户名是否存在
* @param username
* @param id
* @return
*/
private boolean isExist(String username,Long id){
User user = userService.findByUsername(username);
if(user == null)return false;
if(user.getId().longValue() == id.longValue())return false;
return true;
}
}
package com.fangwu.controller.home;





/**
* 前台用户控制器
*
*/
@RequestMapping("/home/account")
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
		}
if(accountService.add(account) <= 0){
retMap.put("type", "error");
retMap.put("msg", "注册失败,请联系管理员!");
return retMap;
}
retMap.put("type", "success");
retMap.put("msg", "注册成功!");
return retMap;
}

/**
* 退出登录
* @param request
* @return
*/
@RequestMapping(value="/logout",method=RequestMethod.GET)
public String logout(HttpServletRequest request){
request.getSession().setAttribute("account", null);
return "redirect:login";
}

private boolean isExist(String name){
Account account = accountService.findByName(name);
if(account == null)return false;
return true;
}
}
package com.fangwu.controller.admin;



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
@ResponseBody
public Map<String, String> uploadPhoto(MultipartFile photo,HttpServletRequest request){
Map<String, String> ret = new HashMap<String, String>();
if(photo == null){
ret.put("type", "error");
ret.put("msg", "选择要上传的文件!");
return ret;
}
if(photo.getSize() > 1024*1024*1024){
ret.put("type", "error");
ret.put("msg", "文件大小不能超过10M!");
return ret;
}
//获取文件后缀
String suffix = photo.getOriginalFilename().substring(photo.getOriginalFilename().lastIndexOf(".")+1,photo.getOriginalFilename().length());
if(!"jpg,jpeg,gif,png".toUpperCase().contains(suffix.toUpperCase())){
ret.put("type", "error");
ret.put("msg", "请选择jpg,jpeg,gif,png格式的图片!");
return ret;
}
String savePath = request.getServletContext().getRealPath("/") + "/resources/upload/";
File savePathFile = new File(savePath);
if(!savePathFile.exists()){
//若不存在改目录,则创建目录
savePathFile.mkdir();
}
String filename = new Date().getTime()+"."+suffix;
try {
//将文件保存至指定目录
photo.transferTo(new File(savePath+filename));
}catch (Exception e) {
// TODO Auto-generated catch block
ret.put("type", "error");
ret.put("msg", "保存文件异常!");
e.printStackTrace();
return ret;
}
ret.put("type", "success");
ret.put("msg", "用户删除成功!");
ret.put("filepath",request.getServletContext().getContextPath() + "/resources/upload/" + filename );
return ret;
}
/**
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
@RequestMapping(value="/login",method=RequestMethod.GET)
public ModelAndView login(ModelAndView model
){
System.out.println("---login---");
model.setViewName("home/index/login");
return model;
}

/**
* 注册页面
* @param model
* @return
*/
@RequestMapping(value="/reg",method=RequestMethod.GET)
public ModelAndView reg(ModelAndView model
){
model.setViewName("home/index/reg");
return model;
}

/**
* 登录信息提交
* @param account
* @return
*/
@RequestMapping(value="/login",method=RequestMethod.POST)
@ResponseBody
public Map<String,String> loginAct(Account account,String vcode,HttpServletRequest request){
Map<String,String> retMap = new HashMap<String, String>();
if(account == null){
retMap.put("type", "error");
retMap.put("msg", "请填写正确的用户信息!");
return retMap;
}
if(StringUtils.isEmpty(account.getName())){
retMap.put("type", "error");
retMap.put("msg", "用户名不能为空!");
return retMap;
}
if(StringUtils.isEmpty(account.getPassword())){
retMap.put("type", "error");
retMap.put("msg", "密码不能为空!");
return retMap;
}
if(StringUtils.isEmpty(vcode)){
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
	public String logout(HttpServletRequest request){
request.getSession().setAttribute("account", null);
return "redirect:login";
}

private boolean isExist(String name){
Account account = accountService.findByName(name);
if(account == null)return false;
return true;
}
}
package com.fangwu.controller.admin;





/**
* 角色role控制器
*
*/
@RequestMapping("/admin/role")
@Controller
public class RoleController {

@Autowired
private RoleService roleService;

@Autowired
private AuthorityService authorityService;


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