——————————DescriptionStart——————————
运行环境
Java≥8、MySQL≥5.7、Node.js≥14
开发工具
后端:eclipse/idea/myeclipse/sts等均可配置运行
前端:WebStorm/VSCode/HBuilderX等均可
❗没学过node.js的不要搞前后端分离项目
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明






基于javaweb的SpringBoot房屋租赁系统(java+springboot+maven+vue+elementui+layui+mysql)
项目介绍
基于SpringBoot Vue的大学生租房系统
角色:管理员、房主、用户
管理员:管理员登录系统后,可以对首页,个人中心,房主管理,用户管理,房屋类型管理,房屋信息管理,预约看房管理,定金留房管理,租赁订单管理,房屋评价管理等功能进行相应的操作
房主:房主登录进入大学生租房系统可以对首页,个人中心,房屋信息管理,预约看房管理,定金留房管理,租赁订单管理,房屋评价管理等功能进行相应操作
用户:用户登录进入大学生租房系统可以对首页,个人中心,预约看房管理,定金留房管理,租赁订单管理,房屋评价管理,消息提醒管理,我的收藏管理等功能进行相应操作
后端:SpringBoot+Mybaits
前端:Vue +ElementUI +Layui +HTML+CSS+JS
——————————CodeStart——————————
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
@RestController @RequestMapping("/fangwuxinxi") public class FangwuxinxiController { @Autowired private FangwuxinxiService fangwuxinxiService;
@Autowired private StoreupService storeupService;
@RequestMapping("/page") public R page(@RequestParam Map<String, Object> params,FangwuxinxiEntity fangwuxinxi, HttpServletRequest request){ String tableName = request.getSession().getAttribute("tableName").toString(); if(tableName.equals("fangzhu")) { fangwuxinxi.setFangzhuzhanghao((String)request.getSession().getAttribute("username")); } EntityWrapper<FangwuxinxiEntity> ew = new EntityWrapper<FangwuxinxiEntity>(); PageUtils page = fangwuxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, fangwuxinxi), params), params));
return R.ok().put("data", page);
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| PageUtils page = configService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, config), params), params)); return R.ok().put("data", page); }
@IgnoreAuth @RequestMapping("/list") public R list(@RequestParam Map<String, Object> params,ConfigEntity config){ EntityWrapper<ConfigEntity> ew = new EntityWrapper<ConfigEntity>(); PageUtils page = configService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, config), params), params)); return R.ok().put("data", page); }
@RequestMapping("/info/{id}") public R info(@PathVariable("id") String id){ ConfigEntity config = configService.selectById(id); return R.ok().put("data", config); }
@IgnoreAuth @RequestMapping("/detail/{id}") public R detail(@PathVariable("id") String id){ ConfigEntity config = configService.selectById(id); return R.ok().put("data", config); }
@RequestMapping("/info") public R infoByName(@RequestParam String name){ ConfigEntity config = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "faceFile")); return R.ok().put("data", config); }
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| return R.ok(); }
@RequestMapping("/add") public R add(@RequestBody YonghuEntity yonghu, HttpServletRequest request){ yonghu.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue()); YonghuEntity user = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("yonghuming", yonghu.getYonghuming())); if(user!=null) { return R.error("用户已存在"); } yonghu.setId(new Date().getTime()); yonghuService.insert(yonghu); return R.ok(); }
@RequestMapping("/update") public R update(@RequestBody YonghuEntity yonghu, HttpServletRequest request){ yonghuService.updateById(yonghu); return R.ok(); }
@RequestMapping("/delete") public R delete(@RequestBody Long[] ids){ yonghuService.deleteBatchIds(Arrays.asList(ids)); return R.ok(); }
@RequestMapping("/remind/{columnName}/{type}") public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request, @PathVariable("type") String type,@RequestParam Map<String, Object> map) { map.put("column", columnName); map.put("type", type); if(type.equals("2")) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Calendar c = Calendar.getInstance(); Date remindStartDate = null;
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| public R save(@RequestBody XiaoxitixingEntity xiaoxitixing, HttpServletRequest request){ xiaoxitixing.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue()); xiaoxitixingService.insert(xiaoxitixing); return R.ok(); }
@RequestMapping("/add") public R add(@RequestBody XiaoxitixingEntity xiaoxitixing, HttpServletRequest request){ xiaoxitixing.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue()); xiaoxitixingService.insert(xiaoxitixing); return R.ok(); }
@RequestMapping("/update") public R update(@RequestBody XiaoxitixingEntity xiaoxitixing, HttpServletRequest request){ xiaoxitixingService.updateById(xiaoxitixing); return R.ok(); }
@RequestMapping("/delete") public R delete(@RequestBody Long[] ids){ xiaoxitixingService.deleteBatchIds(Arrays.asList(ids)); return R.ok(); }
@RequestMapping("/remind/{columnName}/{type}") public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request, @PathVariable("type") String type,@RequestParam Map<String, Object> map) { map.put("column", columnName); map.put("type", type);
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| } if(tokenEntity != null) { request.getSession().setAttribute("userId", tokenEntity.getUserid()); request.getSession().setAttribute("role", tokenEntity.getRole()); request.getSession().setAttribute("tableName", tokenEntity.getTablename()); request.getSession().setAttribute("username", tokenEntity.getUsername()); return true; } PrintWriter writer = null; response.setCharacterEncoding("UTF-8"); response.setContentType("application/json; charset=utf-8"); try { writer = response.getWriter(); writer.print(JSONObject.toJSONString(R.error(401, "请先登录"))); } finally { if(writer != null){ writer.close(); } }
return false; } }
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
@Component public class AuthorizationInterceptor implements HandlerInterceptor {
public static final String LOGIN_TOKEN_KEY = "Token";
@Autowired private TokenService tokenService; @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); response.setHeader("Access-Control-Max-Age", "3600"); response.setHeader("Access-Control-Allow-Credentials", "true"); response.setHeader("Access-Control-Allow-Headers", "x-requested-with,request-source,Token, Origin,imgType, Content-Type, cache-control,postman-token,Cookie, Accept,authorization"); response.setHeader("Access-Control-Allow-Origin", request.getHeader("Origin")); if (request.getMethod().equals(RequestMethod.OPTIONS.name())) { response.setStatus(HttpStatus.OK.value()); return false; } IgnoreAuth annotation; if (handler instanceof HandlerMethod) { annotation = ((HandlerMethod) handler).getMethodAnnotation(IgnoreAuth.class); } else { return true; }
String token = request.getHeader(LOGIN_TOKEN_KEY);
if(annotation!=null) { return true; } TokenEntity tokenEntity = null; if(StringUtils.isNotBlank(token)) { tokenEntity = tokenService.getTokenEntity(token);
|
——————————PayStart——————————
项目链接:
https://javayms.github.io?id=241524180701201if
https://javayms.pages.dev?id=241524180701201if