基于javaweb的SSM+Maven旅游管理系统(前台、后台)(java+jsp+ssm+maven+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

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

适用

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

功能说明

分为前台用户和后台管理员功能

管理员

  • 登录、管理用户、管理景点、管理酒店、管理论坛帖子、管理评论等

用户端

  • 登录、注册、景点、酒店、论坛、评论等功能的浏览和评论等

idea运行/eclipse/MyEclipse运行

380123192502

390123192502

前台

210123192502

230123192502

240123192502

250123192502

260123192502

270123192502

280123192502

290123192502

后台

300123192502

310123192502

320123192502

340123192502

350123192502

360123192502

370123192502

技术框架

JavaBean MVC JSP SSM(Spring SpringMVC MyBatis) Maven MySQL jQuery JavaScript CSS

基于javaweb的SSM+Maven旅游管理系统(前台、后台)(java+jsp+ssm+maven+mysql)

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


@Controller
@RequestMapping(value = "hotel")
public class HotelController {
@Autowired
private HotelDao hotelDao;
@Autowired
private ViewPointService viewPointService;

/**
* 跳转首页
*/
@RequestMapping(value = "index", method = RequestMethod.GET)
public String index(Model model) {
//实例化hotel examle
HotelExample example = new HotelExample();
example.setOrderByClause("hid desc");
String prefix = "/static/upload/hotelAvatar/";
List<Hotel> hotels = hotelDao.selectByExample(example);
for (Hotel hotel : hotels) {
//图片名
String suffix = hotel.getImgUrl();
//全路径
hotel.setImgUrl(prefix + suffix);
}
//传送景点
model.addAttribute("hotels", hotels);
return "proscenium/hotel/index";
}

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 = "hotelPointSearch", method = RequestMethod.GET)
public String hotelPointSearch(String keyword, Model model) {
String prefix = "/static/upload/hotelAvatar/";

Hotel hotel = new Hotel();

hotel.setLocal(keyword);
hotel.setHouseType(keyword);
hotel.setBedType(keyword);

List<Hotel> hotels = hotelDao.hotelPointSearch(hotel);

for (Hotel hotelForEach : hotels){
String imgUrl = hotelForEach.getImgUrl();
hotelForEach.setImgUrl(prefix + imgUrl);
}

model.addAttribute("hotels", hotels);
model.addAttribute("msg", Msg.success("酒店查询成功!"));

return "admin/hotel_list";
}

/**
* 后台论坛模糊搜索
*/
@RequestMapping(value = "forumPointSearch", method = RequestMethod.GET)
public String forumPointSearch(String keyword, Model model) {

Forum forum = new Forum();

forum.setTpTag(keyword);
forum.setTpTitle(keyword);
forum.setTpSubTitle(keyword);
forum.setTpAuthor(keyword);

List<Forum> forums = forumDao.forumPointSearch(forum);

model.addAttribute("forums", forums);
model.addAttribute("msg", Msg.success("论坛查询成功!"));

return "admin/forum_list";
}
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


@Controller
@RequestMapping(value = "traffic")
public class TrafficController {
@Autowired
TrafficDao trafficDao;

/**
*
* @param currentCity
* @param desCity
* @param model
* @return
*/
@ResponseBody
@RequestMapping(value = "selectByCurrentAndDestination", method = RequestMethod.GET)
public List<Traffic> traffic(String currentCity, String desCity, Model model) {
TrafficExample example = new TrafficExample();
List<Traffic> traffics = trafficDao.selectByExample(example);

List<Traffic> queryTraffics = new ArrayList<>();

for(Traffic traffic : traffics){
if (currentCity.equals(traffic.getTpCurrent()) && desCity.equals(traffic.getTpDestination())){
queryTraffics.add(traffic);
}
}
return queryTraffics;
}
}
package com.demo.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
	//封装留言信息
lw_list = viewPointService.findByWords();
model.addAttribute("lw_list",lw_list);

//封装回复信息
lr_list = viewPointService.findByReply();
model.addAttribute("lr_list",lr_list);

//查询文章信息
Forum forum = forumDao.selectByPrimaryKey(tpFid);

System.out.println("查询到当前文章的ID值:" + forum.getTpFid());

if (forum != null) {
model.addAttribute("forum", forum);
return "proscenium/forum/content";
} else {
return null;
}
}


/**
* 保存论坛回复信息
*/
@RequestMapping(value="/saveHotelReply")
public String saveHotelReply(Reply reply){
if(reply != null){
viewPointService.saveReply(reply);
String hid = reply.getLr_hotel_id();
return "redirect:toHotelArticleView.do?hid=" + hid;
}else{
return null;
}
}

/**
* 保存论坛留言信息
*/
@RequestMapping(value="/saveHotelWords")
public String saveHotelWords(Words words){
if(words != null){
String hid = words.getLw_hotel_id();
viewPointService.saveWords(words);
return "redirect:toHotelArticleView.do?hid=" + hid;
}else{
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
	//}
}
package com.demo.controller;



@Controller
@RequestMapping(value = "article")
public class ArticleController {
//声明用于存放留言回复信息的List集合
private List<Words> lw_list;
private List<Reply> lr_list;

@Autowired
ViewPointService viewPointService;
@Autowired
ForumDao forumDao;
@Autowired
HotelDao hotelDao;

/**
* 保存景点留言信息
*/
@RequestMapping(value="/saveWords")
public String saveWords(Words words){
if(words != null){
String r_id = words.getLw_for_article_id();
viewPointService.saveWords(words);
return "redirect:toArticleView.do?r_id="+r_id;
}else{
return null;
}
}

/**
* 保存回复信息
*/
@RequestMapping(value="/saveReply")
public String saveReply(Reply reply){
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
	//传送景点
model.addAttribute("hotels", hotels);
return "proscenium/hotel/index";
}

/**
* 跳转首页
*/
@RequestMapping(value = "content", method = RequestMethod.GET)
public String content(Integer hid, Model model) {

//封装留言信息
List<Words> lw_list = viewPointService.findByWords();
model.addAttribute("lw_list",lw_list);

//封装回复信息
List<Reply> lr_list = viewPointService.findByReply();
model.addAttribute("lr_list",lr_list);

Hotel hotel = hotelDao.selectByPrimaryKey(hid);
model.addAttribute("hotel", hotel);

return "proscenium/hotel/content";
}

/**
* 钱台酒店模糊搜索
*/
@RequestMapping(value = "hotelPointSearch", method = RequestMethod.GET)
public String hotelPointSearch(String keyword, Model model) {
String prefix = "/static/upload/hotelAvatar/";

Hotel hotel = new Hotel();

hotel.setLocal(keyword);
hotel.setHouseType(keyword);
hotel.setBedType(keyword);

List<Hotel> hotels = hotelDao.hotelPointSearch(hotel);

for (Hotel hotelForEach : hotels){
String imgUrl = hotelForEach.getImgUrl();
hotelForEach.setImgUrl(prefix + imgUrl);
}

model.addAttribute("hotels", hotels);
model.addAttribute("msg", Msg.success("酒店查询成功!"));

return "proscenium/hotel/index";
}


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