在前面带你轻松使用Spring Boot快速搭建web项目(二)我已经初步了解Spring Boot 如何配置一个web项目,在本篇文章,我们将开始共同完成一个比较复杂的类似于企业实战中的web应用。

1.项目背景

         在信息技术急速发展的今天,还有很多传统的行业没有搭上互联网的快车实现转型,就比如租赁市场的公寓管理,相对于以前传统的公寓管理,工作比较零散,而且繁杂。管理人员每天的工作繁多且很容易忘记一些要做的工作,在公寓财务管理方面也是完全依靠传统的纸质化记账和结算,偶尔会出现人为的计算失误导致工作的失误,造成经济损失。而且效率非常低下,在查询历史账务方面也需要花费较多的时间。想完成详细的年度财务报表,也需要专业的财务人员进行大量的统计工作,耗时费力。在这种背景下,我们可以使用信息化的系统来对公寓进行规范系统效率高的管理。使得公寓管理的工作不在那么繁杂盲目,减少管理人员工作量同时提高工作效率。

2.项目概述

         基于传统的公寓管理需要提高效率,完成更专业化的管理工作,公寓管理信息系统应运而生,该系统可以大大的改善传统的公寓管理效率低下,而且工作杂乱的状况,使管理人员更多的专注于公寓设施维护方面的工作。对于公寓的租户信息管理、租金收取、租金水电费计算、租金单生成、收租提醒、租赁合同管理、物料采购管理、财务统计管理、盈利报表管理等方面的工作完全交由系统来完成,管理人员只需要在系统里进行租户信息录入,每月水、电、燃气等使用量的录入,即可由系统自动生成租金单,财务报表等功能。

3.总体设计

         3.1 系统架构模式

                    系统采用B/S网络结构模式,客户端通过浏览器来访问和操作服务器数据

         3.2 技术选型

                    系统后台技术框架:Spring Boot、JPA

                    系统前端框架:VUE框架

                    数据库:PostgreSQL

                    IDE:Eclipse

                    中间件服务器:tomcat

                    部署服务器:weblogic

                    JDK:JDK8或JDK9或JDK10

4.数据库设计

       4.1以下是数据库SQL文件内容

         

CREATE TABLE "public"."user" (
	"id" int2 NOT NULL,
	"name" VARCHAR ( 20 ) COLLATE "pg_catalog"."default" NOT NULL,
	"describe" VARCHAR ( 255 ) COLLATE "pg_catalog"."default",
	"password" VARCHAR ( 12 ) COLLATE "pg_catalog"."default" NOT NULL,
	CONSTRAINT "user_pkey" PRIMARY KEY ( "id" ) 
);
ALTER TABLE "public"."user" OWNER TO "ams_admin";
COMMENT ON COLUMN "public"."user"."name" IS '用户名';
COMMENT ON COLUMN "public"."user"."describe" IS '描述';
COMMENT ON COLUMN "public"."user"."password" IS '密码';
COMMENT ON TABLE "public"."user" IS '用户表';


CREATE TABLE "public"."apartmentinfo" (
  "apid" int2 NOT NULL,
  "apname" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "buildingnum" int4 NOT NULL,
  "rental" int2 NOT NULL,
  "storeys" int2 NOT NULL,
  CONSTRAINT "apartmentinfo_pkey" PRIMARY KEY ("apid")
)
;

ALTER TABLE "public"."apartmentinfo" 
  OWNER TO "ams_admin";

COMMENT ON COLUMN "public"."apartmentinfo"."apid" IS '公寓信息ID';

COMMENT ON COLUMN "public"."apartmentinfo"."apname" IS '公寓名称';

COMMENT ON COLUMN "public"."apartmentinfo"."buildingnum" IS '楼号';

COMMENT ON COLUMN "public"."apartmentinfo"."rental" IS '租金';

COMMENT ON COLUMN "public"."apartmentinfo"."storeys" IS '层数';

COMMENT ON TABLE "public"."apartmentinfo" IS '公寓信息表';


CREATE TABLE "public"."lesseeinfo" (
	"id" int4 NOT NULL,
	"name" VARCHAR ( 32 ) COLLATE "pg_catalog"."default" NOT NULL,
	"identitynum" int4 NOT NULL,
	"address" VARCHAR ( 255 ) COLLATE "pg_catalog"."default",
	"sex" VARCHAR ( 4 ) COLLATE "pg_catalog"."default" NOT NULL,
	CONSTRAINT "lesseeinfo_pkey" PRIMARY KEY ( "id" ) 
);
ALTER TABLE "public"."lesseeinfo" OWNER TO "ams_admin";
COMMENT ON COLUMN "public"."lesseeinfo"."id" IS '主键ID';
COMMENT ON COLUMN "public"."lesseeinfo"."name" IS '租户姓名';
COMMENT ON COLUMN "public"."lesseeinfo"."identitynum" IS '身份证号码';
COMMENT ON COLUMN "public"."lesseeinfo"."address" IS '户籍地址';
COMMENT ON COLUMN "public"."lesseeinfo"."sex" IS '性别';
COMMENT ON TABLE "public"."lesseeinfo" IS '租户信息表';

CREATE TABLE "public"."lrmap" (
	"lesseeid" int4 NOT NULL,
	"id" int4 NOT NULL,
	"roomid" int4 NOT NULL,
	"rent" int4 NOT NULL,
	"flag" BIT ( 1 ) NOT NULL,
	CONSTRAINT "lrmap_pkey" PRIMARY KEY ( "id" ),
	CONSTRAINT "lesseeid" FOREIGN KEY ( "lesseeid" ) REFERENCES "public"."lesseeinfo" ( "id" ) ON DELETE CASCADE ON UPDATE CASCADE,
	CONSTRAINT "roomid" FOREIGN KEY ( "roomid" ) REFERENCES "public"."roominfo" ( "roomid" ) ON DELETE CASCADE ON UPDATE CASCADE 
);
ALTER TABLE "public"."lrmap" OWNER TO "ams_admin";
COMMENT ON COLUMN "public"."lrmap"."lesseeid" IS '租户ID';
COMMENT ON COLUMN "public"."lrmap"."id" IS '主键';
COMMENT ON COLUMN "public"."lrmap"."roomid" IS '房间ID';
COMMENT ON COLUMN "public"."lrmap"."rent" IS '租金';
COMMENT ON COLUMN "public"."lrmap"."flag" IS '是否在租标记(0:已退租,1:入住中,2:要续约)';
COMMENT ON TABLE "public"."lrmap" IS '住户房间信息关联表';

CREATE TABLE "public"."metricalinfo" (
	"id" int4 NOT NULL,
	"waterdegree" int2 NOT NULL,
	"powerdegree" int2 NOT NULL,
	"roomid" int4 NOT NULL,
	"month" int2 NOT NULL,
	"year" int2 NOT NULL,
	"gasdegree" int2 NOT NULL,
	CONSTRAINT "metricalinfo_pkey" PRIMARY KEY ( "id" ) 
);
ALTER TABLE "public"."metricalinfo" OWNER TO "ams_admin";
COMMENT ON COLUMN "public"."metricalinfo"."waterdegree" IS '水表度数';
COMMENT ON COLUMN "public"."metricalinfo"."powerdegree" IS '电表度数';
COMMENT ON COLUMN "public"."metricalinfo"."roomid" IS '所属房间ID';
COMMENT ON COLUMN "public"."metricalinfo"."month" IS '月';
COMMENT ON COLUMN "public"."metricalinfo"."year" IS '年';
COMMENT ON COLUMN "public"."metricalinfo"."gasdegree" IS '天然气度数';
COMMENT ON TABLE "public"."metricalinfo" IS '水电燃气等使用量表';

CREATE TABLE "public"."rentsheet" (
	"id" int4 NOT NULL,
	"waterfee" float4 NOT NULL,
	"powerfee" float4 NOT NULL,
	"gasfee" float4,
	"networkfee" int2,
	"hygienefee" int2,
	"managefee" int2,
	"tvfee" VARCHAR ( 255 ) COLLATE "pg_catalog"."default",
	"roomid" int4 NOT NULL,
	"othername" VARCHAR ( 255 ) COLLATE "pg_catalog"."default",
	"otherfee" int2,
	CONSTRAINT "Rentsheet_pkey" PRIMARY KEY ( "id" ),
	CONSTRAINT "roomid" FOREIGN KEY ( "roomid" ) REFERENCES "public"."roominfo" ( "roomid" ) ON DELETE CASCADE ON UPDATE CASCADE 
);
ALTER TABLE "public"."rentsheet" OWNER TO "ams_admin";
COMMENT ON COLUMN "public"."rentsheet"."id" IS '主键自增';
COMMENT ON COLUMN "public"."rentsheet"."waterfee" IS '水费';
COMMENT ON COLUMN "public"."rentsheet"."powerfee" IS '电费';
COMMENT ON COLUMN "public"."rentsheet"."gasfee" IS '燃气费';
COMMENT ON COLUMN "public"."rentsheet"."networkfee" IS '网费';
COMMENT ON COLUMN "public"."rentsheet"."hygienefee" IS '卫生费';
COMMENT ON COLUMN "public"."rentsheet"."managefee" IS '管理费';
COMMENT ON COLUMN "public"."rentsheet"."tvfee" IS '电视费';
COMMENT ON COLUMN "public"."rentsheet"."roomid" IS '所属房间ID';
COMMENT ON COLUMN "public"."rentsheet"."othername" IS '其他费用名称';
COMMENT ON COLUMN "public"."rentsheet"."otherfee" IS '其他费用';
COMMENT ON TABLE "public"."rentsheet" IS '租金单据表';

CREATE TABLE "public"."roominfo" (
	"roomid" int4 NOT NULL,
	"roomno" int4 NOT NULL,
	"apid" int2 NOT NULL,
	"storey" int2 NOT NULL,
	"rtid" int4 NOT NULL,
	"configdis" VARCHAR ( 255 ) COLLATE "pg_catalog"."default",
	CONSTRAINT "roominfo_pkey" PRIMARY KEY ( "roomid" ),
	CONSTRAINT "apid" FOREIGN KEY ( "apid" ) REFERENCES "public"."apartmentinfo" ( "apid" ) ON DELETE CASCADE ON UPDATE CASCADE,
	CONSTRAINT "rtid" FOREIGN KEY ( "rtid" ) REFERENCES "public"."roomtype" ( "rtid" ) ON DELETE CASCADE ON UPDATE CASCADE 
);
ALTER TABLE "public"."roominfo" OWNER TO "ams_admin";
COMMENT ON COLUMN "public"."roominfo"."roomid" IS '房间ID';
COMMENT ON COLUMN "public"."roominfo"."roomno" IS '房间号';
COMMENT ON COLUMN "public"."roominfo"."apid" IS '所属楼号';
COMMENT ON COLUMN "public"."roominfo"."storey" IS '所属楼层';
COMMENT ON COLUMN "public"."roominfo"."rtid" IS '户型ID';
COMMENT ON COLUMN "public"."roominfo"."configdis" IS '配置描述';
COMMENT ON TABLE "public"."roominfo" IS '房间信息表';

CREATE TABLE "public"."roomtype" (
	"rtid" int2 NOT NULL,
	"typename" VARCHAR ( 16 ) COLLATE "pg_catalog"."default" NOT NULL,
	"describe" VARCHAR ( 255 ) COLLATE "pg_catalog"."default",
	CONSTRAINT "roomtype_pkey" PRIMARY KEY ( "rtid" ) 
);
ALTER TABLE "public"."roomtype" OWNER TO "ams_admin";
COMMENT ON COLUMN "public"."roomtype"."rtid" IS '户型ID';
COMMENT ON COLUMN "public"."roomtype"."typename" IS '户型名称';
COMMENT ON TABLE "public"."roomtype" IS '房间类型表';


CREATE TABLE "public"."suppliesinfo" (
	"id" int4 NOT NULL,
	"name" VARCHAR ( 255 ) COLLATE "pg_catalog"."default",
	"univalence" int2,
	"amount" int4,
	"inventory" int4,
	CONSTRAINT "suppliesinfo_pkey" PRIMARY KEY ( "id" ) 
);
ALTER TABLE "public"."suppliesinfo" OWNER TO "ams_admin";
COMMENT ON COLUMN "public"."suppliesinfo"."name" IS '物料名称';
COMMENT ON COLUMN "public"."suppliesinfo"."univalence" IS '单价';
COMMENT ON COLUMN "public"."suppliesinfo"."amount" IS '总数';
COMMENT ON COLUMN "public"."suppliesinfo"."inventory" IS '库存余量';
COMMENT ON TABLE "public"."suppliesinfo" IS '物料';

CREATE TABLE "public"."univalenceinfo" (
	"id" int4 NOT NULL,
	"apid" int4 NOT NULL,
	"waterprice" float4 NOT NULL,
	"powerprice" float4 NOT NULL,
	"gasprice" float4 NOT NULL,
	CONSTRAINT "univalenceinfo_pkey" PRIMARY KEY ( "id" ),
	CONSTRAINT "apid" UNIQUE ( "apid" ) 
);
ALTER TABLE "public"."univalenceinfo" OWNER TO "ams_admin";
COMMENT ON COLUMN "public"."univalenceinfo"."id" IS '主键自增';
COMMENT ON COLUMN "public"."univalenceinfo"."apid" IS '所属楼ID';
COMMENT ON COLUMN "public"."univalenceinfo"."waterprice" IS '水费单价';
COMMENT ON COLUMN "public"."univalenceinfo"."powerprice" IS '电费单价';
COMMENT ON COLUMN "public"."univalenceinfo"."gasprice" IS '燃气单价';
COMMENT ON CONSTRAINT "apid" ON "public"."univalenceinfo" IS '楼层唯一检查';
COMMENT ON TABLE "public"."univalenceinfo" IS '单价信息表';


CREATE SEQUENCE "public"."apartmentinfo_apid_seq" INCREMENT 1 MAXVALUE 9223372036854775807 CACHE 1;
ALTER SEQUENCE "public"."apartmentinfo_apid_seq" OWNER TO "ams_admin";

CREATE SEQUENCE "public"."lesseeinfo_id_seq" INCREMENT 1 MAXVALUE 9223372036854775807 CACHE 1;
ALTER SEQUENCE "public"."lesseeinfo_id_seq" OWNER TO "ams_admin";

CREATE SEQUENCE "public"."lrmap_id_seq" INCREMENT 1 MAXVALUE 9223372036854775807 CACHE 1;
ALTER SEQUENCE "public"."lrmap_id_seq" OWNER TO "ams_admin";

CREATE SEQUENCE "public"."metricalinfo_apid_seq" INCREMENT 1 MAXVALUE 9223372036854775807 CACHE 1;
ALTER SEQUENCE "public"."metricalinfo_apid_seq" OWNER TO "ams_admin";

CREATE SEQUENCE "public"."rentsheet_id_seq" INCREMENT 1 MAXVALUE 9223372036854775807 CACHE 1;
ALTER SEQUENCE "public"."rentsheet_id_seq" OWNER TO "ams_admin";

CREATE SEQUENCE "public"."roominfo_roomid_seq" INCREMENT 1 MAXVALUE 9223372036854775807 CACHE 1;
ALTER SEQUENCE "public"."roominfo_roomid_seq" OWNER TO "ams_admin";

CREATE SEQUENCE "public"."roomtype_rtid_seq" INCREMENT 1 MAXVALUE 9223372036854775807 CACHE 1;
ALTER SEQUENCE "public"."roomtype_rtid_seq" OWNER TO "ams_admin";

CREATE SEQUENCE "public"."suppliesinfo_id_seq" INCREMENT 1 MAXVALUE 9223372036854775807 CACHE 1;
ALTER SEQUENCE "public"."suppliesinfo_id_seq" OWNER TO "ams_admin";

CREATE SEQUENCE "public"."univalenceinfo_id_seq" INCREMENT 1 MAXVALUE 9223372036854775807 CACHE 1;
ALTER SEQUENCE "public"."univalenceinfo_id_seq" OWNER TO "ams_admin";

CREATE SEQUENCE "public"."user_id_seq" INCREMENT 1 MAXVALUE 9223372036854775807 CACHE 1;
ALTER SEQUENCE "public"."user_id_seq" OWNER TO "postgres";