基于javaweb+mysql的springboot酒店管理系统(java+springboot+mybatis+beetl+layui)
运行环境
Java≥8、MySQL≥5.7
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SpringBoot酒店管理系统(java+springboot+mybatis+beetl+layui)
此系统用的是springboot框架,前端框架主要用的是layui,表格用的bootstrap 表格,都是一些主流的框架,前端模板引擎用的是beetl,操作简单,通俗易懂,用的都是简单的技术很适合做毕业设计。
项目的主要功能:
1、信息维护:主要维护一些房间的信息,包括房间增加、房间维修等;
2、登记管理:主要是入住登记、退租以及房间的历史使用情况;
3、工作文件:发布一些公告、附件以及附件的下载;
4、申请管理:主要是员工请假申请、调休申请;
5、考勤打卡:员工考勤用的,上班下班打卡,若当天(非周末)23点55分没有打上班卡且没有请假、调休,会自动记为旷工(定时器)
6、账号管理:创建用户以及给用户分配菜单资源权限,若不想用哪个模块或者哪个菜单,可直接隐藏,方便简单;
7、菜单维护:对菜单的增删改查,配置菜单图标、访问路径等
运行环境:jdk1.8、eclipse/idea、Mysql5.7、Navicat/Sqlyog、Maven3.5/3.6
@Autowired
private ScenicService scenicService;
@Autowired
private ScenicDao scenicDao;
@Autowired
private HotelService hotelService;
@Autowired
private HotelDao hotelDao;
/**
*查询星级
* @return
*/
scenics.add( criteriaBuilder.like(root.get("name"),"%"+search_key+"%"));
return criteriaBuilder.and(scenics.toArray(new Predicate[scenics.size()]));
};
Page<Scenic> page=scenicDao.findAll(specification,pageable);
model.addAttribute("name",search_key);
model.addAttribute("attrs",page);
model.addAttribute("number",page.getNumber());
model.addAttribute("numberOfElements",page.getNumberOfElements());
model.addAttribute("size",page.getSize());
model.addAttribute("totalElements",page.getTotalElements());
model.addAttribute("totalPages",page.getTotalPages());
model.addAttribute("first",page.isFirst());
model.addAttribute("last",page.isLast());
return 2;
if (o1.getStar().equals(o2.getStar()) ){
return 1;
return -1;
});
if (hotels.size()>=4){
List newList=hotels.subList(0,3);
model.addAttribute("scenics",newList);
System.out.println("个数:"+newList.size());
}else {
model.addAttribute("scenics",hotels);
if (o1.getStar().equals(o2.getStar()) ){
return 1;
return -1;
});
if (hotels.size()>=4){
List newList=hotels.subList(0,3);
model.addAttribute("scenics",newList);
System.out.println("个数:"+newList.size());
}else {
model.addAttribute("scenics",hotels);
System.out.println("个数2:"+hotels.size());
return "page/product::table_refresh";
System.out.println("数据为空!");
return new Result(false,0,"","");
/**
*查询星级
* @return
*/
@ResponseBody
@RequestMapping(value = "/hotel",method = RequestMethod.POST)
public Result judgeHotelStar(Long id,String start){
Hotel scenic = hotelService.findById(id);
*/
@ResponseBody
@RequestMapping(value = "/star",method = RequestMethod.POST)
public Result judgeStar(String id,String start){
System.out.println(id+"===="+start);
Optional<Scenic> s = scenicDao.findById(id);
if (s.isPresent()){
Scenic scenic = s.get();
int valuestar = (Integer.valueOf(start)+Integer.valueOf(scenic.getStart()))/2;
scenic.setStart(valuestar);
scenicDao.save(scenic);
System.out.println("数据不为空!");
return new Result(true,1,"","");
}else {
public Result add(Orders orders, HttpSession session){
//获取数量
User user = (User) session.getAttribute("user");
if (user == null){
return new Result(false,StatusCode.ACCESSERROR,"请登录");
return ordersService.add(orders,user.getId(),orders.getId(),orders.getQty());
/**
* 修改
* @param
*/
@ResponseBody
@RequestMapping(value="/{id}",method= RequestMethod.PUT)
public Result update(@PathVariable Long id){
private HttpServletRequest request;
@Autowired
BCryptPasswordEncoder encoder;
/**
* 查询全部数据
* @return
*/
@RequestMapping(value = "userList",method = RequestMethod.GET)
public Result findAll() {
List<User> all = userService.findAll();
return new Result(true, StatusCode.OK, "查询成功",all,all.size());
/**
Scenic scenic = s.get();
int valuestar = (Integer.valueOf(start)+Integer.valueOf(scenic.getStart()))/2;
scenic.setStart(valuestar);
scenicDao.save(scenic);
System.out.println("数据不为空!");
return new Result(true,1,"","");
}else {
System.out.println("数据为空!");
return new Result(false,0,"","");
/**
public Result judgeHotelStar(Long id,String start){
Hotel scenic = hotelService.findById(id);
if (scenic!=null){
int valuestar = (Integer.valueOf(start)+Integer.valueOf(scenic.getStar()))/2;
scenic.setStar(valuestar);
hotelDao.save(scenic);
System.out.println("数据不为空!");
return new Result(true,1,"","");
}else {
System.out.println("数据为空!");
* @param start
* @param limit
* @param search_key
* @return
*/
@RequestMapping("/search_attrs")
public String search_attrs(Model model,@RequestParam(value = "start" ,defaultValue = "0")Integer start,
@RequestParam(value = "limit" ,defaultValue = "6")Integer limit,
@RequestParam String search_key){
start=start<0?0:start;
Sort sort=new Sort(Sort.Direction.DESC,"id");
Pageable pageable=PageRequest.of(start,limit,sort);
Specification specification=new Specification() {
if(!StringUtil.emailFormat(email)){
return new Result(true,StatusCode.ERROR,"请填写正确的邮箱格式");
User useremail= userService.findByEmail(email);
if (useremail == null){
return new Result(true,StatusCode.OK,"该邮箱可以注册");
return new Result(false,StatusCode.ERROR,"该邮箱已经被注册");
/**
* 用户登录
* @param loginMap
* @return
*/
@ResponseBody
@RequestMapping(value="/login",method=RequestMethod.POST)
@ResponseBody
@RequestMapping(value="/login",method=RequestMethod.POST)
public Result login(@RequestParam Map<String,String> loginMap,HttpServletRequest request){
String mobile = loginMap.get("login");
if (StringUtil.isMobile(mobile)){
User user = userService.findByMobileAndPassword(loginMap.get("login"),loginMap.get("password"));
if(user!=null){
request.getSession().setAttribute("user",user);
Map map=new HashMap();
return new Result(true,StatusCode.OK,"登陆成功");
* @return
*/
@ResponseBody
@RequestMapping(value = "/hotel",method = RequestMethod.POST)
public Result judgeHotelStar(Long id,String start){
Hotel scenic = hotelService.findById(id);
if (scenic!=null){
int valuestar = (Integer.valueOf(start)+Integer.valueOf(scenic.getStar()))/2;
scenic.setStar(valuestar);
hotelDao.save(scenic);
System.out.println("数据不为空!");
return new Result(true,1,"","");
}else {
System.out.println("数据为空!");
/**
* 分页+多条件查询
* @param searchMap 查询条件封装
* @param page 页码
* @param size 页大小
* @return 分页结果
*/
@RequestMapping(value="/search/{page}/{size}",method=RequestMethod.POST)
public Result findSearch(@RequestBody Map searchMap , @PathVariable int page, @PathVariable int size){
Page<User> pageList = userService.findSearch(searchMap, page, size);
*/
@ResponseBody
@RequestMapping(value="/login",method=RequestMethod.POST)
public Result login(@RequestParam Map<String,String> loginMap,HttpServletRequest request){
String mobile = loginMap.get("login");
if (StringUtil.isMobile(mobile)){
User user = userService.findByMobileAndPassword(loginMap.get("login"),loginMap.get("password"));
if(user!=null){
request.getSession().setAttribute("user",user);
Map map=new HashMap();
return new Result(true,StatusCode.OK,"登陆成功");
}else{
return new Result(false,StatusCode.LOGINERROR,"用户名或密码错误");
}else {
List<Hotel> hotels=hotelService.findByCountryLike(scenic.getContry());
Collections.sort(hotels, new Comparator<Hotel>() {
@Override
public int compare(Hotel o1, Hotel o2) {
if (o1.getStar()<o2.getStar()){
return 2;
if (o1.getStar().equals(o2.getStar()) ){
return 1;
return -1;
});
if (hotels.size()>=4){
List newList=hotels.subList(0,3);