项目介绍
主要功能包括:
用户发布失物,或者招领失物,管理员对用户,失物信息进行增删改查。
环境需要
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版本;
技术栈
- 后端:Spring+SpringMVC+Mybatis
- 前端:HTML+CSS+JavaScript+jsp
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
- 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
- 将项目中application.yml配置文件中的数据库配置改为自己的配置;
- 运行项目,输入localhost:8080/ 登录
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
return "system/user/list";
}
@RequestMapping("/saveUser")
@ResponseBody
public Result saveUser(User user) {
return systemService.saveUser(user);
}
@RequestMapping("/getUserById")
@ResponseBody
public Result getUserById(String id) {
return ResultGenerator.genSuccessResult(systemService.getUserById(id));
}
@RequestMapping("/logout")
public String logout(HttpServletRequest request, HttpServletResponse response) {
systemService.logout(request,response);
return "redirect:/system";
}
@RequestMapping("/hotelListUI")
public String hotelListUI(Model model, @PageableDefault(size = 10) Pageable pageable) {
Page<Hotel> page = systemService.getHotelPage(pageable);
model.addAttribute("page", page);
return "system/hotel/list";
}
@RequestMapping("/saveHotel")
@ResponseBody
public Result saveHotel(Hotel hotel) {
return systemService.saveHotel(hotel);
public String centerEditPWUI(Model model, HttpServletRequest request) {
User user = userCenterService.getUser(request);
model.addAttribute("id", user.getId());
return "center/user-center-editpw";
}
@RequestMapping("/centerEditPW")
@ResponseBody
public Result centerEditPW(HttpServletRequest request, HttpServletResponse response, Model model, @RequestParam("id") String id, @RequestParam("oldPassword") String oldPassword, @RequestParam("newPassword") String newPassword) {
return userCenterService.centerEditPW(request, response, id, oldPassword, newPassword);
}
}
系统管理控制层:
@Controller
@RequestMapping("/system")
@RequestMapping("/centerEditPW")
@ResponseBody
public Result centerEditPW(HttpServletRequest request, HttpServletResponse response, Model model, @RequestParam("id") String id, @RequestParam("oldPassword") String oldPassword, @RequestParam("newPassword") String newPassword) {
return userCenterService.centerEditPW(request, response, id, oldPassword, newPassword);
}
}
系统管理控制层:
@Controller
@RequestMapping("/system")
public class SystemController {
@Autowired
private SystemService systemService;
@RequestMapping("")
public String loginUI() {
return "system/login/login";
}
@ResponseBody
public Result centerEdit(Model model, User user) {
return userCenterService.centerEdit(user);
}
@RequestMapping("/centerEditPWUI")
public String centerEditPWUI(Model model, HttpServletRequest request) {
User user = userCenterService.getUser(request);
model.addAttribute("id", user.getId());
return "center/user-center-editpw";
}
@RequestMapping("/centerEditPW")
@ResponseBody
public Result centerEditPW(HttpServletRequest request, HttpServletResponse response, Model model, @RequestParam("id") String id, @RequestParam("oldPassword") String oldPassword, @RequestParam("newPassword") String newPassword) {
return userCenterService.centerEditPW(request, response, id, oldPassword, newPassword);
}
}
系统管理控制层:
@Controller
@RequestMapping("/system")
public class SystemController {
@ResponseBody
public Result centerEditPW(HttpServletRequest request, HttpServletResponse response, Model model, @RequestParam("id") String id, @RequestParam("oldPassword") String oldPassword, @RequestParam("newPassword") String newPassword) {
return userCenterService.centerEditPW(request, response, id, oldPassword, newPassword);
}
}
系统管理控制层:
@Controller
@RequestMapping("/system")
public class SystemController {
@Autowired
private SystemService systemService;
@RequestMapping("")
public String loginUI() {
return "system/login/login";
}
@RequestMapping("/login")
@ResponseBody
public Result login(SysUser sysUser, HttpServletResponse response) {
return systemService.login(sysUser,response);
}
@RequestMapping("/userListUI")
public String userListUI(Model model, @PageableDefault(size = 10) Pageable pageable) {
Page<User> page = systemService.getUserPage(pageable);
model.addAttribute("page",page);
return "system/user/list";
}
@RequestMapping("/saveUser")
@ResponseBody
public Result updateStatus(String id) {
return systemService.updateStatus(id);
}
@RequestMapping("/getHotelById")
@ResponseBody
public Result getHotelById(String id) {
return ResultGenerator.genSuccessResult(systemService.getHotelById(id));
}
@RequestMapping("/attractionsListUI")
public String attractionsListUI(Model model, @PageableDefault(size = 10) Pageable pageable) {
Page<Attractions> page = systemService.getAttractionsPage(pageable);
model.addAttribute("page", page);
return "system/attractions/list";
}
@RequestMapping("/getAttractionsById")
@ResponseBody
public Result getAttractionsById(String id) {
return ResultGenerator.genSuccessResult(systemService.getAttractionsById(id));
}
@RequestMapping("/updateAttractionsStatus")
@ResponseBody
public Result updateAttractionsStatus(String id) {
return systemService.updateAttractionsStatus(id);
}
@RequestMapping("/saveAttractions")
@ResponseBody
public Result saveAttractions(Attractions attractions) {
return systemService.saveAttractions(attractions);
}
@RequestMapping("/travelRouteListUI")
public String travelRouteListUI(Model model, @PageableDefault(size = 10) Pageable pageable) {
Page<TravelRoute> page = systemService.getTravelRoutePage(pageable);
model.addAttribute("page", page);
return "system/route/list";
}
@RequestMapping("/getTravelRouteById")
@ResponseBody
public Result getTravelRouteById(String id) {
return ResultGenerator.genSuccessResult(systemService.getTravelRouteById(id));
}
@RequestMapping("/updateTravelRouteStatus")
@ResponseBody
public Result updateTravelRouteStatus(String id) {
return systemService.updateTravelRouteStatus(id);
}
public class LoginController {
@Autowired
private LoginService loginService;
@RequestMapping("/loginUI")
public String loginUI() {
return "login/index-login";
}
@RequestMapping("/login")
@ResponseBody
public Result login(Model model, User user, HttpServletResponse response) {
return loginService.login(user, response);
}
@RequestMapping("/logout")
public String logout(HttpServletRequest request, HttpServletResponse response) {
loginService.logout(request, response);
//SpringMVC重定向
@RequestMapping("/getTravelRouteById")
@ResponseBody
public Result getTravelRouteById(String id) {
return ResultGenerator.genSuccessResult(systemService.getTravelRouteById(id));
}
@RequestMapping("/updateTravelRouteStatus")
@ResponseBody
public Result updateTravelRouteStatus(String id) {
return systemService.updateTravelRouteStatus(id);
}
@RequestMapping("/saveTravelRoute")
@ResponseBody
public Result saveTravelRoute(TravelRoute travelRoute) {
return systemService.saveTravelRoute(travelRoute);
}
@RequestMapping("/travelStrategyListUI")
public String travelStrategyListUI(Model model, @PageableDefault(size = 10) Pageable pageable) {
Page<TravelStrategy> page = systemService.getTravelStrategyPage(pageable);
model.addAttribute("page", page);
public class UserCenterController {
@Autowired
private UserCenterService userCenterService;
@RequestMapping("/centerUI")
public String centerUI(Model model, HttpServletRequest request) {
User user = userCenterService.getUser(request);
model.addAttribute("user", user);
return "center/user-center";
}
@RequestMapping("/centerEditUI")
public String centerEditUI(Model model, HttpServletRequest request) {
User user = userCenterService.getUser(request);
model.addAttribute("user", user);
return "center/user-center-edit";
}
@RequestMapping("/centerEdit")
@ResponseBody
public Result centerEdit(Model model, User user) {
return userCenterService.centerEdit(user);
}
@RequestMapping("/centerEditPWUI")
public String centerEditPWUI(Model model, HttpServletRequest request) {
User user = userCenterService.getUser(request);
model.addAttribute("id", user.getId());
return "center/user-center-editpw";
}
@RequestMapping("/centerEditPW")