基于javaweb的SpringBoot民宿在线预定平台(java+springboot+maven+mybaits+vue+elementui+mysql)

运行环境

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

开发工具

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

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

适用

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

功能说明

341125050706

361125050706

371125050706

381125050706

391125050706

401125050706

411125050706

421125050706

431125050706

441125050706

基于javaweb的SpringBoot民宿在线预定平台(java+springboot+maven+mybaits+vue+elementui+mysql)

技术栈

后端:SpringBoot+Mybaits

前端:Vue+elementui

管理员:
admin 123456

用户:
zhangwei 123456
wangfang 123456
liming 123456
chenyu 123456
liuyang 123456
zhaoxin 123456

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
}

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




/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody CartEntity cart, HttpServletRequest request){
cart.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(cart);
cart.setUserid((Long)request.getSession().getAttribute("userId"));
cartService.insert(cart);
return R.ok();
}

/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody CartEntity cart, HttpServletRequest request){
cart.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(cart);
cartService.insert(cart);
return R.ok();
}

/**
* 修改
*/
@RequestMapping("/update")
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
    /**
* 信息
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") String id){
UserEntity user = userService.selectById(id);
return R.ok().put("data", user);
}

/**
* 获取用户的session用户信息
*/
@RequestMapping("/session")
public R getCurrUser(HttpServletRequest request){
Long id = (Long)request.getSession().getAttribute("userId");
UserEntity user = userService.selectById(id);
return R.ok().put("data", user);
}

/**
* 保存
*/
@PostMapping("/save")
public R save(@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();
}

/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody UserEntity user){
// ValidatorUtils.validateEntity(user);
UserEntity u = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername()));
if(u!=null && u.getId()!=user.getId() && u.getUsername().equals(user.getUsername())) {
return R.error("用户名已存在。");
}
userService.updateById(user);//全部更新
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

/**
* 登录相关
*/
@RequestMapping("config")
@RestController
public class ConfigController{

@Autowired
private ConfigService configService;

/**
* 列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,ConfigEntity config){
EntityWrapper<ConfigEntity> ew = new EntityWrapper<ConfigEntity>();
PageUtils page = configService.queryPage(params);
return R.ok().put("data", page);
}

/**
* 列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,ConfigEntity config){
EntityWrapper<ConfigEntity> ew = new EntityWrapper<ConfigEntity>();
PageUtils page = configService.queryPage(params);
return R.ok().put("data", page);
}

/**
* 信息
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") String id){
ConfigEntity config = configService.selectById(id);
return R.ok().put("data", config);
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
      EntityWrapper< MinsufenleiEntity> ew = new EntityWrapper< MinsufenleiEntity>();
ew.allEq(MPUtil.allEQMapPre( minsufenlei, "minsufenlei"));
MinsufenleiView minsufenleiView = minsufenleiService.selectView(ew);
return R.ok("查询民宿分类成功").put("data", minsufenleiView);
}

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

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




/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody MinsufenleiEntity minsufenlei, HttpServletRequest request){
minsufenlei.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(minsufenlei);
minsufenleiService.insert(minsufenlei);
return R.ok();
}

/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody MinsufenleiEntity minsufenlei, HttpServletRequest request){
minsufenlei.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(minsufenlei);
minsufenleiService.insert(minsufenlei);
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
        Map<String, Object> param = new HashMap<String, Object>();
Iterator<Map.Entry<String, Object>> it = param.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, Object> entry = it.next();
String key = entry.getKey();
String newKey = entry.getKey();
if (pre.endsWith(".")) {
newMap.put(pre + newKey, entry.getValue());
} else if (StringUtils.isEmpty(pre)) {
newMap.put(newKey, entry.getValue());
} else {
newMap.put(pre + "." + newKey, entry.getValue());
}
}
params.put("sort", "clicknum");
params.put("order", "desc");
PageUtils page = minsuxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, minsuxinxi), params), params));
return R.ok().put("data", page);
}


}


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
  public R list( MinsufenleiEntity minsufenlei){
EntityWrapper<MinsufenleiEntity> ew = new EntityWrapper<MinsufenleiEntity>();
ew.allEq(MPUtil.allEQMapPre( minsufenlei, "minsufenlei"));
return R.ok().put("data", minsufenleiService.selectListView(ew));
}

/**
* 查询
*/
@RequestMapping("/query")
public R query(MinsufenleiEntity minsufenlei){
EntityWrapper< MinsufenleiEntity> ew = new EntityWrapper< MinsufenleiEntity>();
ew.allEq(MPUtil.allEQMapPre( minsufenlei, "minsufenlei"));
MinsufenleiView minsufenleiView = minsufenleiService.selectView(ew);
return R.ok("查询民宿分类成功").put("data", minsufenleiView);
}

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

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




/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody MinsufenleiEntity minsufenlei, HttpServletRequest request){


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