Java项目:SSM在线租房售房平台多城市版本

2024-02-22 16:30

本文主要是介绍Java项目:SSM在线租房售房平台多城市版本,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

作者主页:源码空间站2022

 简介: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+CSS+JavaScript+Bootstrap+jQuery

使用说明

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

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

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

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

4. 运行项目,http://localhost:8080/
用户账号/密码:user/123456
管理员账号/密码:admin/admin

运行截图

用户角色

 管理员角色

相关代码

房子控制器

package com.houserss.controller;import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;import com.houserss.common.Const;
import com.houserss.common.Const.Role;
import com.houserss.common.ServerResponse;
import com.houserss.dao.HouseMapper;
import com.houserss.pojo.House;
import com.houserss.pojo.User;
import com.houserss.service.IHouseService;
import com.houserss.vo.HouseVo;
import com.houserss.vo.PageInfoVo;@Controller
@RequestMapping("/house/")
public class HouseController {@Autowiredprivate IHouseService iHouseService;@Autowiredprivate HouseMapper houseMapper;@RequestMapping(value="publish.do",method = RequestMethod.POST)@ResponseBodypublic ServerResponse<String> publish(House house, @RequestParam(value = "images", required = false)MultipartFile images[], String[] deletes, HttpSession session,HttpServletRequest request){User currentUser = (User)session.getAttribute(Const.CURRENT_USER);String path = request.getSession().getServletContext().getRealPath("upload");if(currentUser == null){return ServerResponse.createByErrorMessage("用户未登录,请登录后在编辑");}return iHouseService.publish(currentUser,house, images, deletes,path);}@RequestMapping(value="delete.do",method = RequestMethod.POST)@ResponseBodypublic ServerResponse<String> delete(int houseId, HttpSession session){User currentUser = (User)session.getAttribute(Const.CURRENT_USER);if(currentUser == null){return ServerResponse.createByErrorMessage("用户未登录,请登录后在删除");}return iHouseService.delete(currentUser,houseId);}@RequestMapping(value="houseList.do",method = RequestMethod.POST)@ResponseBodypublic ServerResponse<PageInfoVo<HouseVo>>  houseList(@RequestParam(value = "pageNum",defaultValue = "1")int pageNum,@RequestParam(value = "pageSize",defaultValue = "10") int pageSize,@RequestParam(value = "sellType",required = false)String sellType,@RequestParam(value = "zone",required = false)String zone,@RequestParam(value = "houseType",required = false)String houseType,@RequestParam(value = "minPrice",required = false)String minPrice,@RequestParam(value = "maxPrice",required = false)String maxPrice,@RequestParam(value = "orientation",required = false)String orientation,@RequestParam(value = "decorateType",required = false)Integer decorateType,@RequestParam(value = "minArea",required = false)String minArea,@RequestParam(value = "maxArea",required = false)String maxArea,@RequestParam(value = "address",required = false)String address,@RequestParam(value = "isSelf",defaultValue = "false")boolean isSelf,@RequestParam(value = "orderType",defaultValue = "0")int orderType,@RequestParam(value = "status",required=false)Integer status,@RequestParam(value = "isHide",required=false)Integer isHide,HttpSession session){int userId = 0;User currentUser = (User)session.getAttribute(Const.CURRENT_USER);if(currentUser != null && currentUser.getRoleType() == Role.ROLE_ADMIN) {return iHouseService.houseList(pageNum,pageSize,sellType,zone,houseType,minPrice,maxPrice,orientation,minArea,maxArea,address,decorateType,userId,orderType,status,isHide);}if(currentUser != null && isSelf) {userId = currentUser.getId();}return iHouseService.houseList(pageNum,pageSize,sellType,zone,houseType,minPrice,maxPrice,orientation,minArea,maxArea,address,decorateType,userId,orderType,status,isHide);}@RequestMapping(value="detailHouse.do",method = RequestMethod.POST)@ResponseBodypublic ServerResponse<HouseVo> detailHouse(int houseId, HttpSession session){return iHouseService.detailHouse(houseId);}@RequestMapping(value="updateHouse.do",method = RequestMethod.POST)@ResponseBodypublic ServerResponse<String> updateHouse(House house,HttpSession session){User currentUser = (User)session.getAttribute(Const.CURRENT_USER);if(currentUser == null){return ServerResponse.createByErrorMessage("用户未登录");}House tempHouse = houseMapper.selectById(house.getId());if(tempHouse == null) {return ServerResponse.createByErrorMessage("未找到要修改房源信息");}return iHouseService.againPublishHouse(house);}@RequestMapping(value="setHideStatus.do",method = RequestMethod.POST)@ResponseBodypublic ServerResponse<String> setHideStatus(@RequestParam(required=true)int houseId,@RequestParam(required=true)int isHide,HttpSession session){User currentUser = (User)session.getAttribute(Const.CURRENT_USER);if(currentUser == null){return ServerResponse.createByErrorMessage("用户未登录");}House tempHouse = houseMapper.selectById(houseId);if(tempHouse == null) {return ServerResponse.createByErrorMessage("未找到要修改房源信息");}if(currentUser.getRoleType() == Role.ROLE_ADMIN){return iHouseService.setHideStatus(houseId,isHide);}else{if(tempHouse.getUserId() == currentUser.getId()){return iHouseService.setHideStatus(houseId,isHide);}}return ServerResponse.createByErrorMessage("设置房源状态异常");}// backend/*** 审核房源* @param session* @return*/@RequestMapping(value="verified.do",method = RequestMethod.POST)@ResponseBodypublic ServerResponse<String> verified(@RequestParam(required=true)int houseId,@RequestParam(required=true)int status,@RequestParam(defaultValue="",required=false)String reason,HttpSession session){User currentUser = (User)session.getAttribute(Const.CURRENT_USER);if(currentUser == null){return ServerResponse.createByErrorMessage("用户未登录");}if(currentUser.getRoleType() != Role.ROLE_ADMIN) {return ServerResponse.createByErrorMessage("该用户无权限访问");}return iHouseService.verified(houseId,status,reason);}}

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

这篇关于Java项目:SSM在线租房售房平台多城市版本的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!


原文地址:https://blog.csdn.net/m0_74967853/article/details/128365717
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.chinasem.cn/article/735830

相关文章

Java导入、导出excel用法步骤保姆级教程(附封装好的工具类)

《Java导入、导出excel用法步骤保姆级教程(附封装好的工具类)》:本文主要介绍Java导入、导出excel的相关资料,讲解了使用Java和ApachePOI库将数据导出为Excel文件,包括... 目录前言一、引入Apache POI依赖二、用法&步骤2.1 创建Excel的元素2.3 样式和字体2.

Java实现将Markdown转换为纯文本

《Java实现将Markdown转换为纯文本》这篇文章主要为大家详细介绍了两种在Java中实现Markdown转纯文本的主流方法,文中的示例代码讲解详细,大家可以根据需求选择适合的方案... 目录方法一:使用正则表达式(轻量级方案)方法二:使用 Flexmark-Java 库(专业方案)1. 添加依赖(Ma

Mybatis从3.4.0版本到3.5.7版本的迭代方法实现

《Mybatis从3.4.0版本到3.5.7版本的迭代方法实现》本文主要介绍了Mybatis从3.4.0版本到3.5.7版本的迭代方法实现,包括主要的功能增强、不兼容的更改和修复的错误,具有一定的参考... 目录一、3.4.01、主要的功能增强2、selectCursor example3、不兼容的更改二、

Spring Boot拦截器Interceptor与过滤器Filter详细教程(示例详解)

《SpringBoot拦截器Interceptor与过滤器Filter详细教程(示例详解)》本文详细介绍了SpringBoot中的拦截器(Interceptor)和过滤器(Filter),包括它们的... 目录Spring Boot拦截器(Interceptor)与过滤器(Filter)详细教程1. 概述1

SpringBoot利用dynamic-datasource-spring-boot-starter解决多数据源问题

《SpringBoot利用dynamic-datasource-spring-boot-starter解决多数据源问题》dynamic-datasource-spring-boot-starter是一... 目录概要整体架构构想操作步骤创建数据源切换数据源后续问题小结概要自己闲暇时间想实现一个多租户平台,

Java反转字符串的五种方法总结

《Java反转字符串的五种方法总结》:本文主要介绍五种在Java中反转字符串的方法,包括使用StringBuilder的reverse()方法、字符数组、自定义StringBuilder方法、直接... 目录前言方法一:使用StringBuilder的reverse()方法方法二:使用字符数组方法三:使用自

Ubuntu中Nginx虚拟主机设置的项目实践

《Ubuntu中Nginx虚拟主机设置的项目实践》通过配置虚拟主机,可以在同一台服务器上运行多个独立的网站,本文主要介绍了Ubuntu中Nginx虚拟主机设置的项目实践,具有一定的参考价值,感兴趣的可... 目录简介安装 Nginx创建虚拟主机1. 创建网站目录2. 创建默认索引文件3. 配置 Nginx4

pytorch+torchvision+python版本对应及环境安装

《pytorch+torchvision+python版本对应及环境安装》本文主要介绍了pytorch+torchvision+python版本对应及环境安装,安装过程中需要注意Numpy版本的降级,... 目录一、版本对应二、安装命令(pip)1. 版本2. 安装全过程3. 命令相关解释参考文章一、版本对

JAVA封装多线程实现的方式及原理

《JAVA封装多线程实现的方式及原理》:本文主要介绍Java中封装多线程的原理和常见方式,通过封装可以简化多线程的使用,提高安全性,并增强代码的可维护性和可扩展性,需要的朋友可以参考下... 目录前言一、封装的目标二、常见的封装方式及原理总结前言在 Java 中,封装多线程的原理主要围绕着将多线程相关的操

Java进阶学习之如何开启远程调式

《Java进阶学习之如何开启远程调式》Java开发中的远程调试是一项至关重要的技能,特别是在处理生产环境的问题或者协作开发时,:本文主要介绍Java进阶学习之如何开启远程调式的相关资料,需要的朋友... 目录概述Java远程调试的开启与底层原理开启Java远程调试底层原理JVM参数总结&nbsMbKKXJx