项目2:后端管理员项目结构初始化

news/2024/11/30 10:36:30/

项目2:后端管理员项目结构初始化

1.创建数据库和表

2.初始化父项目

3.初始化项目模块

4.初始化core核心模块(代码生成器)

项目2:后端管理员项目结构初始化

1.创建表

  • 创建数据库

在这里插入图片描述
编码使用utf-8

  • sql语句
/*Navicat Premium Data TransferSource Server         : localhostSource Server Type    : MySQLSource Server Version : 50721Source Host           : localhost:3306Source Schema         : srb_coreTarget Server Type    : MySQLTarget Server Version : 50721File Encoding         : 65001Date: 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;
  • 注意设计表的规范
    is_deleted 逻辑删除
    create_time 创建时间
    update_time 更新时间

2.初始化父项目

  • 创建父项目
    在这里插入图片描述

  • 删除src并且写父项目依赖管理


<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>com.atguigu</groupId><artifactId>srb</artifactId><packaging>pom</packaging><version>1.0-SNAPSHOT</version><modules><module>guigu-common</module><module>service-base</module><module>service-core</module></modules><parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.3.4.RELEASE</version></parent><properties><java.version>1.8</java.version><mysql-connector-java.version>5.1.32</mysql-connector-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><dependencyManagement><dependencies><!--mysql--><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><version>${mysql-connector-java.version}</version></dependency><!--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>
</project>

3.初始化项目模块

①初始化三个项目

  • common是抽取出的方法,base是共同的配置,core是核心处理业务

在这里插入图片描述

②三个项目引入依赖

  • common
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"><parent><artifactId>srb</artifactId><groupId>com.atguigu</groupId><version>1.0-SNAPSHOT</version></parent><modelVersion>4.0.0</modelVersion><artifactId>guigu-common</artifactId><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>
</project>
  • base
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"><parent><artifactId>srb</artifactId><groupId>com.atguigu</groupId><version>1.0-SNAPSHOT</version></parent><modelVersion>4.0.0</modelVersion><artifactId>service-base</artifactId><dependencies><dependency><groupId>com.atguigu</groupId><artifactId>guigu-common</artifactId><version>1.0-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></project>
  • core(代码生成器)
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"><parent><artifactId>srb</artifactId><groupId>com.atguigu</groupId><version>1.0-SNAPSHOT</version></parent><modelVersion>4.0.0</modelVersion><artifactId>service-core</artifactId><dependencies><dependency><groupId>com.atguigu</groupId><artifactId>service-base</artifactId><version>1.0-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>
</project>

4.初始化core核心模块(代码生成器)

①测试用例生成代码(mybatis-plus)

package com.atguigu.srb.core;import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.generator.AutoGenerator;
import com.baomidou.mybatisplus.generator.config.DataSourceConfig;
import com.baomidou.mybatisplus.generator.config.GlobalConfig;
import com.baomidou.mybatisplus.generator.config.PackageConfig;
import com.baomidou.mybatisplus.generator.config.StrategyConfig;
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
import org.junit.Test;public class CodeGenerator {@Testpublic 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("Likejin");//open等于true时,生成完代码后,打开资源管理器gc.setOpen(false); //生成后是否打开资源管理器//去掉service接口前缀Igc.setServiceName("%sService");	//去掉Service接口的首字母I//自增策略gc.setIdType(IdType.AUTO); //主键策略//自动生成接口文档@APIgc.setSwagger2(true);//开启Swagger2模式mpg.setGlobalConfig(gc);// 3、数据源配置DataSourceConfig dsc = new DataSourceConfig();dsc.setUrl("jdbc:mysql://localhost:13306/db200921_srb_core?useUnicode=true&characterEncoding=utf8&useSSL=false");dsc.setDriverName("com.mysql.jdbc.Driver");dsc.setUsername("root");dsc.setPassword("abc123");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);//数据库表字段映射到实体的命名策略//使用lombok的注解修饰strategy.setEntityLombokModel(true); // lombok//生成逻辑删除字段名strategy.setLogicDeleteFieldName("is_deleted");//逻辑删除字段名//符合阿里巴巴规范,去掉is前缀strategy.setEntityBooleanColumnRemoveIsPrefix(true);//去掉布尔值的is_前缀(确保tinyint(1))//和controller的生成有关,全部使用@RestControllerstrategy.setRestControllerStyle(true); //restful api风格控制器,restController返回json数据mpg.setStrategy(strategy);// 6、执行mpg.execute();}
}

②配置application.yml

server:port: 8110 # 服务端口
spring:profiles:active: dev # 环境设置application:name: service-core # 服务名datasource: # mysql数据库连接type: com.zaxxer.hikari.HikariDataSourcedriver-class-name: com.mysql.jdbc.Driverurl: jdbc:mysql://localhost:13306/db200921_srb_core?useUnicode=true&characterEncoding=utf8&useSSL=falseusername: rootpassword: abc123mybatis-plus: #mybatisconfiguration:log-impl: org.apache.ibatis.logging.stdout.StdOutImplmapper-locations: classpath:com/atguigu/srb/core/mapper/xml/*.xml

③配置主启动

package com.atguigu.srb.core;import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;@SpringBootApplication
//项目直接的互相调用,可以直接扫描到(不要写到具体包下,写到项目下即可)
@ComponentScan({"com.atguigu.srb"})
public class ServiceCoreApplication {public static void main(String[] args) {SpringApplication.run(ServiceCoreApplication.class, args);}
}

④配置mybatis-plus分页插件

package com.atguigu.srb.core.config;import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;@Configuration
@MapperScan("com.atguigu.srb.core.mapper")
//开启事务处理
@EnableTransactionManagement //事务处理
public class MybatisPlusConfig {@Beanpublic MybatisPlusInterceptor mybatisPlusInterceptor() {MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));//分页return interceptor;}
}

未更新

未更新

未更新

未更新

未更新

未更新

未更新

未更新

未更新

未更新


http://www.ppmy.cn/news/40561.html

相关文章

Leetcode.1019 链表中的下一个更大节点

题目链接 Leetcode.1019 链表中的下一个更大节点 Rating &#xff1a; 1571 题目描述 给定一个长度为 n 的链表 head 对于列表中的每个节点&#xff0c;查找下一个 更大节点 的值。也就是说&#xff0c;对于每个节点&#xff0c;找到它旁边的第一个节点的值&#xff0c;这个节…

Unity3D: Mesh切割算法详解

Unity3D是一款非常流行的游戏开发引擎&#xff0c;支持多种平台和多种语言。在Unity3D中&#xff0c;Mesh是游戏中最常用的3D模型表示方法&#xff0c;它由一系列的点、线、面组成。在游戏中&#xff0c;我们经常需要对Mesh进行一些特殊的操作&#xff0c;比如切割&#xff0c;…

《Advanced R》学习笔记 | Chapter2 Names and values

专注系列化、高质量的R语言教程推文索引 | 联系小编 | 付费合集Advanced R是R语言大神Hadley Wickham写的一本书&#xff0c;主要介绍R语言底层的运行原理&#xff0c;帮助用户从R User转变为R Programmer。该书最新版为第二版&#xff0c;网页版地址为&#xff1a;https://adv…

AD GND整体做铺铜

在机械一层Mechanical 选择边框全选 层属性变更 发现问题。铜皮于边框太近了 解决

网络中的一些基本概念

组建网络的重要设备 集线器,交换机(组建局域网,不能跨局域网组建网络),路由器(wifi本质上是无线路由器,路由器的本质的把俩个局域网给连起来) 网络通信的一些基础概念 IP地址 标识了网络设备所在的位置 端口号 标识了一个具体的应用程序 协议 协议是网络通信的概念,约定好…

使用开发者工具等跳过付费墙

使用开发者工具等方法跳过付费墙 参考于&#xff1a; https://bbarrows.com/posts/how-to-get-around-paywalls-with-debug-tools Everyone Hates Paywalls 每个人都讨厌付费墙 像csdx网站&#xff0c;不登录看不到之后的内容 下面是一些方法跳过付费墙 (1) 视图滚动 Chrome…

TypeScript(八)装饰器

目录 前言 定义 类装饰器 基本用法 操作方式 操作类的原型 类继承操作 方法装饰器 属性装饰器 存取器装饰器 参数装饰器 基本用法 参数过滤器 元数据函数实现 参数过滤 效果实践 装饰器优先级 相同装饰器 不同装饰器 装饰器工厂 hooks与class兼容 结语 …

利用多专家模型解决长尾识别任务

来源&#xff1a;投稿 作者&#xff1a;TransforMe 编辑&#xff1a;学姐 贡献 提出了RoutIng Diverse Experts&#xff08;RIDE&#xff09;&#xff0c;不仅可以减少所有类别的variance&#xff0c;并且还可以减少尾部类的bias。同时提升了头部和尾部的性能。 思路 目前存…