# 智慧社区管理系统-基础信息管理-06抄表管理
一后端
1:entity
package com.woniu.community.entity;import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;@Data
@AllArgsConstructor
@NoArgsConstructor
public class Records {private int id;private int typeId;private Double num;private Double num2;private int houseId;private String upTime;private String onTime;private String checkTime;private String meter;private String remarks;private String userName;private String numbers;private String typeName;}
2:RecordsMapper
package com.woniu.community.mapper;import com.woniu.community.entity.PropertyInfo;
import com.woniu.community.entity.Records;import java.util.List;public interface RecordsMapper {List<Records> selectAll(int start, int size , String numbers, String typeName);int count(String numbers,String typeName);int insertRecords(Records records);int deleteRecords(int id);}
3:IRecordsService
package com.woniu.community.service;import com.woniu.community.entity.HttpResult;
import com.woniu.community.entity.Records;import java.util.List;public interface IRecordsService {HttpResult selectAll(int pageIndex, int pageSize , String numbers, String typeName);HttpResult insertRecords(Records records);HttpResult deleteRecords(int id);}
4:RecordsServiceImpl
package com.woniu.community.service.impl;import com.woniu.community.entity.HttpResult;
import com.woniu.community.entity.Records;
import com.woniu.community.mapper.RecordsMapper;
import com.woniu.community.service.IRecordsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;import java.util.List;@Service
public class RecordsServiceImpl implements IRecordsService {@Autowired(required = false)private RecordsMapper recordsMapper;@Overridepublic HttpResult selectAll(int pageIndex, int pageSize, String numbers, String typeName) {HttpResult result=null;List<Records> records = recordsMapper.selectAll((pageIndex - 1) * pageSize, pageSize, numbers, typeName);int count = recordsMapper.count(numbers, typeName);if (records!=null&&records.size()>0){result =new HttpResult(records,count,200,null);}else{result =new HttpResult(null,0,500,"没有更多数据");}return result;}@Overridepublic HttpResult insertRecords(Records records) {HttpResult result=null;int count = recordsMapper.insertRecords(records);if (count>0){result=new HttpResult(null,0,200,"添加成功");}else{result=new HttpResult(null,0,500,"添加失败");}return result;}@Overridepublic HttpResult deleteRecords(int id) {HttpResult result=null;int count = recordsMapper.deleteRecords(id);if (count>0){result=new HttpResult(null,0,200,"删除成功");}else{result=new HttpResult(null,0,500,"删除失败");}return result;}
}
5:RecordsController
package com.woniu.community.controller;import com.woniu.community.entity.HttpResult;
import com.woniu.community.entity.Records;
import com.woniu.community.service.IRecordsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;@RestController
@RequestMapping("/records")
@CrossOrigin(origins = "*")
public class RecordsController {@Autowiredprivate IRecordsService iRecordsService;@RequestMapping("/list")HttpResult selectAll(int pageIndex, int pageSize , String numbers, String typeName){return iRecordsService.selectAll(pageIndex,pageSize,numbers,typeName);}@PostMapping("add")HttpResult insertRecords(@RequestBody Records records){return iRecordsService.insertRecords(records);}@RequestMapping("/delete")HttpResult deleteRecords(int id){return iRecordsService.deleteRecords(id);}
}
6:RecordsMapper.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.woniu.community.mapper.RecordsMapper"><resultMap id="recMap" type="Records"><result column="id" property="id"/><result column="type_id" property="typeId"/><result column="num" property="num"/><result column="num2" property="num2"/><result column="house_id" property="houseId"/><result column="up_time" property="upTime"/><result column="on_time" property="onTime"/><result column="check_time" property="checkTime"/><result column="meter" property="meter"/><result column="remarks" property="remarks"/><result column="username" property="userName"/><result column="numbers" property="numbers"/><result column="name" property="typeName"/></resultMap><select id="selectAll" resultMap="recMap">select h.numbers,o.username,r.*,p.namefrom house h left join owner o ono.house_id=h.idleft join records r onr.house_id=h.idleft join property_type p onr.type_id=p.id<where><if test="numbers!=null and numbers!='null'">and numbers=#{numbers}</if><if test="typeName!=null and typeName!='null'">and name=#{typeName}</if></where>limit #{start},#{size}</select><select id="count" resultType="int">select count(r.id)from house h left join owner o ono.house_id=h.idleft join records r onr.house_id=h.idleft join property_type p onr.type_id=p.id<where><if test="numbers!=null and numbers!='null'">and numbers=#{numbers}</if><if test="typeName!=null and typeName!='null'">and name=#{typeName}</if></where></select><insert id="insertRecords">insert into records(house_id,type_id,num,num2,check_time,meter)values (#{houseId},#{typeId},#{num},#{num2},#{checkTime},#{meter})</insert><delete id="deleteRecords">delete from records where id=#{id}</delete></mapper>
二 前端代码
<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>Title</title><link href="assets/bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="stylesheet"><link href="assets/css/right.css" rel="stylesheet"><script src="assets/jquery-3.5.1.min.js"></script><script src="assets/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script><script src="assets/vue.min-v2.5.16.js"></script><script src="assets/vue-router.min-2.7.0.js"></script><script src="assets/axios.min.js"></script>
</head>
<body>
<div id="app" class="container"><div class="row"><div class="col-md-12">门牌号:<input type="text" v-model="numbers"/>费用类型:<input type="text" v-model="typeName"/><button class="btn btn-info" @click="doQuery">搜索</button></div><div class="col-md-12" style="height: 50px; line-height: 50px;"><button class="btn btn-info" @click="doAdd">新增</button></div></div><div class="row"><div class="col-md-12"><table class="table table-striped"><caption>抄表管理</caption><thead><tr><th>门牌号</th><th>户主</th><th>费用类型</th><th>上次度数</th><th>本次度数</th><th>登记时间</th><th>抄表员</th><th>操作</th></tr></thead><tbody><tr v-for="o in records"><td>{{o.numbers}}</td><td>{{o.userName}}</td><td>{{o.typeName}}</td><td>{{o.num}}</td><td>{{o.num2}}</td><td>{{o.checkTime}}</td><td>{{o.meter}}</td><td><button class="btn btn-danger" @click="doDelete(o.id)">删除</button></td></tr></tbody></table><ul class="pagination" v-for="p in pageNum"><li v-if="p==pageIndex" class="active"><a @click="doGO(p)">{{p}}</a></li><li v-else="p==pageIndex"><a @click="doGO(p)">{{p}}</a></li></ul></div></div>
</div>
<script>new Vue({el: '#app',data: {records:null,pageIndex:1,//当前页码pageSize:5,//每显示的条数pageTotal:0,//总条数pageNum:0,//分页numbers:null,typeName:null,},methods: {requestLIst(url){axios.get(url).then(response=>{console.log(response.data)this.records=response.data.data;//用户列表this.pageTotal=response.data.pageTotal;//总条数this.pageNum=Math.ceil(this.pageTotal / this.pageSize);//计算页数})},doDelete(id){var url="http://localhost:8080/records/delete?id="+id;axios.get(url).then(response=>{console.log(response.data)if (response.data.code==200){var url="http://localhost:8080/records/list?pageIndex="+this.pageIndex+"&pageSize="+this.pageSize;this.requestLIst(url);}else{alert(response.data.msg)}})},doGO(p){this.pageIndex=p;var url="http://localhost:8080/records/list?pageIndex="+p+"&pageSize="+this.pageSize+"&numbers="+this.numbers+"&typeName="+this.typeName;this.requestLIst(url);},doQuery(){this.doGO(1);},doAdd(){window.parent.main_right.location.href = "records_add_update.html";},},created: function () {var url="http://localhost:8080/records/list?pageIndex="+this.pageIndex+"&pageSize="+this.pageSize;this.requestLIst(url);}});
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>Title</title><link href="assets/bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="stylesheet"><link href="assets/css/right.css" rel="stylesheet"><script src="assets/jquery-3.5.1.min.js"></script><script src="assets/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script><script src="assets/vue.min-v2.5.16.js"></script><script src="assets/vue-router.min-2.7.0.js"></script><script src="assets/axios.min.js"></script><script src="assets/date_picker.js"></script>
</head>
<body>
<div id="app" class="container"><div class="row"><div class="col-md-8 col-md-offset-2"><div class="row"><div class="col-md-12" style="text-align: center; font-weight: bold; font-size: 18px; height: 80px; line-height: 80px;">{{title}}</div></div><div class="row"><div class="col-md-6 col-md-offset-3" style="height: 200px;"><label>门牌号:</label><select v-model="houseId"><option v-for="h in houseList":value="h.id">{{h.numbers}}</option></select><br><label>费用类型:</label><select v-model="typeId"><option value="2">水费</option><option value="3">电费</option><option value="1">物业费</option><option value="4">停车费</option></select><br><label>上次度数:</label><input type="text" v-model="num"><br><label>本次度数:</label><input type="text" v-model="num2"><br><label>登记时间:</label><input type="date" class="form-control" v-model="checkTime"/><label>抄表员:</label><input type="text" v-model="meter"><br></div><div class="row"><div class="col-md-6 col-md-offset-3" style="height: 80px;"><button class="btn btn-primary"@click="doSave">保存</button><button class="btn btn-default" @click="doCancel">取消</button></div></div></div></div>
</div>
<script>new Vue({el: '#app',data: {title: "新增信息",houseList:null,houseId:null,typeId:null,num:null,num2:null,checkTime:null,meter:null,},methods: {requestHouse(){var url="http://localhost:8080/house/list?pageIndex=1&pageSize=100";axios.get(url).then(response=>{this.houseList=response.data.data;})},// requestOwner(){// var url="http://localhost:8080/owner/list?pageIndex=1&pageSize=100";// axios.get(url).then(response=>{// this.ownerList=response.data.data;// })// },doSave(){axios.post("http://localhost:8080/records/add",{houseId:this.houseId,typeId:this.typeId,num:this.num,num2:this.num2,checkTime:this.checkTime,meter:this.meter,}).then(response=>{if (response.data.code==200){window.parent.main_right.location.href="records_list.html";}else{alert(response.data.msg)}})},doCancel(){history.go(-1);},},created: function () {this. requestHouse();// this. requestOwner();}});
</script>
</body>
</html>
三 页面效果
# 智慧社区管理系统-基础信息管理-06抄表管理相关推荐
- # 智慧社区管理系统-基础信息管理-05车位管理
一后端 1:entuty package com.woniu.community.entity;import lombok.AllArgsConstructor; import lombok.Data ...
- # 智慧社区管理系统-核心信息管理-02物业收费管理
一 后端 1:entity package com.woniu.community.entity;import lombok.AllArgsConstructor; import lombok.Dat ...
- web常用通用组件+Axure后台管理系统框架模板+大屏数据可视化元件库+智慧社区管理系统大屏+图表组件+表单组合+智慧数据看板+通用大屏图表原件库+电脑端常用组件
作品介绍:web常用通用组件+Axure后台管理系统框架模板+大屏数据可视化元件库+智慧社区管理系统大屏+图表组件+表单组合+智慧数据看板+通用大屏图表原件库+电脑端常用组件 Axure原型演示及下载 ...
- 【计算机毕业设计】智慧社区管理系统
一.系统截图(需要演示视频可以私聊) 摘 要 随着科学技术的飞速发展,社会的方方面面.各行各业都在努力与现代的先进技术接轨,通过科技手段来提高自身的优势,智慧社区管理系统当然也不能排除在外.智慧社区管 ...
- SSM框架(spring+springmvc+mybatis)+Mysql实现的社区物业管理系统(功能包含分角色,报修管理、抄表管理、车位管理、房屋管理、业主管理、投诉管理、报修统计分析等)
博客目录 SSM框架(spring+springmvc+mybatis)+Mysql实现的社区物业管理系统 实现功能截图 系统功能 使用技术 代码 完整源码 SSM框架(spring+springmv ...
- 家谱管理系统性能要求_华北工控 | 嵌入式计算机在智慧社区管理系统中的大范畴应用...
随着"智能+"时代的到来,国家大力倡导老旧小区基础设施升级改造,物联网.互联网.大数据等新一代信息技术为小区传统物业向智慧社区现代物管转型提供了强有力的技术支撑,智慧社区建设备受市 ...
- 智慧社区管理系统常见功能有哪些
智慧社区管理系统可实现线上管理功能,如业主信息管理.物业缴费.线上报修等基本功能,同时支持多元化完善社区服务,社区便民服务.社区新闻资讯.社区生活商圈等,方案直接提升了物业与业主的办事效率. 智能停车 ...
- 智慧社区管理系统助力实现社区数字化管理
社区是人们生活的重要场所,传统社区的运营及管理方式已经无法满足人们日益增长的物质和文化生活需要.社区的通讯.安全和社区居民信息的收集.处理及共享等问题都成为阻碍社区服务进一步发展的瓶颈. 智慧社区是利 ...
- 智慧社区管理系统01(登录功能的实现)
目录 一.准备工作 数据库 四层架构 执行类 prom依赖导入 application.yml文件的配置 二.后端部分 entity层实体类 mapper层 service层 接口 实现类 Contr ...
最新文章
- java泛型的逆变_Java泛型的逆变
- jQuery - AJAX 简介
- oracle form 头行合计,FORM主从块头行金额汇总
- 怎么查看oracle数据库数据量大小?
- 初识 RESTful API规范
- 关于stable_sort()和sort()的区别:
- python400集视频教程-微软官方出品的400集Python精品视频教程,这正是我们急需的!...
- 《大道至简》最后两章读后感
- Mac关闭应用与Windows有哪些不同?
- 数组输出c语言getchar,C语言入门 — getchar
- ESP8266 AP服务器设置
- 剑指offer20题——leetcode主站65题
- 云计算机短网址,最新官方新浪短网址生成API接口与在线短网址缩短工具分享
- 巧妙地帮你的手机节省流量,担心流量超出的机友们看过(转)
- 排列显示阿拉伯语、数字及英文时的处理方法
- Pascal's Travels 动规小练
- 在Linux下如何使用磁带机
- 美国计算机转教育专业,2021年可以申请转专业计算机科学CS专业的这3所美国大学 可别错过哟!...
- 燎原老师python_Python之火,可以燎原
- python识别汉字笔画_Python识别图片中的文字