源码获取:俺的博客首页 "资源" 里下载!
项目介绍
基于Springboot+vue房屋租赁系统
本系统分为前后台,包含管理员、用户、房主三种角色,前台为普通用户、房主登录,后台为管理员、用户、房主分别登录。
前台主要功能:首页、房屋信息、我要当房主、公告信息、留言反馈、用户登录、用户注册、用户个人中心等功能;
后台管理员主要功能:首页、个人中心、用户管理、房主管理、房屋类型管理、房屋信息管理、预约看房管理、合同信息管理、房屋报修管理、维修处理管理、房屋评价管理、我要当房主管理、留言板管理、系统管理等。
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
4.数据库:MySql 5.7/8.0版本均可;
5.是否Maven项目:是;
技术栈
后端:SpringBoot+Mybaits
前端:Vue+elementui
使用说明
项目运行:
1. 使用Navicat或者其它工具,在mysql中创建对应sql文件名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,导入成功后请执行maven clean;maven install命令;
3. 将项目中application.yml配置文件中的数据库配置改为自己的配置;
4. 运行项目,在浏览器中输入地址:
前台地址:http://localhost:8080/springboot08hr3/front/index.html
后台地址
http://localhost:8080/springboot08hr3/admin/dist/index.html
管理员:abo 密码:abo
注意项目文件路径中不能含有中文、空格、特殊字符等,否则图片会上传不成功。
系统用户登录页面:
个人信息页面展示:
房屋类型页面展示:
房屋信息页面展示:
轮播图页面展示:
首页页面展示:
个人用户登录页面展示:
个人中心页面展示:
我要当房主页面展示:
房主房屋管理页面展示:
租房列表控制层:
@Controller
@RequestMapping("/zulist")
public class ZulistController {
@Autowired
private ZulistService zulistService;
@Autowired
private UserlistService userlistService;
//跳到增添合同的页面
@RequestMapping("/toaddhetong")
public String toaddhetong(Model model,String house_id){
Hetong hetong=new Hetong();
hetong.setHouse_id(house_id);
model.addAttribute("hetong", hetong);
model.addAttribute("mainPage", "addhetong.jsp");
return "admin/main1";
}
//管理员查看所有在售列表
@RequestMapping("/findzulist")
public String findzulist(Model model,@RequestParam(required=false,defaultValue="1") Integer page,
@RequestParam(required=false,defaultValue="2") Integer pageSize) throws Exception{
PageHelper.startPage(page, pageSize);
List<Zulist> zulist=zulistService.findzuuserlist();
PageInfo<Zulist> p=new PageInfo<Zulist>(zulist);
model.addAttribute("p", p);
model.addAttribute("zulist", zulist);
model.addAttribute("mainPage", "zulist.jsp");
return "admin/main1";
}
//查看我的在售列表
@RequestMapping("/myzulist")
public String myzulist(Model model,HttpSession httpSession,@RequestParam(required=false,defaultValue="1") Integer page,
@RequestParam(required=false,defaultValue="2") Integer pageSize) throws Exception{
User user1= (User) httpSession.getAttribute("user");
Userlist userlist=userlistService.findhasuserlist(user1.getId());
PageHelper.startPage(page, pageSize);
List<Userlist> list=userlistService.getUserzuList(userlist.getId());
PageInfo<Userlist> p=new PageInfo<Userlist>(list);
model.addAttribute("userlistzu", list);
model.addAttribute("p", p);
model.addAttribute("mainPage", "myzulist.jsp");
return "zuke/main";
}
}
房屋列表控制层:
@Controller
public class HoustlistController {
@Autowired
private HouselistService houselistService;
@RequestMapping("/houselist")
public String houselist(Model model ,@RequestParam(required=false,defaultValue="1") Integer page,
@RequestParam(required=false,defaultValue="2") Integer pageSize){
PageHelper.startPage(page, pageSize);
List<Houselist> houselist=houselistService.selectAll();
PageInfo<Houselist> p=new PageInfo<Houselist>(houselist);
model.addAttribute("p", p);
model.addAttribute("houselist",houselist);
model.addAttribute("mainPage","houselist.jsp");
return "zuke/main";
}
@RequestMapping("/ahouselist")
public String ahouselist(Model model ,@RequestParam(required=false,defaultValue="1") Integer page,
@RequestParam(required=false,defaultValue="2") Integer pageSize){
PageHelper.startPage(page, pageSize);
List<Houselist> houselist=houselistService.selectAll();
PageInfo<Houselist> p=new PageInfo<Houselist>(houselist);
model.addAttribute("p", p);
model.addAttribute("houselist",houselist);
model.addAttribute("mainPage","ahouselist.jsp");
return "admin/main1";
}
@RequestMapping("/addhouse")
public String addhouse(Model model ,Houselist houselist){
String houseid=houselist.getHouseid();
Houselist houselist1=houselistService.findhouseid(houseid);
if(houselist1!=null){
model.addAttribute("error","该房屋id已存在");
model.addAttribute("houselist",houselist);
model.addAttribute("mainPage","addhouse.jsp");
return "admin/main1";
}else{
model.addAttribute("error","添加成功");
houselistService.inserthouse(houselist);
model.addAttribute("houselist",houselist);
model.addAttribute("mainPage","addhouse.jsp");
return "admin/main1";
}
}
@RequestMapping("/toaddhouse")
public String toaddhoust(Model model){
model.addAttribute("mainPage","addhouse.jsp");
return "admin/main1";
}
@RequestMapping("/deletehouse")
public String deletehouse(Integer id){
houselistService.deletehouse(id);
return "redirect:ahouselist.action";
}
@RequestMapping("/toahouselist")
public String toahouselist(){
return "ahouselist.action";
}
@RequestMapping("/findid")
public String findid(Integer id,Model model){
Houselist list=houselistService.findid(id);
model.addAttribute("houselist",list);
model.addAttribute("mainPage", "changehouse.jsp");
return "admin/main1";
}
@RequestMapping("/findhouseidupdate")
public String findhouseidupdate(Houselist houselist,Model model){
Houselist list=houselistService.findhouseidupdate(houselist);
if(list!=null){
model.addAttribute("houselist",houselist);
model.addAttribute("mainPage", "changehouse.jsp");
model.addAttribute("error","该房屋id已存在");
return "admin/main1";
}
else{
houselistService.updatehouse(houselist);
model.addAttribute("houselist",houselist);
model.addAttribute("mainPage", "changehouse.jsp");
model.addAttribute("error","更新成功");
return "admin/main1";
}
}
}
合同管理控制层:
@Controller
@RequestMapping("/hetong")
public class HetongController {
@Autowired
private HetongService hetongService;
@Autowired
private HouselistService houselistService;
@Autowired
private ApplyService applyService;
@Autowired
private ZulistService zulistService;
@Autowired
private CheckoutService checkoutService;
//新增合同信息,修改房屋列表的状态,从申请列表中删除,增添到销售列表当中
@RequestMapping("/inserthetong")
public String inserthetong(Model model,Hetong hetong){
//新增合同信息
hetongService.inserthetong(hetong);
Hetong hetong1=hetongService.findhetong(hetong.getHouse_id());
//修改房屋列表状态
Houselist houselist=houselistService.findhouseid(hetong1.getHouse_id());
houselist.setStatus("已销售");
houselistService.updatehousestatus(houselist);
//添加到销售列表当中
Zulist zulist=new Zulist();
Apply apply=applyService.findbyhouse_id(hetong.getHouse_id());
zulist.setHouse_id(hetong.getHouse_id());
zulist.setUserlist_id(apply.getUserlist_id());
zulist.setContract_id(hetong1.getId());
zulist.setPrice(apply.getPrice());
zulist.setAddress(apply.getAddress());
zulistService.insertzulist(zulist);
//从申请列表中删除
applyService.deletebyhouse_id(hetong1.getHouse_id());
model.addAttribute("error", "zusuccess");
return "redirect:/zulist/findzulist.action";
}
@RequestMapping("/seehetong")
public String seehetong(String house_id,Model model){
Hetong hetong=hetongService.findhetong(house_id);
model.addAttribute("hetong", hetong);
model.addAttribute("mainPage", "hetong.jsp");
return "admin/main1";
}
@RequestMapping("/updatehetong")
public String updatehetong(String house_id,Model model){
Hetong hetong=hetongService.findhetong(house_id);
model.addAttribute("hetong", hetong);
model.addAttribute("mainPage", "updatehetong.jsp");
return "admin/main1";
}
@RequestMapping("/changehetong")
public String changehetong(Hetong hetong){
hetongService.updatehetong(hetong);
return "redirect:/zulist/findzulist.action";
}
//终止合同操作:删除合同,插入退房列表,删除在售列表,删除房屋列表
@RequestMapping("/deletehetong")
public String deletehetong(String house_id,Model model){
hetongService.deletehetong(house_id);
Zulist zulist=zulistService.findzulist(house_id);
Checkout checkout=new Checkout();
checkout.setHouse_id(house_id);
checkout.setAddress(zulist.getAddress());
checkout.setStatus("已退房");
checkout.setUserlist_id(zulist.getUserlist_id());
checkoutService.insertcheckout(checkout);
houselistService.deletehousebyhouseid(house_id);
zulistService.deletezulist(house_id);
model.addAttribute("error", "checkoutsuccess");
return "redirect:/zulist/findzulist.action";
}
@RequestMapping("/zukeseehetong")
public String zukeseehetong(String house_id,Model model){
Hetong hetong=hetongService.findhetong(house_id);
model.addAttribute("hetong", hetong);
model.addAttribute("mainPage", "showhetong.jsp");
return "zuke/main";
}
}
用户管理员控制层:
@Controller
public class UserController {
@Autowired
private UserService userService;
@RequestMapping("/login")
public String userList() throws Exception{
return "login";
}
@RequestMapping("/logincheck")
public String login(User user,Model model,HttpSession httpSession) throws Exception{
User user1=userService.login(user);
if(user1!=null){
httpSession.setAttribute("user", user1);
if(user1.getType().equals("zuke")){
return "zuke/main";
}
else{
return "admin/main1";
}
}else{
String error="error";
model.addAttribute("error", error);
return "login";
}
}
@RequestMapping("/toindex")
public String toindex(Model model) throws Exception{
return "admin/index";
}
}
源码获取:俺的博客首页 "资源" 里下载!