作者主页:夜未央5788

简介:Java领域优质创作者、Java项目、学习资料、技术互助

文末获取源码

项目介绍

该项目分为前后台,分为普通用户与管理员两种角色。
前台主要功能包括:
普通用户的注册、登录,房屋列表展示,租房,我的订单、用户中心等功能模块;

后台主要功能包括:
系统设置:菜单管理、角色管理、修改密码;
用户管理:用户列表;
系统日志:日志列表;
房屋管理:房屋列表;

租赁管理:租赁列表;

环境需要

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版本;

6.是否Maven项目:否;

技术栈

1. 后端:Spring+SpringMVC+Mybatis

2. 前端:JSP+EasyUI+Echarts+jQuery

使用说明

1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;

2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;

若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;

3. 将项目中db.properties配置文件中的数据库配置改为自己的配置;

4. 运行项目,输入localhost:8080即可

运行截图

前台界面

后台界面

相关代码

前台首页控制器

/*** 前台首页控制器* @author Administrator**/
@RequestMapping("/home")
@Controller
public class HomeController {@Autowiredprivate RoomTypeService roomTypeService;@Autowiredprivate AccountService accountService;/*** 前台首页* @param model* @param name* @return* @throws UnsupportedEncodingException */@RequestMapping(value="/index",method=RequestMethod.GET)public ModelAndView list(ModelAndView model,@RequestParam(name="name",defaultValue="") String names,HttpServletRequest request) throws UnsupportedEncodingException{request.setCharacterEncoding("UTF-8");System.out.println("--前台首页--");System.out.println("name:"+names);
//      String name=new String(names.getBytes("ISO-8859-1"),"UTF-8");Map<String,Object> queryMap = new HashMap<String, Object>();queryMap.put("name", names);queryMap.put("offset", 0);queryMap.put("pageSize", 999);model.addObject("roomTypeList", roomTypeService.findList(queryMap));model.setViewName("home/index/index");
//      model.setViewName("home/index/home");model.addObject("kw", names);return model;}/*** 登录页面* @param model* @return*/@RequestMapping(value="/login",method=RequestMethod.GET)public ModelAndView login(ModelAndView model){System.out.println("---login---");model.setViewName("home/index/login");return model;}/*** 注册页面* @param model* @return*/@RequestMapping(value="/reg",method=RequestMethod.GET)public ModelAndView reg(ModelAndView model){model.setViewName("home/index/reg");return model;}/*** 登录信息提交* @param account* @return*/@RequestMapping(value="/login",method=RequestMethod.POST)@ResponseBodypublic Map<String,String> loginAct(Account account,String vcode,HttpServletRequest request){Map<String,String> retMap = new HashMap<String, String>();if(account == null){retMap.put("type", "error");retMap.put("msg", "请填写正确的用户信息!");return retMap;}if(StringUtils.isEmpty(account.getName())){retMap.put("type", "error");retMap.put("msg", "用户名不能为空!");return retMap;}if(StringUtils.isEmpty(account.getPassword())){retMap.put("type", "error");retMap.put("msg", "密码不能为空!");return retMap;}if(StringUtils.isEmpty(vcode)){retMap.put("type", "error");retMap.put("msg", "验证码不能为空!");return retMap;}Object attribute = request.getSession().getAttribute("accountLoginCpacha");if(attribute == null){retMap.put("type", "error");retMap.put("msg", "验证码过期,请刷新!");return retMap;}if(!vcode.equalsIgnoreCase(attribute.toString())){retMap.put("type", "error");retMap.put("msg", "验证码错误!");return retMap;}Account findByName = accountService.findByName(account.getName());if(findByName == null){retMap.put("type", "error");retMap.put("msg", "用户名不存在!");return retMap;}if(!account.getPassword().equals(findByName.getPassword())){retMap.put("type", "error");retMap.put("msg", "密码错误!");return retMap;}if(findByName.getStatus() == -1){retMap.put("type", "error");retMap.put("msg", "该用户已被禁用,请联系管理员!");return retMap;}request.getSession().setAttribute("account", findByName);request.getSession().setAttribute("accountLoginCpacha", null);retMap.put("type", "success");retMap.put("msg", "登录成功!");return retMap;}/*** 注册信息提交* @param account* @return*/@RequestMapping(value="/reg",method=RequestMethod.POST)@ResponseBodypublic Map<String,String> regAct(Account account){Map<String,String> retMap = new HashMap<String, String>();if(account == null){retMap.put("type", "error");retMap.put("msg", "请填写正确的用户信息!");return retMap;}if(StringUtils.isEmpty(account.getName())){retMap.put("type", "error");retMap.put("msg", "用户名不能为空!");return retMap;}if(StringUtils.isEmpty(account.getPassword())){retMap.put("type", "error");retMap.put("msg", "密码不能为空!");return retMap;}if(StringUtils.isEmpty(account.getMobile())){retMap.put("type", "error");retMap.put("msg", "手机号不能为空!");return retMap;}if(isExist(account.getName())){retMap.put("type", "error");retMap.put("msg", "该用户名已经存在!");return retMap;}if(accountService.add(account) <= 0){retMap.put("type", "error");retMap.put("msg", "注册失败,请联系管理员!");return retMap;}retMap.put("type", "success");retMap.put("msg", "注册成功!");return retMap;}/*** 退出登录* @param request* @return*/@RequestMapping(value="/logout",method=RequestMethod.GET)public String logout(HttpServletRequest request){request.getSession().setAttribute("account", null);return "redirect:login";}private boolean isExist(String name){Account account = accountService.findByName(name);if(account == null)return false;return true;}
}

房间类型管理后台控制器

/*** 房屋类型管理后台控制器* @author Administrator**/
@RequestMapping("/admin/room_type")
@Controller
public class RoomTypeController {@Autowiredprivate RoomTypeService roomTypeService;/*** 房屋类型管理列表页面* @param model* @return*/@RequestMapping(value="/list",method=RequestMethod.GET)public ModelAndView list(ModelAndView model){model.setViewName("room_type/list");return model;}/*** 房屋类型信息添加操作* @param roomType* @return*/@RequestMapping(value="/add",method=RequestMethod.POST)@ResponseBodypublic Map<String, String> add(RoomType roomType){Map<String, String> ret = new HashMap<String, String>();if(roomType == null){ret.put("type", "error");ret.put("msg", "请填写正确的房屋类型信息!");return ret;}if(StringUtils.isEmpty(roomType.getName())){ret.put("type", "error");ret.put("msg", "房屋类型名称不能为空!");return ret;}roomType.setAvilableNum(roomType.getRoomNum());//默认房屋数等于可用房屋数roomType.setBookNum(0);//设置预定数0roomType.setLivedNum(0);//设置已入住数0if(roomTypeService.add(roomType) <= 0){ret.put("type", "error");ret.put("msg", "添加失败,请联系管理员!");return ret;}ret.put("type", "success");ret.put("msg", "添加成功!");return ret;}/*** 房屋类型信息编辑操作* @param roomType* @return*/@RequestMapping(value="/edit",method=RequestMethod.POST)@ResponseBodypublic Map<String, String> edit(RoomType roomType){Map<String, String> ret = new HashMap<String, String>();if(roomType == null){ret.put("type", "error");ret.put("msg", "请填写正确的房屋类型信息!");return ret;}if(StringUtils.isEmpty(roomType.getName())){ret.put("type", "error");ret.put("msg", "房屋类型名称不能为空!");return ret;}RoomType existRoomType = roomTypeService.find(roomType.getId());if(existRoomType == null){ret.put("type", "error");ret.put("msg", "未找到该数据!");return ret;}int offset = roomType.getRoomNum() - existRoomType.getRoomNum();roomType.setAvilableNum(existRoomType.getAvilableNum() + offset);if(roomType.getAvilableNum() <= 0){roomType.setAvilableNum(0);//没有可用房屋roomType.setStatus(0);//房型已满if(roomType.getAvilableNum() + existRoomType.getLivedNum() + existRoomType.getBookNum() > roomType.getRoomNum()){ret.put("type", "error");ret.put("msg", "房屋数设置不合理!");return ret;}}if(roomTypeService.edit(roomType) <= 0){ret.put("type", "error");ret.put("msg", "修改失败,请联系管理员!");return ret;}ret.put("type", "success");ret.put("msg", "修改成功!");return ret;}/*** 分页查询房屋类型信息* @param name* @param page* @return*/@RequestMapping(value="/list",method=RequestMethod.POST)@ResponseBodypublic Map<String,Object> list(@RequestParam(name="name",defaultValue="") String name,@RequestParam(name="status",required=false) Integer status,Page page){Map<String,Object> ret = new HashMap<String, Object>();Map<String,Object> queryMap = new HashMap<String, Object>();queryMap.put("name", name);queryMap.put("status", status);queryMap.put("offset", page.getOffset());queryMap.put("pageSize", page.getRows());ret.put("rows", roomTypeService.findList(queryMap));ret.put("total", roomTypeService.getTotal(queryMap));return ret;}/*** 房屋类型信息删除操作* @param id* @return*/@RequestMapping(value="/delete",method=RequestMethod.POST)@ResponseBodypublic Map<String, String> delete(Long id){Map<String, String> ret = new HashMap<String, String>();if(id == null){ret.put("type", "error");ret.put("msg", "请选择要删除的信息!");return ret;}try {if(roomTypeService.delete(id) <= 0){ret.put("type", "error");ret.put("msg", "删除失败,请联系管理员!");return ret;}} catch (Exception e) {// TODO: handle exceptionret.put("type", "error");ret.put("msg", "该房屋类型下存在房屋信息,请先删除该房屋类型下的所有房屋信息!");return ret;}ret.put("type", "success");ret.put("msg", "删除成功!");return ret;}
}

如果也想学习本系统,下面领取。回复:142ssm

基于SSM的公寓房屋出租系统相关推荐

  1. 基于javaweb的公寓房屋出租系统(java+ssm+jsp+easyui+echarts+mysql)

    基于javaweb的公寓房屋出租系统(java+ssm+jsp+easyui+echarts+mysql) 运行环境 Java≥8.MySQL≥5.7.Tomcat≥8 开发工具 eclipse/id ...

  2. 0040 基于文本界面的房屋出租系统

    /*项目需求说明实现基于文本界面的<房屋出租软件>能够实现对房屋信息的添加.修改和删除(用数组实现),并能够打印房屋明细表项目界面----主菜单1.新增房源2.查找房屋3.删除房屋4.修改 ...

  3. 基于jsp+servlet的房屋出租系统

    项目名称 房屋出租系统 编程语言 Java语言 主要技术 jsp+servlet 开发工具 eclipse 服务器 tomcat 7.0及以上 数据库 MySQL5.5/5.7/8.0 +C3P0连接 ...

  4. java计算机毕业设计基于ssm的汽车租赁出租系统(源代码+数据库+Lw文档)

    项目介绍 随着社会的发展,计算机的优势和普及使得汽车租赁系统的开发成为必需.汽车租赁系统主要是借助计算机对汽车租赁信息等信息进行管理.减少管理员的工作,同时也方便广大用户对个人所需汽车租赁信息的及时查 ...

  5. Java项目:公寓房屋出租系统(java+SSM+JSP+EasyUI+Echarts+Mysql)

    源码获取:俺的博客首页 "资源" 里下载! 项目介绍 该项目分为前后台,分为普通用户与管理员两种角色. 前台主要功能包括: 普通用户的注册.登录,房屋列表展示,租房,我的订单.用户 ...

  6. 房屋出租系统(初级)

    前言 本项目是根据[零基础 快速学Java]韩顺平 零基础30天学会Java_哔哩哔哩_bilibili 课程进行的.项目的主要目的是巩固一下以前学习的 Java基础 知识. 需求 ​ 实现基于文本界 ...

  7. Java笔记——11.房屋出租系统

    11.房屋出租系统 项目需求说明 实现基于文本界面的"房屋出租系统" 能够实现对房屋信息的添加.修改和删除(用数组实现),并且能够打印房屋明细表 主菜单页面: 新增房源页面: 查找 ...

  8. java基于ssm+vue+elementui楼盘房屋销售系统 前后端分离

    楼盘房屋是人类居住是必须的一个环境.且因为我国城镇化比例比较高,所以当前有很多的人希望到城市购买相关的楼盘和房屋.以更方便享受城市的教育和医疗资源.也能够让需要房屋销售相关信息的人更快的获取到更加全面 ...

  9. 计算机毕业设计ssm基于SSM框架的中医养生系统i9830系统+程序+源码+lw+远程部署

    计算机毕业设计ssm基于SSM框架的中医养生系统i9830系统+程序+源码+lw+远程部署 计算机毕业设计ssm基于SSM框架的中医养生系统i9830系统+程序+源码+lw+远程部署 本源码技术栈: ...

最新文章

  1. 嵌入式Linux设备驱动程序:在运行时读取驱动程序状态
  2. 5年前面试题引发的“血案”(番外篇)(总结和乱侃)
  3. 10g添加用户 oracle_oracle 10g中如何创建用户
  4. PHP面试 MySQL创建高性能索引考点
  5. 计算机等级考试c 试题及答案,3月计算机等级考试级C笔试试题及答案解析.doc
  6. movielens1M数据处理
  7. linux的交换空间是什么意思,Linux交换空间是什么
  8. Windows 命令行基础
  9. 自用笔记17——泰波那契数列
  10. 将MindManager添加到鼠标右键新建项
  11. 最全的硬盘问题及修复方法
  12. 【腾讯广告】监测链接和API自归因回传接口逻辑
  13. 中国农业银行h5支付(php接入中国农业银行h5支付)
  14. 【TS】1552- 浅谈TS运行时类型检查
  15. 使用AutoHotKey(AHK)自动将多行内容转成单行,并翻译,或获取中文拼音
  16. 这座“坟墓”埋葬着谷歌那些年死去的产品
  17. MacFamilyTree 8.3.6 Mac 破解版 Mac上最强大的家谱制作软件
  18. 使用kong-dashboard添加Certificates的问题
  19. wwwwwwwwwww
  20. CentOS 8上安装极点五笔(亲证)

热门文章

  1. 人脸识别之DeepFace、DeepID以及FaceNet网络的区别
  2. centos8mysql配置文件在哪里_Centos7 查看Mysql配置文件
  3. Unity 镜头拉近拉远 和旋转视角
  4. Linux操作系统分析-课程总结报告
  5. 服务器上的MSDTC不可用解决办法
  6. 接入阿里视频播放遇到的坑,“AliyunVodPlayer和AliyunVodPlayerView”导入报错
  7. hadoop组件---spark实战-----airflow----调度工具airflow的介绍和使用示例
  8. C语言小游戏-是男人就坚持100秒
  9. Json格式转换报java.lang.StackOverflowError
  10. 局部与断层解剖学复习题