基于javaweb的SpringBoot民宿管理系统(java+springboot+vue+elementui+layui+mysql+maven)

运行环境

Java≥8、MySQL≥5.7、Node.js≥14

开发工具

后端:eclipse/idea/myeclipse/sts等均可配置运行
前端:WebStorm/VSCode/HBuilderX等均可

❗没学过node.js的不要搞前后端分离项目

适用

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

功能说明

032323421807

052323421807

062323421807

072323421807

082323421807

基于javaweb的SpringBoot民宿管理系统(java+springboot+vue+elementui+layui+mysql+maven)

项目介绍

角色:管理员、商家、用户

管理员:
admin 123456

商家:
商家1 123456
商家2 123456
商家3 123456
商家4 123456
商家5 123456
商家6 123456

用户:
用户1 123456
用户2 123456
用户3 123456
用户4 123456
用户5 123456
用户6 123456

系统功能 用户注册登录后可进行首页、个人中心、民宿信息管理、房间信息管理、房间预订管理、房间退订管理、投诉反馈管理、我的收藏管理。

商家用户注册登录,可以对首页、个人中心、民宿信息管理、房间信息管理、房间预订管理、房间退订管理、投诉反馈管理、我的收藏管理等功能模块。

管理员登录后可进行首页、个人中心、用户管理、商家管理、民宿信息管理、房间类型管理、房间信息管理、房间预订管理、房间退订管理、投诉反馈管理、我的收藏管理、系统管理。

环境需要

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+Mybaits 前端:Vue+ElementUI+Layui+HTML+CSS+JS

使用说明

  1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的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
39
40
41
42
43
44
45
46
47
	@Autowired
private TokenService tokenService;

/**
* 登录
*/
@IgnoreAuth
@PostMapping(value = "/login")
public R login(String username, String password, String captcha, HttpServletRequest request) {
UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));
if(user==null || !user.getPassword().equals(password)) {
return R.error("账号或密码不正确");
}
String token = tokenService.generateToken(user.getId(),username, "users", user.getRole());
return R.ok().put("token", token);
}

/**
* 注册
*/
@IgnoreAuth
@PostMapping(value = "/register")
public R register(@RequestBody UserEntity user){
// ValidatorUtils.validateEntity(user);
if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {
return R.error("用户已存在");
}
userService.insert(user);
return R.ok();
}

/**
* 退出
*/
@GetMapping(value = "logout")
public R logout(HttpServletRequest request) {
request.getSession().invalidate();
return R.ok("退出成功");
}

/**
* 密码重置
*/
@IgnoreAuth
@RequestMapping(value = "/resetPass")
public R resetPass(String username, HttpServletRequest request){
UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", 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
				HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
headers.setContentDispositionFormData("attachment", fileName);
return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file),headers, HttpStatus.CREATED);
}
} catch (IOException e) {
e.printStackTrace();
}
return new ResponseEntity<byte[]>(HttpStatus.INTERNAL_SERVER_ERROR);
}

}




/**
* 权限(Token)验证
*/
@Component
public class AuthorizationInterceptor implements HandlerInterceptor {

public static final String LOGIN_TOKEN_KEY = "Token";

@Autowired
private TokenService tokenService;

@Override
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("/lists")
public R list( DiscussfangjianxinxiEntity discussfangjianxinxi){
EntityWrapper<DiscussfangjianxinxiEntity> ew = new EntityWrapper<DiscussfangjianxinxiEntity>();
ew.allEq(MPUtil.allEQMapPre( discussfangjianxinxi, "discussfangjianxinxi"));
return R.ok().put("data", discussfangjianxinxiService.selectListView(ew));
}

/**
* 查询
*/
@RequestMapping("/query")
public R query(DiscussfangjianxinxiEntity discussfangjianxinxi){
EntityWrapper< DiscussfangjianxinxiEntity> ew = new EntityWrapper< DiscussfangjianxinxiEntity>();
ew.allEq(MPUtil.allEQMapPre( discussfangjianxinxi, "discussfangjianxinxi"));
DiscussfangjianxinxiView discussfangjianxinxiView = discussfangjianxinxiService.selectView(ew);
return R.ok("查询房间信息评论表成功").put("data", discussfangjianxinxiView);
}

/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
DiscussfangjianxinxiEntity discussfangjianxinxi = discussfangjianxinxiService.selectById(id);
return R.ok().put("data", discussfangjianxinxi);
}

/**
* 前端详情
*/
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
DiscussfangjianxinxiEntity discussfangjianxinxi = discussfangjianxinxiService.selectById(id);
return R.ok().put("data", discussfangjianxinxi);
}




/**
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 R.ok().put("data", shangjia);
}

/**
* 前端详情
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
ShangjiaEntity shangjia = shangjiaService.selectById(id);
return R.ok().put("data", shangjia);
}




/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody ShangjiaEntity shangjia, HttpServletRequest request){
shangjia.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(shangjia);
ShangjiaEntity user = shangjiaService.selectOne(new EntityWrapper<ShangjiaEntity>().eq("shangjiabianhao", shangjia.getShangjiabianhao()));
if(user!=null) {
return R.error("用户已存在");
}
shangjia.setId(new Date().getTime());
shangjiaService.insert(shangjia);
return R.ok();
}

/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody ShangjiaEntity shangjia, HttpServletRequest request){
shangjia.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(shangjia);
ShangjiaEntity user = shangjiaService.selectOne(new EntityWrapper<ShangjiaEntity>().eq("shangjiabianhao", shangjia.getShangjiabianhao()));
if(user!=null) {
return R.error("用户已存在");
}
shangjia.setId(new Date().getTime());
shangjiaService.insert(shangjia);
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
42
43
44
45
46
		
if(type.equals("2")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
Date remindStartDate = null;
Date remindEndDate = null;
if(map.get("remindstart")!=null) {
Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindStart);
remindStartDate = c.getTime();
map.put("remindstart", sdf.format(remindStartDate));
}
if(map.get("remindend")!=null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindEnd);
remindEndDate = c.getTime();
map.put("remindend", sdf.format(remindEndDate));
}
}

Wrapper<FangjiantuidingEntity> wrapper = new EntityWrapper<FangjiantuidingEntity>();
if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart"));
}
if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend"));
}

String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("shangjia")) {
wrapper.eq("shangjiabianhao", (String)request.getSession().getAttribute("username"));
}
if(tableName.equals("yonghu")) {
wrapper.eq("zhanghao", (String)request.getSession().getAttribute("username"));
}

int count = fangjiantuidingService.selectCount(wrapper);
return R.ok().put("count", count);
}



}


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