小金库
配套视频地址:https://www.bilibili.com/video/BV1gQ4y1r7ah
资源下载地址:https://download.csdn.net/download/qq_24330181/85624846
数据库设计
创建数据库
DROP DATABASE IF EXISTS `xiaojinku`;
CREATE DATABASE `xiaojinku` DEFAULT CHARACTER SET utf8 ;
USE `xiaojinku`;
select database();
创建收入表
DROP TABLE IF EXISTS `tb_income`;
CREATE TABLE `tb_income` (
`in_id` bigint UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '收入编号',
`in_title` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '标题',
`in_money` decimal(10, 2) NULL DEFAULT NULL COMMENT '收入金额',
`in_mode` int UNSIGNED NULL DEFAULT NULL COMMENT '收款方式',
`remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
`u_id` bigint UNSIGNED NULL DEFAULT NULL COMMENT '用户ID',
`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
`modified_time` timestamp NULL DEFAULT NULL COMMENT '修改时间',
`create_account_id` bigint UNSIGNED NULL DEFAULT NULL COMMENT '创建人ID',
`modified_account_id` bigint UNSIGNED NULL DEFAULT NULL COMMENT '修改人ID',
`deleted` tinyint UNSIGNED NULL DEFAULT NULL COMMENT '逻辑删除标识(0、否 1、是)',
PRIMARY KEY (`in_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
创建支出表
DROP TABLE IF EXISTS `tb_paid`;
CREATE TABLE `tb_paid` (
`pay_id` int(0) UNSIGNED NOT NULL AUTO_INCREMENT,
`pay_title` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '标题',
`pay_money` decimal(10, 2) NULL DEFAULT NULL COMMENT '支出金额',
`pay_mode` int(0) UNSIGNED NULL DEFAULT NULL COMMENT '支付方式',
`remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
`u_id` bigint(0) UNSIGNED NULL DEFAULT NULL COMMENT '用户ID',
`create_time` timestamp(0) NULL DEFAULT NULL COMMENT '创建时间',
`modified_time` timestamp(0) NULL DEFAULT NULL COMMENT '修改时间',
`create_account_id` bigint(0) UNSIGNED NULL DEFAULT NULL COMMENT '创建人ID',
`modified_account_id` bigint(0) UNSIGNED NULL DEFAULT NULL COMMENT '修改人ID',
`deleted` tinyint(0) UNSIGNED NULL DEFAULT NULL COMMENT '逻辑删除标识(0、否 1、是)',
PRIMARY KEY (`pay_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
创建收支方式表
DROP TABLE IF EXISTS `tb_mode`;
CREATE TABLE `tb_mode` (
`mode_id` bigint UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '收支方式ID',
`mode_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '收支方式名称',
PRIMARY KEY (`mode_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
创建资源表
DROP TABLE IF EXISTS `tb_resource`;
CREATE TABLE `tb_resource` (
`resouce_id` bigint UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '资源ID',
`parent_id` bigint UNSIGNED NULL DEFAULT NULL COMMENT '父ID',
`title` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '菜单名称',
`icon` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '菜单图标',
`href` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '链接',
`target` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '_self' COMMENT '链接打开方式',
`sort` int UNSIGNED NULL DEFAULT NULL COMMENT '菜单排序',
`status` int NULL DEFAULT 1 COMMENT '状态(0:禁用,1:启用)',
`remark` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注信息',
`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
`modified_time` timestamp NULL DEFAULT NULL COMMENT '修改时间',
`create_account_id` bigint UNSIGNED NULL DEFAULT NULL COMMENT '创建人ID',
`modified_account_id` bigint UNSIGNED NULL DEFAULT NULL COMMENT '修改人ID',
`deleted` tinyint UNSIGNED NULL DEFAULT NULL COMMENT '逻辑删除标识(0、否 1、是)',
PRIMARY KEY (`resouce_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
创建角色表
DROP TABLE IF EXISTS `tb_role`;
CREATE TABLE `tb_role` (
`role_id` bigint UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '角色ID',
`role_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '角色名称',
`remark` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`modified_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
`create_account_id` bigint UNSIGNED NULL DEFAULT NULL COMMENT '创建人',
`modified_account_id` bigint UNSIGNED NULL DEFAULT NULL COMMENT '修改人',
`deleted` tinyint UNSIGNED NULL DEFAULT 0 COMMENT '逻辑删除标识(0、否 1、是)',
PRIMARY KEY (`role_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
创建角色资源关联表
DROP TABLE IF EXISTS `tb_role_resource`;
CREATE TABLE `tb_role_resource` (
`role_id` bigint UNSIGNED NOT NULL COMMENT '角色id',
`resource_id` bigint UNSIGNED NOT NULL COMMENT '资源id',
PRIMARY KEY (`role_id`, `resource_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
创建用户表
DROP TABLE IF EXISTS `tb_user`;
CREATE TABLE `tb_user` (
`u_id` bigint NOT NULL AUTO_INCREMENT COMMENT '用户编号',
`u_account` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户账号',
`u_password` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户密码',
`u_nickname` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户昵称',
`head_sculpture` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户头像',
`u_realname` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户真实姓名',
`u_id_card` varchar(18) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户身份证号码',
`u_mobile` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户手机号',
`role_id` bigint UNSIGNED NOT NULL DEFAULT 2 COMMENT '角色ID',
`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
`modified_time` timestamp NULL DEFAULT NULL COMMENT '修改时间',
`create_account_id` bigint UNSIGNED NULL DEFAULT NULL COMMENT '创建人ID',
`modified_account_id` bigint UNSIGNED NULL DEFAULT NULL COMMENT '修改人ID',
`deleted` tinyint UNSIGNED NULL DEFAULT NULL COMMENT '逻辑删除标识(0、否 1、是)',
PRIMARY KEY (`u_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
插入数据
角色数据
INSERT INTO `xiaojinku`.`tb_role` (`role_id`, `role_name`, `remark`, `create_time`, `modified_time`, `create_account_id`, `modified_account_id`, `deleted`) VALUES (1, '管理员', '管理员', '2019-03-15 16:51:37', '2019-03-15 16:51:37', 1, 1, 0);
INSERT INTO `xiaojinku`.`tb_role` (`role_id`, `role_name`, `remark`, `create_time`, `modified_time`, `create_account_id`, `modified_account_id`, `deleted`) VALUES (2, '使用者', '普通用户', '2019-03-15 16:51:37', '2019-03-15 16:51:37', 1, 1, 0);
用户数据
INSERT INTO `xiaojinku`.`tb_user` (`u_id`, `u_account`, `u_password`, `u_nickname`, `head_sculpture`, `u_realname`, `u_id_card`, `u_mobile`, `role_id`, `create_time`, `modified_time`, `create_account_id`, `modified_account_id`, `deleted`) VALUES (1, 'admin', '123456', '管理员', NULL, '管理员', NULL, NULL, 1, '2021-09-09 06:06:06', '2021-09-09 06:06:06', 1, 1, 0);
资源数据
INSERT INTO `xiaojinku`.`tb_resource` (`resouce_id`, `parent_id`, `title`, `icon`, `href`, `target`, `sort`, `status`, `remark`, `create_time`, `modified_time`, `create_account_id`, `modified_account_id`, `deleted`) VALUES (1, 0, '系统管理', 'layui-icon layui-icon-set', NULL, '_self', 1, 1, NULL, '2021-09-09 02:58:25', '2021-09-09 02:58:25', 1, 1, 0);
INSERT INTO `xiaojinku`.`tb_resource` (`resouce_id`, `parent_id`, `title`, `icon`, `href`, `target`, `sort`, `status`, `remark`, `create_time`, `modified_time`, `create_account_id`, `modified_account_id`, `deleted`) VALUES (2, 0, '统计报表', 'layui-icon layui-icon-chart', NULL, '_self', 2, 1, NULL, '2021-09-09 02:59:54', '2021-09-09 02:59:54', 1, 1, 0);
INSERT INTO `xiaojinku`.`tb_resource` (`resouce_id`, `parent_id`, `title`, `icon`, `href`, `target`, `sort`, `status`, `remark`, `create_time`, `modified_time`, `create_account_id`, `modified_account_id`, `deleted`) VALUES (3, 0, '收入管理', 'layui-icon layui-icon-rmb', NULL, '_self', 3, 1, NULL, '2021-09-09 03:00:38', '2021-09-09 03:00:38', 1, 1, 0);
INSERT INTO `xiaojinku`.`tb_resource` (`resouce_id`, `parent_id`, `title`, `icon`, `href`, `target`, `sort`, `status`, `remark`, `create_time`, `modified_time`, `create_account_id`, `modified_account_id`, `deleted`) VALUES (4, 0, '支出管理', 'layui-icon layui-icon-cart', NULL, '_self', 4, 1, NULL, '2021-09-09 03:01:46', '2021-09-09 03:01:46', 1, 1, 0);
INSERT INTO `xiaojinku`.`tb_resource` (`resouce_id`, `parent_id`, `title`, `icon`, `href`, `target`, `sort`, `status`, `remark`, `create_time`, `modified_time`, `create_account_id`, `modified_account_id`, `deleted`) VALUES (5, 1, '用户管理', 'layui-icon layui-icon-user', '/user.html', '_blank', 1, 1, NULL, '2021-09-09 03:04:47', '2021-09-09 03:04:47', 1, 1, 0);
INSERT INTO `xiaojinku`.`tb_resource` (`resouce_id`, `parent_id`, `title`, `icon`, `href`, `target`, `sort`, `status`, `remark`, `create_time`, `modified_time`, `create_account_id`, `modified_account_id`, `deleted`) VALUES (6, 3, '收入明细', 'layui-icon layui-icon-table', '/income.html', '_blank', 1, 1, NULL, '2021-09-09 03:07:56', '2021-09-09 03:08:01', 1, 1, 0);
INSERT INTO `xiaojinku`.`tb_resource` (`resouce_id`, `parent_id`, `title`, `icon`, `href`, `target`, `sort`, `status`, `remark`, `create_time`, `modified_time`, `create_account_id`, `modified_account_id`, `deleted`) VALUES (7, 4, '支出明细', 'layui-icon layui-icon-table', '/pay.html', '_blank', 1, 1, NULL, '2021-09-09 03:09:14', '2021-09-09 03:09:14', 1, 1, 0);
INSERT INTO `xiaojinku`.`tb_resource` (`resouce_id`, `parent_id`, `title`, `icon`, `href`, `target`, `sort`, `status`, `remark`, `create_time`, `modified_time`, `create_account_id`, `modified_account_id`, `deleted`) VALUES (8, 2, '收支报表', 'layui-icon layui-icon-table', '/balance.html', '_blank', 1, 1, NULL, '2021-09-09 03:10:56', '2021-09-09 03:10:56', 1, 1, 0);
角色资源关联数据
INSERT INTO `xiaojinku`.`tb_role_resource` (`role_id`, `resource_id`) VALUES (1, 1);
INSERT INTO `xiaojinku`.`tb_role_resource` (`role_id`, `resource_id`) VALUES (1, 2);
INSERT INTO `xiaojinku`.`tb_role_resource` (`role_id`, `resource_id`) VALUES (1, 3);
INSERT INTO `xiaojinku`.`tb_role_resource` (`role_id`, `resource_id`) VALUES (1, 4);
INSERT INTO `xiaojinku`.`tb_role_resource` (`role_id`, `resource_id`) VALUES (1, 5);
INSERT INTO `xiaojinku`.`tb_role_resource` (`role_id`, `resource_id`) VALUES (1, 6);
INSERT INTO `xiaojinku`.`tb_role_resource` (`role_id`, `resource_id`) VALUES (1, 7);
INSERT INTO `xiaojinku`.`tb_role_resource` (`role_id`, `resource_id`) VALUES (2, 2);
INSERT INTO `xiaojinku`.`tb_role_resource` (`role_id`, `resource_id`) VALUES (2, 3);
INSERT INTO `xiaojinku`.`tb_role_resource` (`role_id`, `resource_id`) VALUES (2, 4);
INSERT INTO `xiaojinku`.`tb_role_resource` (`role_id`, `resource_id`) VALUES (2, 5);
INSERT INTO `xiaojinku`.`tb_role_resource` (`role_id`, `resource_id`) VALUES (2, 6);
INSERT INTO `xiaojinku`.`tb_role_resource` (`role_id`, `resource_id`) VALUES (2, 7);
收支方式数据
INSERT INTO `tb_mode` (`mode_id`,`mode_name`) VALUES (1, '现金');
INSERT INTO `tb_mode` (`mode_id`,`mode_name`) VALUES (2, '支付宝');
INSERT INTO `tb_mode` (`mode_id`,`mode_name`) VALUES (3, '微信');
INSERT INTO `tb_mode` (`mode_id`,`mode_name`) VALUES (4, '银行卡');
INSERT INTO `tb_mode` (`mode_id`,`mode_name`) VALUES (5, '信用卡');
开发流程
- 新建项目
- 导入依赖
- 导入工具类
- 根据数据库生成pojo类
- 导入Mybatis核心配置文件
- 编写持久层接口
- 编写映射配置文件
- 编写业务层接口
- 编写业务层接口实现类
- 测试
- 编写REST接口
- POSTMAN测试
- 编写页面
新建项目
倒入依赖
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.jdyxk</groupId>
<artifactId>xiaojinku</artifactId>
<version>1.0-SNAPSHOT</version>
<name>xiaojinku</name>
<packaging>war</packaging>
<properties>
<jdk.version>17</jdk.version>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.source>17</maven.compiler.source>
<maven.test.skip>true</maven.test.skip>
<commons-io.version>2.11.0</commons-io.version>
<commons-lang3.version>3.12.0</commons-lang3.version>
<c3p0.version>0.9.5.5</c3p0.version>
<druid.version>1.2.6</druid.version>
<fastjson.version>1.2.78</fastjson.version>
<hutool-all.version>5.7.10</hutool-all.version>
<junit.version>5.7.2</junit.version>
<java-testdata-generator.version>1.1.2</java-testdata-generator.version>
<javax.servlet.version>4.0.1</javax.servlet.version>
<jakarta.servlet.version>5.0.0</jakarta.servlet.version>
<jackson.version>2.12.5</jackson.version>
<jersey.version>2.34</jersey.version>
<lombok.version>1.18.20</lombok.version>
<mybatis.version>3.5.7</mybatis.version>
<mysql.version>8.0.26</mysql.version>
<pagehelper.version>5.2.1</pagehelper.version>
<spring.version>5.3.9</spring.version>
<kotlin.version>1.5.30</kotlin.version>
</properties>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet</artifactId>
<version>${jersey.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>${jersey.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-hk2</artifactId>
<version>${jersey.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>${jersey.version}</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.1.1</version>
<scope>provided</scope>
</dependency>
<!--junit-jupiter-api-->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<!--junit-jupiter-engine-->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<!--java-testdata-generator-->
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>java-testdata-generator</artifactId>
<version>${java-testdata-generator.version}</version>
</dependency>
<!--hutool-all-->
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>${hutool-all.version}</version>
</dependency>
<!--lombok-->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<scope>provided</scope>
</dependency>
<!-- commons-lang3 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
</dependency>
<!-- commons-io -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${commons-io.version}</version>
</dependency>
<!-- spring-context -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- fastjson -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>${fastjson.version}</version>
</dependency>
<!-- mysql -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
</dependency>
<!-- druid -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>${druid.version}</version>
</dependency>
<!-- c3p0 -->
<dependency>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>
<version>${c3p0.version}</version>
</dependency>
<!-- mybatis -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>${mybatis.version}</version>
</dependency>
<!-- pagehelper -->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>${pagehelper.version}</version>
</dependency>
<!--jackson-->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>${jackson.version}</version>
</dependency>
<!-- thymeleaf -->
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf</artifactId>
<version>3.0.12.RELEASE</version>
</dependency>
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-java8time</artifactId>
<version>3.0.4.RELEASE</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<!-- 设置编译字符编码 -->
<encoding>UTF-8</encoding>
<!-- 设置编译jdk版本 -->
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.2.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.3.1</version>
</plugin>
<!-- 编译级别 -->
<!-- 打包的时候跳过测试junit begin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<!-- tomcat7插件 -->
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<port>6633</port>
<path>/lhz</path>
<uriEncoding>UTF-8</uriEncoding>
<!-- tomcat热部署 -->
<username>admin</username>
<password>admin</password>
<url>http://192.168.18.65:8080/manager/text</url>
</configuration>
</plugin>
<!-- jetty插件 -->
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.4.43.v20210629</version>
<configuration>
<webApp>
<contextPath>/lhz</contextPath>
</webApp>
<httpConnector>
<port>6633</port>
</httpConnector>
</configuration>
</plugin>
</plugins>
</build>
</project>
导入工具类
从之前的项目导入commons包
根据数据库生成pojo类
收入类Income
package com.jdyxk.xiaojinku.pojo;
import com.jdyxk.commons.bean.BaseBean;
import java.time.LocalDateTime;
public class Income extends BaseBean {
private static final long serialVersionUID = -7427056136058996958L;
/**
* 收入ID
*/
private long inId;
/**
* 收入标题
*/
private String inTitle;
/**
* 收入金额
*/
private double inMoney;
/**
* 收款方式
*/
private long inMode;
/**
* 备注
*/
private String remark;
public Income() {
}
public Income(String inTitle, double inMoney, long inMode, String remark) {
this.inTitle = inTitle;
this.inMoney = inMoney;
this.inMode = inMode;
this.remark = remark;
}
public Income(long inId, String inTitle, double inMoney, long inMode, String remark) {
this.inId = inId;
this.inTitle = inTitle;
this.inMoney = inMoney;
this.inMode = inMode;
this.remark = remark;
}
public Income(LocalDateTime createTime, LocalDateTime modifiedTime, Long createAccountId, Long modifiedAccountId, Integer deleted, String inTitle, double inMoney, long inMode, String remark) {
super(createTime, modifiedTime, createAccountId, modifiedAccountId, deleted);
this.inTitle = inTitle;
this.inMoney = inMoney;
this.inMode = inMode;
this.remark = remark;
}
public Income(LocalDateTime createTime, LocalDateTime modifiedTime, Long createAccountId, Long modifiedAccountId, Integer deleted, long inId, String inTitle, double inMoney, long inMode, String remark) {
super(createTime, modifiedTime, createAccountId, modifiedAccountId, deleted);
this.inId = inId;
this.inTitle = inTitle;
this.inMoney = inMoney;
this.inMode = inMode;
this.remark = remark;
}
public long getInId() {
return inId;
}
public void setInId(long inId) {
this.inId = inId;
}
public String getInTitle() {
return inTitle;
}
public void setInTitle(String inTitle) {
this.inTitle = inTitle;
}
public double getInMoney() {
return inMoney;
}
public void setInMoney(double inMoney) {
this.inMoney = inMoney;
}
public long getInMode() {
return inMode;
}
public void setInMode(long inMode) {
this.inMode = inMode;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
}
支出类Paid
package com.jdyxk.xiaojinku.pojo;
import com.jdyxk.commons.bean.BaseBean;
import java.time.LocalDateTime;
public class Paid extends BaseBean {
private static final long serialVersionUID = 7252360803387247980L;
/**
* 支出ID
*/
private long payId;
/**
* 支出标题
*/
private String payTitle;
/**
* 付款金额
*/
private double payMoney;
/**
* 付款方式
*/
private long payMode;
/**
* 备注
*/
private String remark;
/**
* 用户ID
*/
private long uId;
public Paid() {
}
public Paid(String payTitle, double payMoney, long payMode, String remark, long uId) {
this.payTitle = payTitle;
this.payMoney = payMoney;
this.payMode = payMode;
this.remark = remark;
this.uId = uId;
}
public Paid(long payId, String payTitle, double payMoney, long payMode, String remark, long uId) {
this.payId = payId;
this.payTitle = payTitle;
this.payMoney = payMoney;
this.payMode = payMode;
this.remark = remark;
this.uId = uId;
}
public Paid(LocalDateTime createTime, LocalDateTime modifiedTime, Long createAccountId, Long modifiedAccountId, Integer deleted, String payTitle, double payMoney, long payMode, String remark, long uId) {
super(createTime, modifiedTime, createAccountId, modifiedAccountId, deleted);
this.payTitle = payTitle;
this.payMoney = payMoney;
this.payMode = payMode;
this.remark = remark;
this.uId = uId;
}
public Paid(LocalDateTime createTime, LocalDateTime modifiedTime, Long createAccountId, Long modifiedAccountId, Integer deleted, long payId, String payTitle, double payMoney, long payMode, String remark, long uId) {
super(createTime, modifiedTime, createAccountId, modifiedAccountId, deleted);
this.payId = payId;
this.payTitle = payTitle;
this.payMoney = payMoney;
this.payMode = payMode;
this.remark = remark;
this.uId = uId;
}
public long getPayId() {
return payId;
}
public void setPayId(long payId) {
this.payId = payId;
}
public String getPayTitle() {
return payTitle;
}
public void setPayTitle(String payTitle) {
this.payTitle = payTitle;
}
public double getPayMoney() {
return payMoney;
}
public void setPayMoney(double payMoney) {
this.payMoney = payMoney;
}
public long getPayMode() {
return payMode;
}
public void setPayMode(long payMode) {
this.payMode = payMode;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public long getuId() {
return uId;
}
public void setuId(long uId) {
this.uId = uId;
}
}
收支方式类TbMode
package com.jdyxk.xiaojinku.pojo;
import java.io.Serializable;
public class TbMode implements Serializable {
private static final long serialVersionUID = 4370817402583042740L;
/**
* 收支方式ID
*/
private long modeId;
/**
* 收支方式名称
*/
private String modeName;
public TbMode() {
}
public TbMode(String modeName) {
this.modeName = modeName;
}
public TbMode(long modeId, String modeName) {
this.modeId = modeId;
this.modeName = modeName;
}
public long getModeId() {
return modeId;
}
public void setModeId(long modeId) {
this.modeId = modeId;
}
public String getModeName() {
return modeName;
}
public void setModeName(String modeName) {
this.modeName = modeName;
}
}
资源类Resource
package com.jdyxk.xiaojinku.pojo;
import com.jdyxk.commons.bean.BaseBean;
import java.time.LocalDateTime;
public class Resource extends BaseBean {
private static final long serialVersionUID = 7533789308521929296L;
/**
* 资源ID
*/
private long resouceId;
/**
* 父亲ID
*/
private long parentId;
/**
* 菜单名称
*/
private String title;
/**
* 菜单图标
*/
private String icon;
/**
* 链接
*/
private String href;
/**
* 链接打开方式
*/
private String target;
/**
* 排序
*/
private long sort;
/**
* 状态 (0禁用 1启用)
*/
private long status;
/**
* 备注
*/
private String remark;
public Resource() {
}
public Resource(long parentId, String title, String icon, String href, String target, long sort, long status, String remark) {
this.parentId = parentId;
this.title = title;
this.icon = icon;
this.href = href;
this.target = target;
this.sort = sort;
this.status = status;
this.remark = remark;
}
public Resource(long resouceId, long parentId, String title, String icon, String href, String target, long sort, long status, String remark) {
this.resouceId = resouceId;
this.parentId = parentId;
this.title = title;
this.icon = icon;
this.href = href;
this.target = target;
this.sort = sort;
this.status = status;
this.remark = remark;
}
public Resource(LocalDateTime createTime, LocalDateTime modifiedTime, Long createAccountId, Long modifiedAccountId, Integer deleted, long parentId, String title, String icon, String href, String target, long sort, long status, String remark) {
super(createTime, modifiedTime, createAccountId, modifiedAccountId, deleted);
this.parentId = parentId;
this.title = title;
this.icon = icon;
this.href = href;
this.target = target;
this.sort = sort;
this.status = status;
this.remark = remark;
}
public Resource(LocalDateTime createTime, LocalDateTime modifiedTime, Long createAccountId, Long modifiedAccountId, Integer deleted, long resouceId, long parentId, String title, String icon, String href, String target, long sort, long status, String remark) {
super(createTime, modifiedTime, createAccountId, modifiedAccountId, deleted);
this.resouceId = resouceId;
this.parentId = parentId;
this.title = title;
this.icon = icon;
this.href = href;
this.target = target;
this.sort = sort;
this.status = status;
this.remark = remark;
}
public long getResouceId() {
return resouceId;
}
public void setResouceId(long resouceId) {
this.resouceId = resouceId;
}
public long getParentId() {
return parentId;
}
public void setParentId(long parentId) {
this.parentId = parentId;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getIcon() {
return icon;
}
public void setIcon(String icon) {
this.icon = icon;
}
public String getHref() {
return href;
}
public void setHref(String href) {
this.href = href;
}
public String getTarget() {
return target;
}
public void setTarget(String target) {
this.target = target;
}
public long getSort() {
return sort;
}
public void setSort(long sort) {
this.sort = sort;
}
public long getStatus() {
return status;
}
public void setStatus(long status) {
this.status = status;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
}
角色类Role
package com.jdyxk.xiaojinku.pojo;
import com.jdyxk.commons.bean.BaseBean;
import java.time.LocalDateTime;
public class Role extends BaseBean {
private static final long serialVersionUID = -3999451314479463795L;
/**
* 角色ID
*/
private long roleId;
/**
* 角色名称
*/
private String roleName;
/**
* 备注
*/
private String remark;
public Role() {
}
public Role(String roleName, String remark) {
this.roleName = roleName;
this.remark = remark;
}
public Role(long roleId, String roleName, String remark) {
this.roleId = roleId;
this.roleName = roleName;
this.remark = remark;
}
public Role(LocalDateTime createTime, LocalDateTime modifiedTime, Long createAccountId, Long modifiedAccountId, Integer deleted, String roleName, String remark) {
super(createTime, modifiedTime, createAccountId, modifiedAccountId, deleted);
this.roleName = roleName;
this.remark = remark;
}
public Role(LocalDateTime createTime, LocalDateTime modifiedTime, Long createAccountId, Long modifiedAccountId, Integer deleted, long roleId, String roleName, String remark) {
super(createTime, modifiedTime, createAccountId, modifiedAccountId, deleted);
this.roleId = roleId;
this.roleName = roleName;
this.remark = remark;
}
public long getRoleId() {
return roleId;
}
public void setRoleId(long roleId) {
this.roleId = roleId;
}
public String getRoleName() {
return roleName;
}
public void setRoleName(String roleName) {
this.roleName = roleName;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
}
角色资源关联类RoleResource
package com.jdyxk.xiaojinku.pojo;
import java.io.Serializable;
public class RoleResource implements Serializable {
private static final long serialVersionUID = -8979651404368559508L;
/**
* 角色ID
*/
private long roleId;
/**
* 资源ID
*/
private long resourceId;
public RoleResource() {
}
public RoleResource(long roleId, long resourceId) {
this.roleId = roleId;
this.resourceId = resourceId;
}
public long getRoleId() {
return roleId;
}
public void setRoleId(long roleId) {
this.roleId = roleId;
}
public long getResourceId() {
return resourceId;
}
public void setResourceId(long resourceId) {
this.resourceId = resourceId;
}
}
用户类User
package com.jdyxk.xiaojinku.pojo;
import com.jdyxk.commons.bean.BaseBean;
import java.time.LocalDateTime;
public class User extends BaseBean {
private static final long serialVersionUID = -9101171691965729598L;
/**
* 用户ID
*/
private long uId;
/**
* 用户账号
*/
private String uAccount;
/**
* 用户密码
*/
private String uPassword;
/**
* 用户昵称
*/
private String uNickname;
/**
* 用户头像
*/
private String headSculpture;
/**
* 用户真实姓名
*/
private String uRealname;
/**
* 用户身份证号
*/
private String uIdCard;
/**
* 用户手机号
*/
private String uMobile;
/**
* 角色ID
*/
private long roleId;
public User() {
}
public User(String uAccount, String uPassword) {
this.uAccount = uAccount;
this.uPassword = uPassword;
}
public User(String uAccount, String uPassword, String uNickname, String headSculpture, String uRealname, String uIdCard, String uMobile, long roleId) {
this.uAccount = uAccount;
this.uPassword = uPassword;
this.uNickname = uNickname;
this.headSculpture = headSculpture;
this.uRealname = uRealname;
this.uIdCard = uIdCard;
this.uMobile = uMobile;
this.roleId = roleId;
}
public User(long uId, String uAccount, String uPassword, String uNickname, String headSculpture, String uRealname, String uIdCard, String uMobile, long roleId) {
this.uId = uId;
this.uAccount = uAccount;
this.uPassword = uPassword;
this.uNickname = uNickname;
this.headSculpture = headSculpture;
this.uRealname = uRealname;
this.uIdCard = uIdCard;
this.uMobile = uMobile;
this.roleId = roleId;
}
public User(LocalDateTime createTime,