本文主要是介绍java基于ssm的房屋租赁管理系统、房屋出租管理系统、租房管理系统,附源码+数据库,免费安装部署运行,包运行,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1、项目介绍
java基于ssm的房屋租赁管理系统、房屋出租管理系统、租房管理系统, 系统分为前台用户界面和后台系统管理。
1.1 前台用户界面
用户注册、用户登录、用户中心、浏览房源、房源搜索
查看房源明细、发布房源、提交合同、新闻公告、留言交流
1.2 后台系统管理
用户管理:用户列表、用户删除、用户查询
新闻管理:新闻列表、添加新闻、修改新闻、删除新闻、查询新闻
房屋管理:房屋列表、房屋删除、分页查看
留言管理:留言列表、留言删除、留言查询、留言回复列表、回复查询
租赁合同管理:合同列表、查看合同、删除合同
管理员管理:管理员管理、新增管理员、编辑管理员、删除管理员等
2、技术框架
编程语言:Java
系统架构:B/S
前端框架:JSP、jQuery
后端框架:SSM(Spring、SpringMVC、MyBatis)
数据库:MySQL
Maven项目:否
运行环境:JDK8+MySQL5.6+Idea+Tomcat8.5
3、演示视频
java基于ssm的房屋租赁管理系统、房屋出租管理系统、租房管理系统,附源码+数据库,适合毕业设计、课程设计、大实验、实训
B站视频地址:java基于ssm的房屋租赁管理系统、房屋出租管理系统、租房管理系统,附源码+数据库,适合毕业设计、课程设计、大实验、实训_哔哩哔哩_bilibili
4、项目截图
4.1、前台首页
4.2、用户注册
4.3、用户登录
4.4、新闻公告
4.5、房源分类
4.6、留言交流
4.7、用户中心
4.8、用户信息管理
4.9、修改密码
4.10、发布房源
4.11、我的房源
4.12、提交合同
4.13、我的合同
4.14、后台登录
4.15、后台-管理员管理
4.16、后台-用户管理
4.17、后台-新闻公告管理
4.18、后台-访问类型管理
4.19、后台-访问管理
4.20、后台-租赁合同管理
4.21、后台-留言交流管理
4.22、留言回复管理
6、代码示例
package com.action;import java.util.ArrayList;
import java.util.List;import javax.annotation.Resource;import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;import com.entity.Article;
import com.entity.Bbs;
import com.entity.Cate;
import com.entity.Contract;
import com.entity.House;
import com.entity.Rebbs;
import com.entity.Users;
import com.service.ArticleService;
import com.service.BbsService;
import com.service.CateService;
import com.service.ContractService;
import com.service.HouseService;
import com.service.RebbsService;
import com.service.UsersService;
import com.util.VeDate;//定义为控制器
@Controller
// 设置路径
@RequestMapping("/index")
public class IndexAction extends BaseAction {@Autowired@Resourceprivate UsersService usersService;@Autowired@Resourceprivate ArticleService articleService;@Autowired@Resourceprivate CateService cateService;@Autowired@Resourceprivate HouseService houseService;@Autowired@Resourceprivate ContractService contractService;@Autowired@Resourceprivate BbsService bbsService;@Autowired@Resourceprivate RebbsService rebbsService;// 公共方法 提供公共查询数据private void front() {this.getRequest().setAttribute("cateList", this.cateService.getAllCate());this.getRequest().setAttribute("hotList", this.houseService.getHotHouse());this.getRequest().setAttribute("title", "房屋租赁系统");}// 首页显示@RequestMapping("index.action")public String index() {this.front();List<Article> articleList = this.articleService.getFrontArticle();this.getRequest().setAttribute("articleList", articleList);List<Cate> frontList = new ArrayList<Cate>();List<Cate> cateList = this.cateService.getFrontCate();for (Cate cate : cateList) {List<House> houseList = this.houseService.getFrontHouse(cate.getCateid());cate.setHouseList(houseList);frontList.add(cate);}this.getRequest().setAttribute("frontList", frontList);this.getRequest().setAttribute("newsList", this.houseService.getNewsHouse());return "users/index";}// 分类查询@RequestMapping("cate.action")public String cate(String id) {this.front();House house = new House();house.setStatus("待租");house.setCateid(id);List<House> houseList = this.houseService.getHouseByCond(house);this.getRequest().setAttribute("houseList", houseList);return "users/list";}// 模糊查询@RequestMapping("query.action")public String query() {this.front();String name = this.getRequest().getParameter("name");House house = new House();house.setStatus("待租");house.setHousename(name);List<House> houseList = this.houseService.getHouseByLike(house);this.getRequest().setAttribute("houseList", houseList);return "users/list";}// 全部查询@RequestMapping("all.action")public String all() {this.front();House house = new House();house.setStatus("待租");List<House> houseList = this.houseService.getHouseByCond(house);this.getRequest().setAttribute("houseList", houseList);return "users/list";}// 全部查询@RequestMapping("detail.action")public String detail(String id) {this.front();House house = this.houseService.getHouseById(id);house.setHits("" + (Integer.parseInt(house.getHits()) + 1));this.houseService.updateHouse(house);this.getRequest().setAttribute("house", house);return "users/detail";}// 公告@RequestMapping("article.action")public String article(String number) {this.front();List<Article> articleList = new ArrayList<Article>();List<Article> tempList = this.articleService.getAllArticle();int pageNumber = tempList.size();int maxPage = pageNumber;if (maxPage % 10 == 0) {maxPage = maxPage / 10;} else {maxPage = maxPage / 10 + 1;}if (number == null) {number = "0";}int start = Integer.parseInt(number) * 10;int over = (Integer.parseInt(number) + 1) * 10;int count = pageNumber - over;if (count <= 0) {over = pageNumber;}for (int i = start; i < over; i++) {Article x = tempList.get(i);articleList.add(x);}String html = "";StringBuffer buffer = new StringBuffer();buffer.append(" 共为");buffer.append(maxPage);buffer.append("页 共有");buffer.append(pageNumber);buffer.append("条 当前为第");buffer.append((Integer.parseInt(number) + 1));buffer.append("页 ");if ((Integer.parseInt(number) + 1) == 1) {buffer.append("首页");} else {buffer.append("<a href=\"index/article.action?number=0\">首页</a>");}buffer.append(" ");if ((Integer.parseInt(number) + 1) == 1) {buffer.append("上一页");} else {buffer.append("<a href=\"index/article.action?number=" + (Integer.parseInt(number) - 1) + "\">上一页</a>");}buffer.append(" ");if (maxPage <= (Integer.parseInt(number) + 1)) {buffer.append("下一页");} else {buffer.append("<a href=\"index/article.action?number=" + (Integer.parseInt(number) + 1) + "\">下一页</a>");}buffer.append(" ");if (maxPage <= (Integer.parseInt(number) + 1)) {buffer.append("尾页");} else {buffer.append("<a href=\"index/article.action?number=" + (maxPage - 1) + "\">尾页</a>");}html = buffer.toString();this.getRequest().setAttribute("html", html);this.getRequest().setAttribute("articleList", articleList);return "users/article";}// 阅读公告@RequestMapping("read.action")public String read(String id) {this.front();Article article = this.articleService.getArticleById(id);article.setHits("" + (Integer.parseInt(article.getHits()) + 1));this.articleService.updateArticle(article);this.getRequest().setAttribute("article", article);return "users/read";}// 准备登录@RequestMapping("preLogin.action")public String prelogin() {this.front();return "users/login";}// 用户登录@RequestMapping("login.action")public String login() {this.front();String username = this.getRequest().getParameter("username");String password = this.getRequest().getParameter("password");Users u = new Users();u.setUsername(username);List<Users> usersList = this.usersService.getUsersByCond(u);if (usersList.size() == 0) {this.getSession().setAttribute("message", "用户名不存在");return "redirect:/index/preLogin.action";} else {Users users = usersList.get(0);if (password.equals(users.getPassword())) {this.getSession().setAttribute("userid", users.getUsersid());this.getSession().setAttribute("username", users.getUsername());this.getSession().setAttribute("users", users);return "redirect:/index/index.action";} else {this.getSession().setAttribute("message", "密码错误");return "redirect:/index/preLogin.action";}}}// 准备注册@RequestMapping("preReg.action")public String preReg() {this.front();return "users/register";}// 用户注册@RequestMapping("register.action")public String register(Users users) {this.front();Users u = new Users();u.setUsername(users.getUsername());List<Users> usersList = this.usersService.getUsersByCond(u);if (usersList.size() == 0) {users.setRegdate(VeDate.getStringDateShort());this.usersService.insertUsers(users);} else {this.getSession().setAttribute("message", "用户名已存在");return "redirect:/index/preReg.action";}return "redirect:/index/preLogin.action";}// 退出登录@RequestMapping("exit.action")public String exit() {this.front();this.getSession().removeAttribute("userid");this.getSession().removeAttribute("username");this.getSession().removeAttribute("users");return "index";}// 准备修改密码@RequestMapping("prePwd.action")public String prePwd() {this.front();if (this.getSession().getAttribute("userid") == null) {return "redirect:/index/preLogin.action";}return "users/editpwd";}// 修改密码@RequestMapping("editpwd.action")public String editpwd() {this.front();if (this.getSession().getAttribute("userid") == null) {return "redirect:/index/preLogin.action";}String userid = (String) this.getSession().getAttribute("userid");String password = this.getRequest().getParameter("password");String repassword = this.getRequest().getParameter("repassword");Users users = this.usersService.getUsersById(userid);if (password.equals(users.getPassword())) {users.setPassword(repassword);this.usersService.updateUsers(users);} else {this.getSession().setAttribute("message", "旧密码错误");return "redirect:/index/prePwd.action";}return "redirect:/index/prePwd.action";}@RequestMapping("usercenter.action")public String usercenter() {this.front();if (this.getSession().getAttribute("userid") == null) {return "redirect:/index/preLogin.action";}return "users/usercenter";}@RequestMapping("userinfo.action")public String userinfo() {this.front();if (this.getSession().getAttribute("userid") == null) {return "redirect:/index/preLogin.action";}String userid = (String) this.getSession().getAttribute("userid");this.getSession().setAttribute("users", this.usersService.getUsersById(userid));return "users/userinfo";}@RequestMapping("personal.action")public String personal(Users users) {this.front();if (this.getSession().getAttribute("userid") == null) {return "redirect:/index/preLogin.action";}this.usersService.updateUsers(users);return "redirect:/index/userinfo.action";}// 留言板@RequestMapping("bbs.action")public String bbs() {this.front();List<Bbs> bbsList = this.bbsService.getAllBbs();this.getRequest().setAttribute("bbsList", bbsList);return "users/bbs";}// 发布留言@RequestMapping("addbbs.action")public String addbbs() {this.front();if (this.getSession().getAttribute("userid") == null) {return "redirect:/index/preLogin.action";}String userid = (String) this.getSession().getAttribute("userid");Bbs bbs = new Bbs();bbs.setAddtime(VeDate.getStringDate());bbs.setContents(getRequest().getParameter("contents"));bbs.setHits("0");bbs.setRepnum("0");bbs.setTitle(getRequest().getParameter("title"));bbs.setUsersid(userid);this.bbsService.insertBbs(bbs);return "redirect:/index/bbs.action";}// 查看留言@RequestMapping("readbbs.action")public String readbbs() {this.front();Bbs bbs = this.bbsService.getBbsById(getRequest().getParameter("id"));bbs.setHits("" + (Integer.parseInt(bbs.getHits()) + 1));this.bbsService.updateBbs(bbs);this.getRequest().setAttribute("bbs", bbs);Rebbs rebbs = new Rebbs();rebbs.setBbsid(bbs.getBbsid());List<Rebbs> rebbsList = this.rebbsService.getRebbsByCond(rebbs);this.getRequest().setAttribute("rebbsList", rebbsList);return "users/readbbs";}// 回复留言@RequestMapping("rebbs.action")public String rebbs() {this.front();if (this.getSession().getAttribute("userid") == null) {return "redirect:/index/preLogin.action";}String userid = (String) this.getSession().getAttribute("userid");Rebbs rebbs = new Rebbs();rebbs.setAddtime(VeDate.getStringDate());rebbs.setContents(getRequest().getParameter("contents"));rebbs.setBbsid(getRequest().getParameter("bbsid"));rebbs.setUsersid(userid);this.rebbsService.insertRebbs(rebbs);Bbs bbs = this.bbsService.getBbsById(rebbs.getBbsid());bbs.setRepnum("" + (Integer.parseInt(bbs.getRepnum()) + 1));this.bbsService.updateBbs(bbs);String path = "redirect:/index/readbbs.action?id=" + bbs.getBbsid();return path;}@RequestMapping("preHouse.action")public String preHouse() {this.front();if (this.getSession().getAttribute("userid") == null) {return "redirect:/index/preLogin.action";}return "users/addHouse";}@RequestMapping("addHouse.action")public String addHouse(House house) {this.front();if (this.getSession().getAttribute("userid") == null) {return "redirect:/index/preLogin.action";}String userid = (String) this.getSession().getAttribute("userid");house.setAddtime(VeDate.getStringDateShort());house.setHits("0");house.setUsersid(userid);house.setStatus("待租");this.houseService.insertHouse(house);return "redirect:/index/preHouse.action";}@RequestMapping("myHouse.action")public String myHouse() {this.front();if (this.getSession().getAttribute("userid") == null) {return "redirect:/index/preLogin.action";}String userid = (String) this.getSession().getAttribute("userid");House house = new House();house.setUsersid(userid);List<House> houseList = this.houseService.getHouseByCond(house);this.getRequest().setAttribute("houseList", houseList);return "users/myHouse";}@RequestMapping("deleteHouse.action")public String deleteHouse(String id) {this.front();if (this.getSession().getAttribute("userid") == null) {return "redirect:/index/preLogin.action";}this.houseService.deleteHouse(id);return "redirect:/index/myHouse.action";}@RequestMapping("getHouseById.action")public String getHouseById(String id) {this.front();if (this.getSession().getAttribute("userid") == null) {return "redirect:/index/preLogin.action";}House house = this.houseService.getHouseById(id);this.getRequest().setAttribute("house", house);return "users/editHouse";}@RequestMapping("updateHouse.action")public String updateHouse(House house) {this.front();if (this.getSession().getAttribute("userid") == null) {return "redirect:/index/preLogin.action";}this.houseService.updateHouse(house);return "redirect:/index/myHouse.action";}@RequestMapping("preContract.action")public String preContract() {this.front();if (this.getSession().getAttribute("userid") == null) {return "redirect:/index/preLogin.action";}this.getRequest().setAttribute("cno", "C" + VeDate.getStringId());String userid = (String) this.getSession().getAttribute("userid");House house = new House();house.setUsersid(userid);house.setStatus("待租");List<House> houseList = this.houseService.getHouseByCond(house);this.getRequest().setAttribute("houseList", houseList);return "users/addContract";}@RequestMapping("addContract.action")public String addContract(Contract contract) {this.front();if (this.getSession().getAttribute("userid") == null) {return "redirect:/index/preLogin.action";}String userid = (String) this.getSession().getAttribute("userid");contract.setAddtime(VeDate.getStringDateShort());contract.setStatus("未完成");contract.setUsersid(userid);this.contractService.insertContract(contract);House house = this.houseService.getHouseById(contract.getHouseid());house.setStatus("出租");this.houseService.updateHouse(house);return "redirect:/index/preContract.action";}@RequestMapping("myContract.action")public String myContract() {this.front();if (this.getSession().getAttribute("userid") == null) {return "redirect:/index/preLogin.action";}String userid = (String) this.getSession().getAttribute("userid");Contract contract = new Contract();contract.setUsersid(userid);List<Contract> contractList = this.contractService.getContractByCond(contract);this.getRequest().setAttribute("contractList", contractList);return "users/myContract";}@RequestMapping("over.action")public String over(String id) {this.front();if (this.getSession().getAttribute("userid") == null) {return "redirect:/index/preLogin.action";}Contract contract = this.contractService.getContractById(id);contract.setStatus("完成");this.contractService.updateContract(contract);House house = this.houseService.getHouseById(contract.getHouseid());house.setStatus("待租");this.houseService.updateHouse(house);return "redirect:/index/myContract.action";}@RequestMapping("deleteContract.action")public String deleteContract(String id) {this.front();if (this.getSession().getAttribute("userid") == null) {return "redirect:/index/preLogin.action";}Contract contract = this.contractService.getContractById(id);House house = this.houseService.getHouseById(contract.getHouseid());house.setStatus("待租");this.houseService.updateHouse(house);this.contractService.deleteContract(id);return "redirect:/index/myContract.action";}}
这篇关于java基于ssm的房屋租赁管理系统、房屋出租管理系统、租房管理系统,附源码+数据库,免费安装部署运行,包运行的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!