基于javaweb+mysql的springboot物业管理系统(java+springboot+layui+html+maven+mysql)
运行环境
Java≥8、MySQL≥5.7
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SpringBoot物业管理系统(java+springboot+layui+html+maven+mysql)
项目介绍
本项目为后管系统,分为管理员、业主两种角色; 管理员主要功能为: 社区核心业务处理:车位收费管理、物业收费管理、投诉信息管理、报修信息管理 基础信息管理:楼宇管理、房屋管理、业主管理、车位管理、抄表管理、登录信息管理、修改密码 基础类型管理:投诉类型管理、收费类型管理、报修类型管理 数据统计:报修统计 业主主要功能为: 车位费查询、物业费查询、我的投诉列表、我的报修列表、修改密码等;
环境需要
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 8.0版本;
6.是否Maven项目:是;
技术栈
-
后端:SpringBoot+Mybatis
-
前端:HTML+CSS+JavaScript+LayUI
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中application.yml配置文件中的数据库配置改为自己的配置; 4. 运行项目,访问地址:http://localhost:8888 管理员账号/密码:admin/123456 业主账号/密码:kappy/123456
业主账号可通过管理员在业主管理模块进行添加,默认密码为123456
}
@ApiOperation(value = "更新")
@RequestMapping("/update")
public R update(@RequestBody House house){
if(house.getIntoDate()!=null){
house.setStatus(1);
}else{
house.setStatus(0);
}
int num= houseService.updateData(house);
if(num>0){
return R.ok();
}else{
return R.fail("修改失败");
}
}
@ApiOperation(value = "查询分页数据")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "页码"),
@ApiImplicitParam(name = "pageCount", value = "每页条数")
})
@GetMapping()
public IPage<House> findListByPage(@RequestParam Integer page,
@RequestParam Integer pageCount){
return houseService.findListByPage(page, pageCount);
}
@ApiOperation(value = "id查询")
@GetMapping("{id}")
public House findById(@PathVariable Long id){
return houseService.findById(id);
}
}
package com.yanzhen.controller;
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "页码"),
@ApiImplicitParam(name = "pageCount", value = "每页条数")
})
@GetMapping()
public IPage<ComplaintType> findListByPage(@RequestParam Integer page,
@RequestParam Integer pageCount){
return complaintTypeService.findListByPage(page, pageCount);
}
@ApiOperation(value = "id查询")
@GetMapping("{id}")
public ComplaintType findById(@PathVariable Long id){
return complaintTypeService.findById(id);
}
}
package com.yanzhen.controller;
/**
* <p>
* 前端控制器
* </p>
*
*/
@Api(tags = {""})
@RestController
@RequestMapping("/building")
public class BuildingController {
private Logger log = LoggerFactory.getLogger(getClass());
public R add1(@RequestBody PropertyType propertyType){
int num= propertyTypeService.add(propertyType);
if(num>0){
return R.ok();
}else{
return R.fail("添加失败");
}
}
@ApiOperation(value = "删除")
@DeleteMapping("{id}")
public int delete(@PathVariable("id") Long id){
return propertyTypeService.delete(id);
}
@ApiOperation(value = "删除")
@RequestMapping("/deleteId")
public R delete(String ids){
List<String> list= Arrays.asList(ids.split(","));
//遍历遍历进行删除
for(String id:list){
propertyTypeService.delete(Long.parseLong(id));
}
return R.ok();
}
@ApiOperation(value = "更新")
@PutMapping()
public int update(@RequestBody PropertyType propertyType){
return propertyTypeService.updateData(propertyType);
}
@ApiOperation(value = "更新")
@RequestMapping("/update")
public R update1(@RequestBody PropertyType propertyType){
int num= propertyTypeService.updateData(propertyType);
if(num>0){
return R.ok();
}else{
return R.fail("修改失败");
}
}
@ApiOperation(value = "查询分页数据")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "页码"),
@ApiOperation(value = "删除")
@RequestMapping("/deleteByIds")
public R delete(String ids){
List<String> list= Arrays.asList(ids.split(","));
for(String id:list){
Long idLong=new Long(id);
propertyInfoService.delete(idLong);
}
return R.ok();
}
@ApiOperation(value = "更新")
@RequestMapping("/update")
public R update(Integer id){
PropertyInfo propertyInfo =new PropertyInfo();
propertyInfo.setId(id);
propertyInfo.setStatus(1);
int num=propertyInfoService.updateData(propertyInfo);
if(num>0){
return R.ok();
}
return R.fail("失败");
}
@ApiOperation(value = "查询分页数据")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "页码"),
@ApiImplicitParam(name = "pageCount", value = "每页条数")
})
@GetMapping()
public IPage<PropertyInfo> findListByPage(@RequestParam Integer page,
@RequestParam Integer pageCount){
return propertyInfoService.findListByPage(page, pageCount);
}
@ApiOperation(value = "id查询")
@GetMapping("{id}")
public PropertyInfo findById(@PathVariable Long id){
return propertyInfoService.findById(id);
// if(num>0){
// return R.ok("修改成功",null);
// }else{
// return R.fail("修改失败");
// }
// }
//
// @ApiOperation(value = "查询分页数据")
// @ApiImplicitParams({
// @ApiImplicitParam(name = "page", value = "页码"),
// @ApiImplicitParam(name = "pageCount", value = "每页条数")
// })
// @GetMapping()
// public IPage<Building> findListByPage(@RequestParam Integer page,
// @RequestParam Integer pageCount){
// return buildingService.findListByPage(page, pageCount);
// }
//
// @ApiOperation(value = "id查询")
// @GetMapping("{id}")
// public Building findById(@PathVariable Long id){
// return buildingService.findById(id);
// }
}
package com.yanzhen.controller;
/**
* <p>
* 前端控制器
* </p>
*
private Logger log = LoggerFactory.getLogger(getClass());
@Resource
private IPropertyTypeService propertyTypeService;
@RequestMapping("/queryAll")
public List<PropertyType> queryList(){
List<PropertyType> list= propertyTypeService.findAll();
return list;
}
@RequestMapping("/queryAll1")
public JsonObject queryAll(@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "15") Integer limit,
String numbers){
IPage<PropertyType> pageInfo= propertyTypeService.findListByPage(page,limit);
return new JsonObject(0,"ok",pageInfo.getTotal(),pageInfo.getRecords());
}
@ApiOperation(value = "新增")
@PostMapping()
public int add(@RequestBody PropertyType propertyType){
return propertyTypeService.add(propertyType);
}
@ApiOperation(value = "新增")
@RequestMapping("/addChargeType")
public R add1(@RequestBody PropertyType propertyType){
int num= propertyTypeService.add(propertyType);
if(num>0){
return R.ok();
}else{
return R.fail("添加失败");
}
}
@ApiOperation(value = "删除")
@DeleteMapping("{id}")
public int delete(@PathVariable("id") Long id){
@ResponseBody
public Map loginIn(Userinfo userinfo, HttpServletRequest request){
Map map=new HashMap();
HttpSession session=request.getSession();
if(session==null){
map.put("code",404);
map.put("msg","登录超时了");
return map;
}
Userinfo user=userinfoService.queryUserByNameAndPwd(userinfo);
if(user==null){
map.put("code",404);
map.put("msg","用户名或者密码错误");
return map;
}else{
session.setAttribute("user",user);
map.put("code",200);
map.put("user",user);
map.put("username",user.getUsername());
map.put("id",user.getId());
return map;
}
}
/**
* 退出功能
*/
@RequestMapping("/loginOut")
public void loginOut(HttpServletRequest request, HttpServletResponse response) throws IOException {
HttpSession session=request.getSession();
session.invalidate();
response.sendRedirect(request.getContextPath()+"/login.html");
}
}
package com.yanzhen.interceptor;
public class LoginInterceptor implements HandlerInterceptor {
/**
* 请求之前进行得调用
* @param request
* @param response
* @param handler
* @return
* @throws Exception
*/
*/
@RequestMapping("/queryTongJi")
public List<Tongji> queryTongji(){
return repairService.queryTongji();
}
@ApiOperation(value = "删除")
@RequestMapping("/deleteId")
public R delete(String ids){
List<String> list= Arrays.asList(ids.split(","));
//遍历遍历进行删除
for(String id:list){
repairtypeService.delete(Long.parseLong(id));
}
return R.ok();
}
@ApiOperation(value = "更新")
@RequestMapping("/update1")
public R update1(@RequestBody Repair repair){
//System.out.println(repair.getComId());
int num=repairService .updateData(repair);
if(num>0){
return R.ok();
}else{
return R.fail("修改失败");
}
}
}
package com.yanzhen.controller;
/**
* <p>
* 前端控制器
* </p>
*
*/
@Api(tags = {""})
@RestController
@RequestMapping("/carcharge")
public class CarchargeController {
private Logger log = LoggerFactory.getLogger(getClass());
@Resource
private ICarchargeService carchargeService;
@Resource
private IParkingService parkingService;
@Resource
private IOwnerService ownerService;
@RequestMapping("/queryCarchargeAll")
public JsonObject queryCarchargeAll(Carcharge carcharge,String numbers,
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "15") Integer limit){
if(numbers!=null){
Parking parking=new Parking();
parking.setNumbers(numbers);
carcharge.setParking(parking);
}
PageInfo<Carcharge> pageInfo=carchargeService.findCarchargeAll(page,limit,carcharge);
return new JsonObject(0,"ok",pageInfo.getTotal(),pageInfo.getList());
@ApiOperation(value = "id查询")
@GetMapping("{id}")
public Carcharge findById(@PathVariable Long id){
return carchargeService.findById(id);
}
}
package com.yanzhen.controller;
/**
* <p>
* 前端控制器
* </p>
*
*/
@Api(tags = {""})
@RestController
@RequestMapping("/propertyType")
public class PropertyTypeController {
private Logger log = LoggerFactory.getLogger(getClass());
@Resource
private IPropertyTypeService propertyTypeService;
@RequestMapping("/queryAll")
public List<PropertyType> queryList(){
List<PropertyType> list= propertyTypeService.findAll();
return list;
*/
List<Parking> parkingList=parkingService.queryParkingByStatus();
for(Parking park:parkingList){
carcharge.setStatus(0);
carcharge.setOwnerId(park.getOwnerId());
carcharge.setType("停车费");
carcharge.setParkId(park.getId());
carchargeService.add(carcharge);
}
return R.ok();
}
@ApiOperation(value = "删除")
@RequestMapping("/deleteByIds")
public R delete(String ids){
List<String> list= Arrays.asList(ids.split(","));
for(String id:list){
Long idLong=new Long(id);
carchargeService.delete(idLong);
}
return R.ok();
}
@ApiOperation(value = "更新")
@RequestMapping("/update")
public R update(Integer id){
Carcharge carcharge =new Carcharge();
carcharge.setId(id);
carcharge.setStatus(1);
int num=carchargeService.updateData(carcharge);
if(num>0){
return R.ok();
}
return R.fail("失败");
}
@ApiOperation(value = "查询分页数据")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "页码"),
@ApiImplicitParam(name = "pageCount", value = "每页条数")
})
@GetMapping()
public IPage<Carcharge> findListByPage(@RequestParam Integer page,
@RequestParam Integer pageCount){
return carchargeService.findListByPage(page, pageCount);
}
@ApiOperation(value = "id查询")
@GetMapping("{id}")
public Carcharge findById(@PathVariable Long id){
}
}
@ApiOperation(value = "删除")
@RequestMapping("/deleteByIds")
public R delete(String ids){
//z转成集合对象
List<String> list= Arrays.asList(ids.split(","));
for(String id:list){
Long idLong=Long.parseLong(id);
houseService.delete(idLong);
}
return R.ok();
}
@ApiOperation(value = "更新")
@RequestMapping("/update")
public R update(@RequestBody House house){
if(house.getIntoDate()!=null){
house.setStatus(1);
}else{
house.setStatus(0);
}
int num= houseService.updateData(house);
if(num>0){
return R.ok();
}else{
return R.fail("修改失败");
}
}
@ApiOperation(value = "查询分页数据")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "页码"),
@ApiImplicitParam(name = "pageCount", value = "每页条数")
})
@GetMapping()
public IPage<House> findListByPage(@RequestParam Integer page,
@RequestParam Integer pageCount){
return houseService.findListByPage(page, pageCount);
}
@ApiOperation(value = "id查询")
@GetMapping("{id}")
public House findById(@PathVariable Long id){
return houseService.findById(id);
}
* <p>
* 前端控制器
* </p>
*
*/
@Api(tags = {""})
@RestController
@RequestMapping("/repair")
public class RepairController {
private Logger log = LoggerFactory.getLogger(getClass());
@Resource
private IRepairService repairService;
@Resource
private IRepairtypeService repairtypeService;
@Resource
private IOwnerService ownerService;
@RequestMapping("/queryRepairAll")
public JsonObject queryRepairAll(Repair repair,
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "15") Integer limit){
PageInfo<Repair> pageInfo=repairService.findRepairAll(page,limit,repair);
return new JsonObject(0,"ok",pageInfo.getTotal(),pageInfo.getList());
}
@RequestMapping("/queryRepairAll2")
public JsonObject queryRepairAll2(Repair repair, HttpServletRequest request,
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "15") Integer limit){
//获取当前得登录用户
Userinfo userinfo= (Userinfo) request.getSession().getAttribute("user");
String username=userinfo.getUsername();
//根据username获取登录账号得业主id
Owner owner=ownerService.queryOwnerByName(username);
repair.setOwnerId(owner.getId());
PageInfo<Repair> pageInfo=repairService.findRepairAll(page,limit,repair);
return new JsonObject(0,"ok",pageInfo.getTotal(),pageInfo.getList());
}
@RequestMapping("/queryAll")
public List<Repairtype> queryAll(){
return repairtypeService.findList();
userinfoService.delete(Long.parseLong(id));
}
return R.ok();
}
@ApiOperation(value = "新增")
@RequestMapping("/add")
public R add(@RequestBody Userinfo userinfo){
userinfoService.add(userinfo);
return R.ok();
}
@ApiOperation(value = "更新")
@RequestMapping("/update")
public R update(String oldPwd,String newPwd,Integer id){
//根据id获取当前的数据记录
//System.out.println(id);
Userinfo user=userinfoService.findById(new Long(id));
if(oldPwd.equals(user.getPassword())){//输入的老密码和原密码一致
user.setPassword(newPwd);
userinfoService.updateData(user);
return R.ok();
}else{
return R.fail("两次密码不一致");
}
}
@ApiOperation(value = "更新")
@RequestMapping("/reset")
public R reset(Integer id){
//根据id获取当前的数据记录
//System.out.println(id);
Userinfo user=userinfoService.findById(new Long(id));
user.setPassword("123456");
userinfoService.updateData(user);
return R.ok();
}
@ApiOperation(value = "查询分页数据")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "页码"),
@ApiImplicitParam(name = "pageCount", value = "每页条数")
})
@GetMapping()
public IPage<Userinfo> findListByPage(@RequestParam Integer page,
@RequestParam Integer pageCount){
return userinfoService.findListByPage(page, pageCount);
}
object.setCode(0);
object.setMsg("ok");
object.setCount(pageInfo.getTotal());
object.setData(pageInfo.getList());
return object;
}
@ApiOperation(value = "删除")
@RequestMapping("/deleteByIds")
public R delete(String ids){
List<String> list= Arrays.asList(ids.split(","));
//遍历遍历进行删除
for(String id:list){
userinfoService.delete(Long.parseLong(id));
}
return R.ok();
}
@ApiOperation(value = "新增")
@RequestMapping("/add")
public R add(@RequestBody Userinfo userinfo){
userinfoService.add(userinfo);
return R.ok();
}
@ApiOperation(value = "更新")
@RequestMapping("/update")
public R update(String oldPwd,String newPwd,Integer id){
//根据id获取当前的数据记录
//System.out.println(id);
Userinfo user=userinfoService.findById(new Long(id));
if(oldPwd.equals(user.getPassword())){//输入的老密码和原密码一致
user.setPassword(newPwd);
userinfoService.updateData(user);
return R.ok();
}else{
return R.fail("两次密码不一致");
}
}
@ApiOperation(value = "更新")
@RequestMapping("/update")
public R update(@RequestBody Parking parking){
Parking park=new Parking();
if(parking.getOwnerId()!=null){//关联到了户主
park.setStatus(1);
}else{
park.setStatus(0);
}
park.setId(parking.getId());
park.setNumbers(parking.getNumbers());
park.setRemarks(parking.getRemarks());
park.setOwnerId(parking.getOwnerId());
int num= parkingService.updateData(park);
if(num>0){
return R.ok();
}else{
return R.fail("修改失败");
}
}
@ApiOperation(value = "查询分页数据")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "页码"),
@ApiImplicitParam(name = "pageCount", value = "每页条数")
})
@GetMapping()
public IPage<Parking> findListByPage(@RequestParam Integer page,
@RequestParam Integer pageCount){
return parkingService.findListByPage(page, pageCount);
}
@ApiOperation(value = "id查询")
@GetMapping("{id}")
public Parking findById(@PathVariable Long id){
return parkingService.findById(id);
}
}
package com.yanzhen.controller;
private Logger log = LoggerFactory.getLogger(getClass());
@Resource
private ICarchargeService carchargeService;
@Resource
private IParkingService parkingService;
@Resource
private IOwnerService ownerService;
@RequestMapping("/queryCarchargeAll")
public JsonObject queryCarchargeAll(Carcharge carcharge,String numbers,
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "15") Integer limit){
if(numbers!=null){
Parking parking=new Parking();
parking.setNumbers(numbers);
carcharge.setParking(parking);
}
PageInfo<Carcharge> pageInfo=carchargeService.findCarchargeAll(page,limit,carcharge);
return new JsonObject(0,"ok",pageInfo.getTotal(),pageInfo.getList());
}
@RequestMapping("/queryCarchargeAll2")
public JsonObject queryCarchargeAll2(Carcharge carcharge, HttpServletRequest request,
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "15") Integer limit){
Userinfo userinfo= (Userinfo) request.getSession().getAttribute("user");
String username=userinfo.getUsername();
//根据username获取登录账号得业主id
Owner owner=ownerService.queryOwnerByName(username);
Integer userId=owner.getId();
carcharge.setOwnerId(userId);
PageInfo<Carcharge> pageInfo=carchargeService.findCarchargeAll(page,limit,carcharge);
return new JsonObject(0,"ok",pageInfo.getTotal(),pageInfo.getList());