SSM框架(spring+springmvc+mybatis)+Mysql实现的社区物业管理系统

本系统为了解决线下物业管理小区的冗余繁杂的难题,通过整合业主和物业,将平时的业务在线化,节省了物业处理小区问题的效率。

(文末查看完整源码)

实现功能截图

登录
请添加图片描述
车位费查询
请添加图片描述
物业费查询
请添加图片描述
我的投诉列表
请添加图片描述
管理员首页
请添加图片描述
楼宇管理
请添加图片描述
房屋管理
请添加图片描述
业主管理
请添加图片描述
用户管理
请添加图片描述
车位管理
请添加图片描述
报修统计分析
请添加图片描述
报修信息管理
请添加图片描述
投诉信息管理
请添加图片描述
车位收费管理
请添加图片描述

系统功能

本系统实现了以下功能:
分普通用户和管理员
1、物业费查询
2、我的投诉列表
3、车位费
4、我的报修
管理员端
5、车位管理
6、业主管理
7、用户管理
8、报修信息管理
9、房屋管理
10、车位费管理
11、抄表管理
12、投诉信息管理
13、楼宇管理
14、添加房屋、添加楼宇
15、物业收费管理

使用技术

数据库:mysql
开发工具:Idea(Myeclispe、Eclipse也可以)
知识点:SSM+layui

项目结构
请添加图片描述

代码

实体类
Building.java

package com.code2life.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;

/**
 * <p>
 * 
 * </p>
 *
 * @author kappy
 * @since 2020-11-08
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="Building对象", description="")
public class Building implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    private String numbers;

    private String uints;

    private String remarks;


}

Repair.java

package com.code2life.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 * 
 * </p>
 *
 * @author kappy
 * @since 2020-10-28
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="Repair对象", description="")
public class Repair implements Serializable {

    private static final long serialVersionUID = 1L;

    private Owner owner;
    private Repairtype type;

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    private String comId;
    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd")
    private Date comDate;
    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd")
    private Date handleDate;

    private Integer ownerId;

    private Integer status;

    private Integer clr;

    private String remarks;


}

DAO层
BuildingMapper.java

package com.code2life.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.code2life.model.Building;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author kappy
 * @since 2020-11-08
 */
@Component("buildingDao")
public interface BuildingMapper extends BaseMapper<Building> {

    List<Building> queryBuildAll(@Param("numbers") String numbers);

    /**
     * 通过house中building_id查找building
     */
    Building queryBuildById(@Param("buildId") Integer buildId);
}

RepairMapper.java

package com.code2life.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.code2life.model.Repair;
import com.code2life.model.Tongji;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author kappy
 * @since 2020-10-28
 */
@Component("repairDao")
public interface RepairMapper extends BaseMapper<Repair> {

    List<Repair> queryRepairAll(Repair repair);

    //统计处理
    List<Tongji> queryTongji();

}

service层
BuildingServiceImpl.java

package com.code2life.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.code2life.dao.BuildingMapper;
import com.code2life.model.Building;
import com.code2life.service.IBuildingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author kappy
 * @since 2020-11-08
 */
@Service
public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> implements IBuildingService {

    @Autowired
    private BuildingMapper buildingDao;
    @Override
    public PageInfo<Building> findBuildAll(int page, int pageSize, String numbers) {
        PageHelper.startPage(page,pageSize);
        List<Building> list=buildingDao.queryBuildAll(numbers);
        return new PageInfo<>(list);
    }

    @Override
    public IPage<Building> findListByPage(Integer page, Integer pageCount){
        IPage<Building> wherePage = new Page<>(page, pageCount);
        Building where = new Building();

        return   baseMapper.selectPage(wherePage, Wrappers.query(where));
    }

    @Override
    public int add(Building building){
        return baseMapper.insert(building);
    }

    @Override
    public int delete(Long id){
        return baseMapper.deleteById(id);
    }

    @Override
    public int updateData(Building building){
        return baseMapper.updateById(building);
    }

    @Override
    public Building findById(Long id){
        return  baseMapper.selectById(id);
    }

    @Override
    public Building queryBuildById(Integer buildId) {
        return buildingDao.queryBuildById(buildId);
    }
}

RepairServiceImpl.java

package com.code2life.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.code2life.dao.RepairMapper;
import com.code2life.model.Repair;
import com.code2life.model.Tongji;
import com.code2life.service.IRepairService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author kappy
 * @since 2020-10-28
 */
@Service
public class RepairServiceImpl extends ServiceImpl<RepairMapper, Repair> implements IRepairService {

    @Autowired
    private RepairMapper repairDao;
    @Override
    public PageInfo<Repair> findRepairAll(int page, int pagesize, Repair repair) {
        PageHelper.startPage(page,pagesize);
        List<Repair> list=repairDao.queryRepairAll(repair);
        PageInfo<Repair> pageInfo=new PageInfo(list);
        return pageInfo;
    }

    @Override
    public List<Repair> queryList() {
        return repairDao.queryRepairAll(null);
    }


    @Override
    public IPage<Repair> findListByPage(Integer page, Integer pageCount){
        IPage<Repair> wherePage = new Page<>(page, pageCount);
        Repair where = new Repair();

        return   baseMapper.selectPage(wherePage, Wrappers.query(where));
    }

    @Override
    public int add(Repair repair){
        return baseMapper.insert(repair);
    }

    @Override
    public int delete(Long id){
        return baseMapper.deleteById(id);
    }

    @Override
    public int updateData(Repair repair){
        return baseMapper.updateById(repair);
    }

    @Override
    public Repair findById(Long id){
        return  baseMapper.selectById(id);
    }

    @Override
    public List<Tongji> queryTongji() {
        return repairDao.queryTongji();
    }
}

controller层
BuildingController.java

package com.code2life.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.pagehelper.PageInfo;
import com.code2life.model.Building;
import com.code2life.service.IBuildingService;
import com.code2life.util.JsonObject;
import com.code2life.util.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author kappy
 * @since 2020-11-08
 */
@Api(tags = {""})
@RestController
@RequestMapping("/building")
public class BuildingController {

    private Logger log = LoggerFactory.getLogger(getClass());

    @Resource
    private IBuildingService buildingService;


    @RequestMapping("/queryBuildAll")
    public JsonObject queryBuildAll(@RequestParam(defaultValue = "1") Integer page,
                                    @RequestParam(defaultValue = "15") Integer limit,
                                    String numbers){
        JsonObject object=new JsonObject();
        PageInfo<Building> pageInfo= buildingService.findBuildAll(page,limit,numbers);
        object.setCode(0);
        object.setMsg("ok");
        object.setCount(pageInfo.getTotal());
        object.setData(pageInfo.getList());
        return object;
    }

    @RequestMapping("/queryBuild")
    public List<Building> queryBuild(){
        PageInfo<Building> pageInfo= buildingService.findBuildAll(1,100,null);
        return pageInfo.getList();
    }


    @ApiOperation(value = "新增")
    @RequestMapping("/add")
    public R add(@RequestBody Building building){
        int num= buildingService.add(building);
        if(num>0){
            return R.ok();
        }else{
            return R.fail("添加失败");
        }

    }

    @ApiOperation(value = "删除")
    @RequestMapping("/deleteByIds")
    public R delete(String  ids){
        List<String> list= Arrays.asList(ids.split(","));
        //遍历遍历进行删除
        for(String id:list){
            buildingService.delete(Long.parseLong(id));
        }
        return R.ok();
    }

    @ApiOperation(value = "更新")
    @RequestMapping("/update")
    public R update(@RequestBody Building building){
        int num= buildingService.updateData(building);
        if(num>0){
            return R.ok();
        }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);
    }

}

RepairController.java

package com.code2life.controller;

import com.github.pagehelper.PageInfo;
import com.code2life.model.*;
import com.code2life.service.IOwnerService;
import com.code2life.service.IRepairService;
import com.code2life.service.IRepairtypeService;
import com.code2life.util.JsonObject;
import com.code2life.util.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;
import java.util.Date;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author kappy
 * @since 2020-10-28
 */
@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();
    }


    @RequestMapping("/deleteByIds")
    public R deleteByIds(String ids){
       List<String> list= Arrays.asList(ids.split(","));
       for(String id:list){
           repairService.delete(Long.parseLong(id));
       }

       return R.ok();
    }

    @ApiOperation(value = "新增")
    @RequestMapping("/add")
    public R add(@RequestBody Repair repair,HttpServletRequest request)
    {
        System.out.println("-------111--------");
        System.out.println(repair);
        System.out.println("---------------");
        //获取当前得登录用户
        Userinfo userinfo= (Userinfo) request.getSession().getAttribute("user");
        String username=userinfo.getUsername();

        //根据username获取登录账号得业主id
        Owner owner=ownerService.queryOwnerByName(username);
        repair.setOwnerId(owner.getId());
        repair.setStatus(0);
        repair.setComDate(new Date());
        System.out.println("-------222--------");
        System.out.println(repair);
        System.out.println("---------------");
        int num=repairService.add(repair);
        if(num>0){
            return  R.ok();
        }
        return R.fail("新增失败");
    }

    @ApiOperation(value = "更新")
    @RequestMapping("/update")
    public R update(Integer id){
         Repair repair=new Repair();
         repair.setId(id);
         repair.setStatus(1);
         repair.setHandleDate(new Date());
         int num=repairService.updateData(repair);
         return R.ok();
    }

    /**
     * 统计分析
     */
    @RequestMapping("/queryTongJi")
    public List<Tongji> queryTongji(){
        return repairService.queryTongji();
    }



}

完整源码

如果运行代码中遇到问题,或者需要完整源码和报告交流
请添加图片描述
Code2Life2
得有用,记得一键三连哦!

Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐