赞
踩
一创建父工程
1、创建SpringBoot项目
Group:com.liurui
Artifact:liurui
2、删除src目录
3、配置SpringBoot版本
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.4.RELEASE</version>
</parent>
4、配置pom依赖版本号
<properties> <java.version>1.8</java.version> <spring-cloud-alibaba.version>2.2.2.RELEASE</spring-cloud-alibaba.version> <spring-cloud.version>Hoxton.SR8</spring-cloud.version> <mybatis-plus.version>3.4.1</mybatis-plus.version> <velocity.version>2.0</velocity.version> <swagger.version>2.9.2</swagger.version> <swagger-bootstrap-ui.version>1.9.2</swagger-bootstrap-ui.version> <commons-lang3.version>3.9</commons-lang3.version> <commons-fileupload.version>1.3.1</commons-fileupload.version> <commons-io.version>2.6</commons-io.version> <alibaba.easyexcel.version>2.1.1</alibaba.easyexcel.version> <apache.xmlbeans.version>3.1.0</apache.xmlbeans.version> <fastjson.version>1.2.28</fastjson.version> <gson.version>2.8.2</gson.version> <json.version>20170516</json.version> <aliyun-java-sdk-core.version>4.3.3</aliyun-java-sdk-core.version> <aliyun-sdk-oss.version>3.10.2</aliyun-sdk-oss.version> <jodatime.version>2.10.1</jodatime.version> <jwt.version>0.7.0</jwt.version> <httpclient.version>4.5.1</httpclient.version> </properties>
5、配置pom依赖
<dependencyManagement> <dependencies> <!--Spring Cloud--> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-dependencies</artifactId> <version>${spring-cloud.version}</version> <type>pom</type> <scope>import</scope> </dependency> <!--Spring Cloud Alibaba--> <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-alibaba-dependencies</artifactId> <version>${spring-cloud-alibaba.version}</version> <type>pom</type> <scope>import</scope> </dependency> <!--mybatis-plus--> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> <version>${mybatis-plus.version}</version> </dependency> <!--mybatis-plus 代码生成器--> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-generator</artifactId> <version>${mybatis-plus.version}</version> </dependency> <!-- Mybatis Plus 代码生成器模板引擎, --> <dependency> <groupId>org.apache.velocity</groupId> <artifactId>velocity-engine-core</artifactId> <version>${velocity.version}</version> </dependency> <!--swagger--> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <version>${swagger.version}</version> </dependency> <!--swagger ui--> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger-ui</artifactId> <version>${swagger.version}</version> </dependency> <!--swagger-bootstrap-ui--> <dependency> <groupId>com.github.xiaoymin</groupId> <artifactId>swagger-bootstrap-ui</artifactId> <version>${swagger-bootstrap-ui.version}</version> </dependency> <!--commons-lang3--> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> <version>${commons-lang3.version}</version> </dependency> <!--文件上传--> <dependency> <groupId>commons-fileupload</groupId> <artifactId>commons-fileupload</artifactId> <version>${commons-fileupload.version}</version> </dependency> <!--commons-io--> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <version>${commons-io.version}</version> </dependency> <!--excel解析--> <dependency> <groupId>com.alibaba</groupId> <artifactId>easyexcel</artifactId> <version>${alibaba.easyexcel.version}</version> </dependency> <!--excel解析依赖--> <dependency> <groupId>org.apache.xmlbeans</groupId> <artifactId>xmlbeans</artifactId> <version>${apache.xmlbeans.version}</version> </dependency> <!--json--> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>${fastjson.version}</version> </dependency> <dependency> <groupId>org.json</groupId> <artifactId>json</artifactId> <version>${json.version}</version> </dependency> <dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> <version>${gson.version}</version> </dependency> <!--阿里云SDK远程调用--> <dependency> <groupId>com.aliyun</groupId> <artifactId>aliyun-java-sdk-core</artifactId> <version>${aliyun-java-sdk-core.version}</version> </dependency> <!--阿里云文件管理--> <dependency> <groupId>com.aliyun.oss</groupId> <artifactId>aliyun-sdk-oss</artifactId> <version>${aliyun-sdk-oss.version}</version> </dependency> <!--日期时间工具--> <dependency> <groupId>joda-time</groupId> <artifactId>joda-time</artifactId> <version>${jodatime.version}</version> </dependency> <!--jwt工具--> <dependency> <groupId>io.jsonwebtoken</groupId> <artifactId>jjwt</artifactId> <version>${jwt.version}</version> </dependency> <!--httpclient--> <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> <version>${httpclient.version}</version> </dependency> </dependencies> </dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> </dependencies>
二、创建模块system-common
1、创建Maven模块
在liurui下创建普通maven模块
Group:com.liurui
Artifact:system-common
2、配置pom
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!--lombok用来简化实体类:需要安装lombok插件-->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies>
三、创建模块service-base
1、创建Maven模块
在liurui 下创建普通maven模块
Group:com.liurui
Artifact:service-base
2、配置pom
注意:依赖system-common
<dependencies> <dependency> <groupId>com.liurui</groupId> <artifactId>system-common</artifactId> <version>0.0.1-SNAPSHOT</version> </dependency> <!--swagger--> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> </dependency> <!--swagger ui--> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger-ui</artifactId> </dependency> </dependencies>
四、创建模块service-core
1、创建Maven模块
在srb下创建普通maven模块
Group:com.liurui
Artifact:service-core
2、配置pom
注意:依赖service-base
<dependencies> <dependency> <groupId>com.liurui</groupId> <artifactId>service-base</artifactId> <version>0.0.1-SNAPSHOT</version> </dependency> <!--mysql--> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> </dependency> <!--mybatis-plus--> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> </dependency> <!--mybatis-plus 代码生成器--> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-generator</artifactId> </dependency> <!-- Mybatis Plus 代码生成器模板引擎, --> <dependency> <groupId>org.apache.velocity</groupId> <artifactId>velocity-engine-core</artifactId> </dependency> </dependencies>
五、代码生成器
1、创建数据库
创建数据库srb_core
并执行sql脚本初始化数据结构和数据
/* Navicat Premium Data Transfer Source Server : localhost Source Server Type : MySQL Source Server Version : 50721 Source Host : localhost:3306 Source Schema : srb_core Target Server Type : MySQL Target Server Version : 50721 File Encoding : 65001 Date: 21/03/2021 22:39:29 */ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for borrow_info -- ---------------------------- DROP TABLE IF EXISTS `borrow_info`; CREATE TABLE `borrow_info` ( `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号', `user_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '借款用户id', `amount` decimal(10, 2) NULL DEFAULT NULL COMMENT '借款金额', `period` int(11) NULL DEFAULT NULL COMMENT '借款期限', `borrow_year_rate` decimal(10, 2) NULL DEFAULT NULL COMMENT '年化利率', `return_method` tinyint(3) NULL DEFAULT NULL COMMENT '还款方式 1-等额本息 2-等额本金 3-每月还息一次还本 4-一次还本', `money_use` tinyint(3) NULL DEFAULT NULL COMMENT '资金用途', `status` tinyint(3) NOT NULL DEFAULT 0 COMMENT '状态(0:未提交,1:审核中, 2:审核通过, -1:审核不通过)', `create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间', `update_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间', `is_deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '逻辑删除(1:已删除,0:未删除)', PRIMARY KEY (`id`) USING BTREE, INDEX `idx_user_id`(`user_id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '借款信息表' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of borrow_info -- ---------------------------- -- ---------------------------- -- Table structure for borrower -- ---------------------------- DROP TABLE IF EXISTS `borrower`; CREATE TABLE `borrower` ( `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号', `user_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '用户id', `name` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '姓名', `id_card` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0' COMMENT '身份证号', `mobile` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '手机', `sex` tinyint(3) NULL DEFAULT NULL COMMENT '性别(1:男 0:女)', `age` tinyint(3) NULL DEFAULT NULL COMMENT '年龄', `education` tinyint(3) NULL DEFAULT NULL COMMENT '学历', `is_marry` tinyint(1) NULL DEFAULT NULL COMMENT '是否结婚(1:是 0:否)', `industry` tinyint(3) NULL DEFAULT NULL COMMENT '行业', `income` tinyint(3) NULL DEFAULT NULL COMMENT '月收入', `return_source` tinyint(3) NULL DEFAULT NULL COMMENT '还款来源', `contacts_name` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '联系人名称', `contacts_mobile` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '联系人手机', `contacts_relation` tinyint(3) NULL DEFAULT NULL COMMENT '联系人关系', `status` tinyint(3) NOT NULL DEFAULT 0 COMMENT '状态(0:未认证,1:认证中, 2:认证通过, -1:认证失败)', `create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间', `update_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间', `is_deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '逻辑删除(1:已删除,0:未删除)', PRIMARY KEY (`id`) USING BTREE, UNIQUE INDEX `uk_user_id`(`user_id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '借款人' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of borrower -- ---------------------------- -- ---------------------------- -- Table structure for borrower_attach -- ---------------------------- DROP TABLE IF EXISTS `borrower_attach`; CREATE TABLE `borrower_attach` ( `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号', `borrower_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '借款人id', `image_type` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '图片类型(idCard1:身份证正面,idCard2:身份证反面,house:房产证,car:车)', `image_url` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '图片路径', `image_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '图片名称', `create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间', `update_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间', `is_deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '逻辑删除(1:已删除,0:未删除)', PRIMARY KEY (`id`) USING BTREE, INDEX `idx_borrower_id`(`borrower_id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 13 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '借款人上传资源表' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of borrower_attach -- ---------------------------- -- ---------------------------- -- Table structure for dict -- ---------------------------- DROP TABLE IF EXISTS `dict`; CREATE TABLE `dict` ( `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id', `parent_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '上级id', `name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '名称', `value` int(11) NULL DEFAULT NULL COMMENT '值', `dict_code` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '编码', `create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间', `update_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间', `is_deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '删除标记(0:不可用 1:可用)', PRIMARY KEY (`id`) USING BTREE, UNIQUE INDEX `uk_parent_id_value`(`parent_id`, `value`) USING BTREE, INDEX `idx_parent_id`(`parent_id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 82008 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '数据字典' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of dict -- ---------------------------- INSERT INTO `dict` VALUES (1, 0, '全部分类', NULL, 'ROOT', '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (20000, 1, '行业', NULL, 'industry', '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (20001, 20000, 'IT', 1, NULL, '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (20002, 20000, '医生', 2, NULL, '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (20003, 20000, '教师', 3, NULL, '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (20004, 20000, '导游', 4, NULL, '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (20005, 20000, '律师', 5, NULL, '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (20006, 20000, '其他', 6, NULL, '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (30000, 1, '学历', NULL, 'education', '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (30001, 30000, '高中', 1, NULL, '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (30002, 30000, '大专', 2, NULL, '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (30003, 30000, '本科', 3, NULL, '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (30004, 30000, '研究生', 4, NULL, '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (30005, 30000, '其他', 5, NULL, '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (40000, 1, '收入', NULL, 'income', '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (40001, 40000, '0-3000', 1, NULL, '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (40002, 40000, '3000-5000', 2, NULL, '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (40003, 40000, '5000-10000', 3, NULL, '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (40004, 40000, '10000以上', 4, NULL, '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (50000, 1, '收入来源', NULL, 'returnSource', '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (50001, 50000, '工资', 1, NULL, '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (50002, 50000, '股票', 2, NULL, '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (50003, 50000, '兼职', 3, NULL, '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (60000, 1, '关系', NULL, 'relation', '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (60001, 60000, '夫妻', 1, NULL, '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (60002, 60000, '兄妹', 2, NULL, '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (60003, 60000, '父母', 3, NULL, '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (60004, 60000, '其他', 4, NULL, '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (70000, 1, '还款方式', NULL, 'returnMethod', '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (70001, 70000, '等额本息', 1, NULL, '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (70002, 70000, '等额本金', 2, NULL, '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (70003, 70000, '每月还息一次还本', 3, NULL, '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (70004, 70000, '一次还本还息', 4, NULL, '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (80000, 1, '资金用途', NULL, 'moneyUse', '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (80001, 80000, '旅游', 1, NULL, '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (80002, 80000, '买房', 2, NULL, '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (80003, 80000, '装修', 3, NULL, '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (80004, 80000, '医疗', 4, NULL, '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (80005, 80000, '美容', 5, NULL, '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (80006, 80000, '其他', 6, NULL, '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (81000, 1, '借款状态', NULL, 'borrowStatus', '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (81001, 81000, '待审核', 0, NULL, '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (81002, 81000, '审批通过', 1, NULL, '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (81003, 81000, '还款中', 2, NULL, '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (81004, 81000, '结束', 3, NULL, '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (81005, 81000, '审批不通过', -1, NULL, '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (82000, 1, '学校性质', NULL, 'SchoolStatus', '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (82001, 82000, '211/985', NULL, NULL, '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (82002, 82000, '一本', NULL, NULL, '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (82003, 82000, '二本', NULL, NULL, '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (82004, 82000, '三本', NULL, NULL, '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (82005, 82000, '高职高专', NULL, NULL, '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (82006, 82000, '中职中专', NULL, NULL, '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); INSERT INTO `dict` VALUES (82007, 82000, '高中及以下', NULL, NULL, '2021-02-20 00:26:22', '2021-02-20 00:26:22', 0); -- ---------------------------- -- Table structure for integral_grade -- ---------------------------- DROP TABLE IF EXISTS `integral_grade`; CREATE TABLE `integral_grade` ( `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号', `integral_start` int(11) NULL DEFAULT NULL COMMENT '积分区间开始', `integral_end` int(11) NULL DEFAULT NULL COMMENT '积分区间结束', `borrow_amount` decimal(10, 2) NULL DEFAULT NULL COMMENT '借款额度', `create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间', `update_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间', `is_deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '逻辑删除(1:已删除,0:未删除)', PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '积分等级表' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of integral_grade -- ---------------------------- INSERT INTO `integral_grade` VALUES (1, 10, 50, 10000.00, '2020-12-08 17:02:29', '2021-02-19 17:58:10', 0); INSERT INTO `integral_grade` VALUES (2, 51, 100, 30000.00, '2020-12-08 17:02:42', '2021-02-19 18:00:25', 0); INSERT INTO `integral_grade` VALUES (3, 101, 2000, 100000.00, '2020-12-08 17:02:57', '2021-02-23 21:03:03', 0); -- ---------------------------- -- Table structure for lend -- ---------------------------- DROP TABLE IF EXISTS `lend`; CREATE TABLE `lend` ( `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号', `user_id` bigint(20) NULL DEFAULT NULL COMMENT '借款用户id', `borrow_info_id` bigint(20) NULL DEFAULT NULL COMMENT '借款信息id', `lend_no` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '标的编号', `title` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '标题', `amount` decimal(10, 2) NULL DEFAULT NULL COMMENT '标的金额', `period` int(11) NULL DEFAULT NULL COMMENT '投资期数', `lend_year_rate` decimal(10, 2) NULL DEFAULT NULL COMMENT '年化利率', `service_rate` decimal(10, 2) NULL DEFAULT NULL COMMENT '平台服务费率', `return_method` tinyint(3) NULL DEFAULT NULL COMMENT '还款方式', `lowest_amount` decimal(10, 2) NULL DEFAULT NULL COMMENT '最低投资金额', `invest_amount` decimal(10, 2) NULL DEFAULT NULL COMMENT '已投金额', `invest_num` int(11) NULL DEFAULT NULL COMMENT '投资人数', `publish_date` datetime(0) NULL DEFAULT NULL COMMENT '发布日期', `lend_start_date` date NULL DEFAULT NULL COMMENT '开始日期', `lend_end_date` date NULL DEFAULT NULL COMMENT '结束日期', `lend_info` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '说明', `expect_amount` decimal(10, 2) NULL DEFAULT NULL COMMENT '平台预期收益', `real_amount` decimal(10, 2) NULL DEFAULT NULL COMMENT '实际收益', `status` tinyint(3) NOT NULL DEFAULT 0 COMMENT '状态', `check_time` datetime(0) NULL DEFAULT NULL COMMENT '审核时间', `check_admin_id` bigint(1) NULL DEFAULT NULL COMMENT '审核用户id', `payment_time` datetime(0) NULL DEFAULT NULL COMMENT '放款时间', `payment_admin_id` datetime(0) NULL DEFAULT NULL COMMENT '放款人id', `create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间', `update_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间', `is_deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '逻辑删除(1:已删除,0:未删除)', PRIMARY KEY (`id`) USING BTREE, UNIQUE INDEX `uk_lend_no`(`lend_no`) USING BTREE, INDEX `idx_user_id`(`user_id`) USING BTREE, INDEX `idx_borrow_info_id`(`borrow_info_id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '标的准备表' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of lend -- ---------------------------- -- ---------------------------- -- Table structure for lend_item -- ---------------------------- DROP TABLE IF EXISTS `lend_item`; CREATE TABLE `lend_item` ( `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号', `lend_item_no` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '投资编号', `lend_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '标的id', `invest_user_id` bigint(20) NULL DEFAULT NULL COMMENT '投资用户id', `invest_name` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '投资人名称', `invest_amount` decimal(10, 2) NULL DEFAULT NULL COMMENT '投资金额', `lend_year_rate` decimal(10, 2) NULL DEFAULT NULL COMMENT '年化利率', `invest_time` datetime(0) NULL DEFAULT NULL COMMENT '投资时间', `lend_start_date` date NULL DEFAULT NULL COMMENT '开始日期', `lend_end_date` date NULL DEFAULT NULL COMMENT '结束日期', `expect_amount` decimal(10, 2) NULL DEFAULT NULL COMMENT '预期收益', `real_amount` decimal(10, 2) NULL DEFAULT NULL COMMENT '实际收益', `status` tinyint(3) NULL DEFAULT NULL COMMENT '状态(0:默认 1:已支付 2:已还款)', `create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间', `update_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间', `is_deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '逻辑删除(1:已删除,0:未删除)', PRIMARY KEY (`id`) USING BTREE, UNIQUE INDEX `uk_lend_item_no`(`lend_item_no`) USING BTREE, INDEX `idx_lend_id`(`lend_id`) USING BTREE, INDEX `idx_invest_user_id`(`invest_user_id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '标的出借记录表' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of lend_item -- ---------------------------- -- ---------------------------- -- Table structure for lend_item_return -- ---------------------------- DROP TABLE IF EXISTS `lend_item_return`; CREATE TABLE `lend_item_return` ( `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号', `lend_return_id` bigint(20) NULL DEFAULT NULL COMMENT '标的还款id', `lend_item_id` bigint(20) NULL DEFAULT NULL COMMENT '标的项id', `lend_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '标的id', `invest_user_id` bigint(1) NULL DEFAULT NULL COMMENT '出借用户id', `invest_amount` decimal(10, 2) NULL DEFAULT NULL COMMENT '出借金额', `current_period` int(11) NULL DEFAULT NULL COMMENT '当前的期数', `lend_year_rate` decimal(10, 2) NULL DEFAULT NULL COMMENT '年化利率', `return_method` tinyint(3) NULL DEFAULT NULL COMMENT '还款方式 1-等额本息 2-等额本金 3-每月还息一次还本 4-一次还本', `principal` decimal(10, 2) NULL DEFAULT NULL COMMENT '本金', `interest` decimal(10, 2) NULL DEFAULT NULL COMMENT '利息', `total` decimal(10, 2) NULL DEFAULT NULL COMMENT '本息', `fee` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '手续费', `return_date` date NULL DEFAULT NULL COMMENT '还款时指定的还款日期', `real_return_time` datetime(0) NULL DEFAULT NULL COMMENT '实际发生的还款时间', `is_overdue` tinyint(1) NULL DEFAULT NULL COMMENT '是否逾期', `overdue_total` decimal(10, 2) NULL DEFAULT NULL COMMENT '逾期金额', `status` tinyint(3) NULL DEFAULT NULL COMMENT '状态(0-未归还 1-已归还)', `create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间', `update_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间', `is_deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '逻辑删除(1:已删除,0:未删除)', PRIMARY KEY (`id`) USING BTREE, INDEX `idx_lend_return_id`(`lend_return_id`) USING BTREE, INDEX `idx_lend_item_id`(`lend_item_id`) USING BTREE, INDEX `idx_lend_id`(`lend_id`) USING BTREE, INDEX `idx_invest_user_id`(`invest_user_id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 16 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '标的出借回款记录表' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of lend_item_return -- ---------------------------- -- ---------------------------- -- Table structure for lend_return -- ---------------------------- DROP TABLE IF EXISTS `lend_return`; CREATE TABLE `lend_return` ( `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号', `lend_id` bigint(20) NULL DEFAULT NULL COMMENT '标的id', `borrow_info_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '借款信息id', `return_no` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '还款批次号', `user_id` bigint(20) NULL DEFAULT NULL COMMENT '借款人用户id', `amount` decimal(10, 2) NULL DEFAULT NULL COMMENT '借款金额', `base_amount` decimal(10, 2) NULL DEFAULT NULL COMMENT '计息本金额', `current_period` int(11) NULL DEFAULT NULL COMMENT '当前的期数', `lend_year_rate` decimal(10, 2) NULL DEFAULT NULL COMMENT '年化利率', `return_method` tinyint(3) NULL DEFAULT NULL COMMENT '还款方式 1-等额本息 2-等额本金 3-每月还息一次还本 4-一次还本', `principal` decimal(10, 2) NULL DEFAULT NULL COMMENT '本金', `interest` decimal(10, 2) NULL DEFAULT NULL COMMENT '利息', `total` decimal(10, 2) NULL DEFAULT NULL COMMENT '本息', `fee` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '手续费', `return_date` date NULL DEFAULT NULL COMMENT '还款时指定的还款日期', `real_return_time` datetime(0) NULL DEFAULT NULL COMMENT '实际发生的还款时间', `is_overdue` tinyint(1) NULL DEFAULT NULL COMMENT '是否逾期', `overdue_total` decimal(10, 2) NULL DEFAULT NULL COMMENT '逾期金额', `is_last` tinyint(1) NULL DEFAULT NULL COMMENT '是否最后一次还款', `status` tinyint(3) NULL DEFAULT NULL COMMENT '状态(0-未归还 1-已归还)', `create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间', `update_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间', `is_deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '逻辑删除(1:已删除,0:未删除)', PRIMARY KEY (`id`) USING BTREE, UNIQUE INDEX `uk_return_no`(`return_no`) USING BTREE, INDEX `idx_lend_id`(`lend_id`) USING BTREE, INDEX `idx_borrow_info_id`(`borrow_info_id`) USING BTREE, INDEX `idx_user_id`(`user_id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 10 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '还款记录表' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of lend_return -- ---------------------------- -- ---------------------------- -- Table structure for trans_flow -- ---------------------------- DROP TABLE IF EXISTS `trans_flow`; CREATE TABLE `trans_flow` ( `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号', `user_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '用户id', `user_name` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户名称', `trans_no` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '交易单号', `trans_type` tinyint(3) NOT NULL DEFAULT 0 COMMENT '交易类型(1:充值 2:提现 3:投标 4:投资回款 ...)', `trans_type_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '交易类型名称', `trans_amount` decimal(10, 2) NULL DEFAULT NULL COMMENT '交易金额', `memo` varchar(300) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注', `create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间', `update_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间', `is_deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '逻辑删除(1:已删除,0:未删除)', PRIMARY KEY (`id`) USING BTREE, UNIQUE INDEX `uk_trans_no`(`trans_no`) USING BTREE, INDEX `idx_user_id`(`user_id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 57 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '交易流水表' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of trans_flow -- ---------------------------- -- ---------------------------- -- Table structure for user_account -- ---------------------------- DROP TABLE IF EXISTS `user_account`; CREATE TABLE `user_account` ( `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号', `user_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '用户id', `amount` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '帐户可用余额', `freeze_amount` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '冻结金额', `create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间', `update_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间', `is_deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '逻辑删除(1:已删除,0:未删除)', `version` int(11) NOT NULL DEFAULT 0 COMMENT '版本号', PRIMARY KEY (`id`) USING BTREE, UNIQUE INDEX `uk_user_id`(`user_id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户账户' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of user_account -- ---------------------------- -- ---------------------------- -- Table structure for user_bind -- ---------------------------- DROP TABLE IF EXISTS `user_bind`; CREATE TABLE `user_bind` ( `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号', `user_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '用户id', `name` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '用户姓名', `id_card` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '身份证号', `bank_no` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '银行卡号', `bank_type` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '银行类型', `mobile` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '手机号', `bind_code` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '绑定账户协议号', `status` tinyint(3) NULL DEFAULT NULL COMMENT '状态', `create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间', `update_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间', `is_deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '逻辑删除(1:已删除,0:未删除)', PRIMARY KEY (`id`) USING BTREE, UNIQUE INDEX `uk_user_id`(`user_id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户绑定表' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of user_bind -- ---------------------------- -- ---------------------------- -- Table structure for user_info -- ---------------------------- DROP TABLE IF EXISTS `user_info`; CREATE TABLE `user_info` ( `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号', `user_type` tinyint(3) NOT NULL DEFAULT 0 COMMENT '1:出借人 2:借款人', `mobile` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '手机号', `password` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '用户密码', `nick_name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '用户昵称', `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '用户姓名', `id_card` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '身份证号', `email` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '邮箱', `openid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '微信用户标识openid', `head_img` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '头像', `bind_status` tinyint(3) NOT NULL DEFAULT 0 COMMENT '绑定状态(0:未绑定,1:绑定成功 -1:绑定失败)', `borrow_auth_status` tinyint(3) NOT NULL DEFAULT 0 COMMENT '借款人认证状态(0:未认证 1:认证中 2:认证通过 -1:认证失败)', `bind_code` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '绑定账户协议号', `integral` int(11) NOT NULL DEFAULT 0 COMMENT '用户积分', `status` tinyint(3) NOT NULL DEFAULT 1 COMMENT '状态(0:锁定 1:正常)', `create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间', `update_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间', `is_deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '逻辑删除(1:已删除,0:未删除)', PRIMARY KEY (`id`) USING BTREE, INDEX `uk_mobile`(`mobile`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户基本信息' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of user_info -- ---------------------------- -- ---------------------------- -- Table structure for user_integral -- ---------------------------- DROP TABLE IF EXISTS `user_integral`; CREATE TABLE `user_integral` ( `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号', `user_id` bigint(20) NULL DEFAULT NULL COMMENT '用户id', `integral` int(11) NULL DEFAULT NULL COMMENT '积分', `content` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '获取积分说明', `create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间', `update_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间', `is_deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '逻辑删除(1:已删除,0:未删除)', PRIMARY KEY (`id`) USING BTREE, INDEX `idx_user_id`(`user_id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 21 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户积分记录表' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of user_integral -- ---------------------------- -- ---------------------------- -- Table structure for user_login_record -- ---------------------------- DROP TABLE IF EXISTS `user_login_record`; CREATE TABLE `user_login_record` ( `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号', `user_id` bigint(20) NULL DEFAULT NULL COMMENT '用户id', `ip` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'ip', `create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间', `update_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间', `is_deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '逻辑删除(1:已删除,0:未删除)', PRIMARY KEY (`id`) USING BTREE, INDEX `idx_user_id`(`user_id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 29 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户登录记录表' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of user_login_record -- ---------------------------- SET FOREIGN_KEY_CHECKS = 1;
2、创建代码生成器
在test目录中创建测试用例,并执行
public class CodeGenerator { @Test public void genCode() { // 1、创建代码生成器 AutoGenerator mpg = new AutoGenerator(); // 2、全局配置 GlobalConfig gc = new GlobalConfig(); String projectPath = System.getProperty("user.dir"); gc.setOutputDir(projectPath + "/src/main/java"); gc.setAuthor("Helen"); gc.setOpen(false); //生成后是否打开资源管理器 gc.setServiceName("%sService"); //去掉Service接口的首字母I gc.setIdType(IdType.AUTO); //主键策略 gc.setSwagger2(true);//开启Swagger2模式 mpg.setGlobalConfig(gc); // 3、数据源配置 DataSourceConfig dsc = new DataSourceConfig(); dsc.setUrl("jdbc:mysql://localhost:3306/srb_core?serverTimezone=GMT%2B8&characterEncoding=utf-8"); dsc.setDriverName("com.mysql.cj.jdbc.Driver"); dsc.setUsername("root"); dsc.setPassword("123456"); dsc.setDbType(DbType.MYSQL); mpg.setDataSource(dsc); // 4、包配置 PackageConfig pc = new PackageConfig(); pc.setParent("com.atguigu.srb.core"); pc.setEntity("pojo.entity"); //此对象与数据库表结构一一对应,通过 DAO 层向上传输数据源对象。 mpg.setPackageInfo(pc); // 5、策略配置 StrategyConfig strategy = new StrategyConfig(); strategy.setNaming(NamingStrategy.underline_to_camel);//数据库表映射到实体的命名策略 strategy.setColumnNaming(NamingStrategy.underline_to_camel);//数据库表字段映射到实体的命名策略 strategy.setEntityLombokModel(true); // lombok strategy.setLogicDeleteFieldName("is_deleted");//逻辑删除字段名 strategy.setEntityBooleanColumnRemoveIsPrefix(true);//去掉布尔值的is_前缀(确保tinyint(1)) strategy.setRestControllerStyle(true); //restful api风格控制器 mpg.setStrategy(strategy); // 6、执行 mpg.execute(); } }
六、启动应用程序
1、创建application.yml
server: port: 8110 # 服务端口 spring: profiles: active: dev # 环境设置 application: name: service-core # 服务名 datasource: # mysql数据库连接 type: com.zaxxer.hikari.HikariDataSource driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://localhost:3306/srb_core?serverTimezone=GMT%2B8&characterEncoding=utf-8 username: root password: 123456 mybatis-plus: #mybatis configuration: log-impl: org.apache.ibatis.logging.stdout.StdOutImpl mapper-locations: classpath:com/atguigu/srb/core/mapper/xml/*.xml
2、创建SpringBoot配置文件
在service-core中创建config包,创建MybatisPlusConfig类
Configuration
@MapperScan("com.atguigu.srb.core.mapper")
@EnableTransactionManagement //事务处理
public class MybatisPlusConfig {
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));//分页
return interceptor;
}
}
3、创建SpringBoot启动类
注意:扫描com.xiaoliu.system包上一层有助于,后期添加其他配置
@SpringBootApplication
@ComponentScan({"com.xiaoliu.system"})
public class ServiceCoreApplication {
public static void main(String[] args) {
SpringApplication.run(ServiceCoreApplication.class, args);
}
}
4、运行启动类
查看控制台8110端口是否成功启动
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。