diff --git a/.gitignore b/.gitignore index 3f1b749b2286cb8763ff942d29ba03179cc45f16..c8324597fc7c88bdca61a2268c39580e7d64a9e2 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ *.ear target/ +# 防提交docker本地生成文件 # doc/deploy/docker-standalone/mysql doc/deploy/docker-standalone/nacos diff --git a/README.md b/README.md index 2314612a5b7fad18c7bff11d18a64da540aa2ff1..28e71f584c6f759b2d92ef736459b28cfbfcf74a 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ admin | matecloud| mate-system模块不能执行增删改请求 admin | matecloud123 | 不能执行增删改请求,如需全部权限加微信 matecloud 联系 ### 📌 版本演进 -核心中间件 | 2.5.8及以下 | 3.1.8 +核心中间件 | 2.5.8及以下 | 3.0.8+ ---|---|--- Spring Boot | 2.3.*.RELEASE | SpringBoot Spring Cloud | Hoxton SR* | SpringCloud @@ -151,7 +151,7 @@ matecloud -- 父项目,各模块分离,方便集成和微服务 vip.mate mate-starter-dependencies - 3.0.8 + 3.1.8 pom import diff --git a/doc/sql/gen_table.sql b/doc/sql/gen_table.sql deleted file mode 100644 index 47bb756c2174acb2cb31759e3d7ced106d0cced2..0000000000000000000000000000000000000000 --- a/doc/sql/gen_table.sql +++ /dev/null @@ -1,279 +0,0 @@ -/* - Navicat Premium Data Transfer - - Source Server : 腾讯云mysql - Source Server Type : MySQL - Source Server Version : 50728 - Source Host : - Source Schema : mate - - Target Server Type : MySQL - Target Server Version : 50728 - File Encoding : 65001 - - Date: 23/02/2021 17:24:06 -*/ - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for gen_table --- ---------------------------- -DROP TABLE IF EXISTS `gen_table`; -CREATE TABLE `gen_table` ( - `table_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号', - `table_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '表名称', - `table_comment` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '表描述', - `sub_table_name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '关联子表的表名', - `sub_table_fk_name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '子表关联的外键名', - `class_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '实体类名称', - `tpl_category` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 'crud' COMMENT '使用的模板(crud单表操作 tree树表操作 sub主子表操作)', - `package_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '生成包路径', - `module_name` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '生成模块名', - `business_name` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '生成业务名', - `function_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '生成功能名', - `function_author` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '生成功能作者', - `gen_type` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '生成代码方式(0zip压缩包 1自定义路径)', - `gen_path` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '/' COMMENT '生成路径(不填默认项目路径)', - `options` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '其它生成选项', - `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者', - `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', - `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者', - `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', - `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注', - PRIMARY KEY (`table_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 26 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '代码生成业务表' ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of gen_table --- ---------------------------- -INSERT INTO `gen_table` VALUES (11, 'data_source', '数据源表', NULL, NULL, 'DataSource', 'crud', 'com.ruoyi.system1', 'system', 'source', '数据源', 'ruoyi', '1', '/111', '{\"parentMenuId\":\"1101\"}', 'admin', '2021-01-26 17:48:22', '', '2021-01-27 15:51:30', NULL); -INSERT INTO `gen_table` VALUES (13, 'duben_doc', '读本文档', NULL, NULL, 'DubenDoc', 'crud', 'com.ruoyi.system', 'system', 'doc', '读本文档', 'ruoyi', '0', '/', NULL, 'admin', '2021-01-27 11:41:56', '', NULL, NULL); -INSERT INTO `gen_table` VALUES (14, 'duben_set', '读本集', NULL, NULL, 'DubenSet', 'crud', 'com.ruoyi.system', 'system', 'set', '读本集', 'ruoyi', '0', '/', NULL, 'admin', '2021-01-27 11:42:34', '', NULL, NULL); -INSERT INTO `gen_table` VALUES (15, 'sys_api', '系统接口表', 'data_source', 'id', 'SysApi', 'sub', 'com.jeeos.test', 'system', 'api', '系统接口', 'ruoyi', '0', '/', '{}', 'admin', '2021-01-27 11:43:29', '', '2021-02-18 16:47:52', NULL); -INSERT INTO `gen_table` VALUES (16, 'sys_client', '客户端表', NULL, NULL, 'SysClient', 'crud', 'com.ruoyi.system', 'system', 'client', '客户端', 'ruoyi', '0', '/', NULL, 'admin', '2021-01-27 11:43:45', '', NULL, NULL); -INSERT INTO `gen_table` VALUES (17, 'sys_config', '配置表', NULL, NULL, 'SysConfig', 'crud', 'com.ruoyi.system', 'system', 'config', '配置', 'ruoyi', '0', '/', NULL, 'admin', '2021-01-27 11:43:46', '', NULL, NULL); -INSERT INTO `gen_table` VALUES (18, 'sys_data_source', '数据源表', NULL, NULL, 'SysDataSource', 'crud', 'com.ruoyi.system', 'system', 'source', '数据源', 'ruoyi', '0', '/', NULL, 'admin', '2021-01-27 11:43:47', '', NULL, NULL); -INSERT INTO `gen_table` VALUES (19, 'sys_log', '系统日志表', NULL, NULL, 'SysLog', 'crud', 'com.ruoyi.system', 'system', 'log', '系统日志', 'ruoyi', '0', '/', NULL, 'admin', '2021-01-27 11:44:10', '', NULL, NULL); -INSERT INTO `gen_table` VALUES (20, 'sys_attachment', '附件表', NULL, NULL, 'SysAttachment', 'crud', 'com.ruoyi.system', 'system', 'attachment', '附件', 'ruoyi', '0', '/', NULL, 'admin', '2021-01-27 16:17:51', '', NULL, NULL); -INSERT INTO `gen_table` VALUES (21, 'sys_dept', '组织机构表', NULL, NULL, 'SysDept', 'tree', 'com.jeeos.test', 'system', 'dept', '组织机构', 'ruoyi', '0', '/', '{\"treeCode\":\"id\",\"treeName\":\"name\",\"treeParentCode\":\"parent_id\"}', 'admin', '2021-01-27 16:17:52', '', '2021-02-19 15:59:08', NULL); -INSERT INTO `gen_table` VALUES (22, 'sys_role', '角色表', NULL, NULL, 'SysRole', 'crud', 'com.ruoyi.system', 'system', 'role', '角色', 'ruoyi', '0', '/', NULL, 'admin', '2021-01-27 16:18:04', '', NULL, NULL); -INSERT INTO `gen_table` VALUES (23, 'sys_role_dept', '角色和部门关联表', NULL, NULL, 'SysRoleDept', 'crud', 'com.ruoyi.system', 'system', 'dept', '角色和部门关联', 'ruoyi', '0', '/', NULL, 'admin', '2021-01-27 16:18:05', '', NULL, NULL); -INSERT INTO `gen_table` VALUES (24, 'sys_role_permission', '角色权限表', NULL, NULL, 'SysRolePermission', 'crud', 'com.ruoyi.system', 'system', 'permission', '角色权限', 'ruoyi', '0', '/', NULL, 'admin', '2021-01-27 16:18:05', '', NULL, NULL); -INSERT INTO `gen_table` VALUES (25, 'sys_menu', '菜单权限表', NULL, NULL, 'SysMenu', 'tree', 'generator.system', 'system', 'menu', '菜单权限', 'ruoyi', '0', '/', '{\"treeCode\":\"id\",\"treeName\":\"name\",\"treeParentCode\":\"parent_id\"}', 'admin', '2021-02-02 15:45:48', '', '2021-02-02 15:52:38', NULL); - --- ---------------------------- --- Table structure for gen_table_column --- ---------------------------- -DROP TABLE IF EXISTS `gen_table_column`; -CREATE TABLE `gen_table_column` ( - `column_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号', - `table_id` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '归属表编号', - `column_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '列名称', - `column_comment` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '列描述', - `column_type` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '列类型', - `java_type` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'JAVA类型', - `java_field` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'JAVA字段名', - `is_pk` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '是否主键(1是)', - `is_increment` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '是否自增(1是)', - `is_required` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '是否必填(1是)', - `is_insert` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '是否为插入字段(1是)', - `is_edit` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '是否编辑字段(1是)', - `is_list` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '是否列表字段(1是)', - `is_query` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '是否查询字段(1是)', - `query_type` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 'EQ' COMMENT '查询方式(等于、不等于、大于、小于、范围)', - `html_type` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '显示类型(文本框、文本域、下拉框、复选框、单选框、日期控件)', - `dict_type` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '字典类型', - `sort` int(11) NULL DEFAULT NULL COMMENT '排序', - `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者', - `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', - `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者', - `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', - PRIMARY KEY (`column_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 320 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '代码生成业务表字段' ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of gen_table_column --- ---------------------------- -INSERT INTO `gen_table_column` VALUES (129, '11', 'id', '自增id', 'int(11)', 'Long', 'id', '1', '1', NULL, '1', NULL, NULL, NULL, 'EQ', 'input', '4', 1, 'admin', '2021-01-26 17:48:22', '', '2021-01-27 15:51:30'); -INSERT INTO `gen_table_column` VALUES (130, '11', 'name', '名称', 'varchar(100)', 'String', 'name', '0', '0', NULL, '1', '1', '1', '1', 'LIKE', 'input', '', 2, 'admin', '2021-01-26 17:48:23', '', '2021-01-27 15:51:30'); -INSERT INTO `gen_table_column` VALUES (131, '11', 'driver_class', '驱动类', 'varchar(100)', 'String', 'driverClass', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 3, 'admin', '2021-01-26 17:48:23', '', '2021-01-27 15:51:30'); -INSERT INTO `gen_table_column` VALUES (132, '11', 'url', '连接地址', 'varchar(500)', 'String', 'url', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'textarea', '', 4, 'admin', '2021-01-26 17:48:23', '', '2021-01-27 15:51:30'); -INSERT INTO `gen_table_column` VALUES (133, '11', 'username', '用户名', 'varchar(50)', 'String', 'username', '0', '0', NULL, '1', '1', '1', '1', 'LIKE', 'input', '', 5, 'admin', '2021-01-26 17:48:23', '', '2021-01-27 15:51:30'); -INSERT INTO `gen_table_column` VALUES (134, '11', 'password', '密码', 'varchar(50)', 'String', 'password', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 6, 'admin', '2021-01-26 17:48:23', '', '2021-01-27 15:51:30'); -INSERT INTO `gen_table_column` VALUES (135, '11', 'remark', '备注', 'varchar(255)', 'String', 'remark', '0', '0', NULL, '1', '1', '1', NULL, 'EQ', 'input', '', 7, 'admin', '2021-01-26 17:48:23', '', '2021-01-27 15:51:30'); -INSERT INTO `gen_table_column` VALUES (136, '11', 'status', '状态', 'tinyint(1)', 'Integer', 'status', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'radio', '', 8, 'admin', '2021-01-26 17:48:23', '', '2021-01-27 15:51:31'); -INSERT INTO `gen_table_column` VALUES (137, '11', 'created_at', '创建时间', 'datetime', 'Date', 'createdAt', '0', '0', '1', '1', '1', '1', '1', 'EQ', 'datetime', '', 9, 'admin', '2021-01-26 17:48:23', '', '2021-01-27 15:51:31'); -INSERT INTO `gen_table_column` VALUES (138, '11', 'updated_at', '更新时间', 'datetime', 'Date', 'updatedAt', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'datetime', '', 10, 'admin', '2021-01-26 17:48:24', '', '2021-01-27 15:51:31'); -INSERT INTO `gen_table_column` VALUES (139, '11', 'deleted_at', '删除时间', 'datetime', 'Date', 'deletedAt', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'datetime', '', 11, 'admin', '2021-01-26 17:48:24', '', '2021-01-27 15:51:31'); -INSERT INTO `gen_table_column` VALUES (140, '11', 'is_deleted', '逻辑删除', 'tinyint(1)', 'Integer', 'isDeleted', '0', '0', '1', '1', '1', '1', '1', 'EQ', 'input', '', 12, 'admin', '2021-01-26 17:48:24', '', '2021-01-27 15:51:31'); -INSERT INTO `gen_table_column` VALUES (153, '13', 'id', '文档id', 'bigint(20)', 'Long', 'id', '1', '1', NULL, '1', NULL, NULL, NULL, 'EQ', 'input', '', 1, 'admin', '2021-01-27 11:41:57', '', NULL); -INSERT INTO `gen_table_column` VALUES (154, '13', 'set_id', NULL, 'bigint(20)', 'Long', 'setId', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 2, 'admin', '2021-01-27 11:41:57', '', NULL); -INSERT INTO `gen_table_column` VALUES (155, '13', 'parent_id', '父文档id', 'bigint(20)', 'Long', 'parentId', '0', '0', '1', '1', '1', '1', '1', 'EQ', 'input', '', 3, 'admin', '2021-01-27 11:41:57', '', NULL); -INSERT INTO `gen_table_column` VALUES (156, '13', 'title', '文档标题', 'varchar(255)', 'String', 'title', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 4, 'admin', '2021-01-27 11:41:57', '', NULL); -INSERT INTO `gen_table_column` VALUES (157, '13', 'price', '文档价格', 'decimal(10,2)', 'BigDecimal', 'price', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 5, 'admin', '2021-01-27 11:41:57', '', NULL); -INSERT INTO `gen_table_column` VALUES (158, '13', 'origin_price', '原始价格', 'decimal(10,2)', 'BigDecimal', 'originPrice', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 6, 'admin', '2021-01-27 11:41:57', '', NULL); -INSERT INTO `gen_table_column` VALUES (159, '13', 'doc_context', '文档内容', 'text', 'String', 'docContext', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'textarea', '', 7, 'admin', '2021-01-27 11:41:57', '', NULL); -INSERT INTO `gen_table_column` VALUES (160, '13', 'del_flag', '删除标识', 'char(1)', 'String', 'delFlag', '0', '0', NULL, '1', NULL, NULL, NULL, 'EQ', 'input', '', 8, 'admin', '2021-01-27 11:41:57', '', NULL); -INSERT INTO `gen_table_column` VALUES (161, '13', 'create_by', '创建人', 'varchar(32)', 'String', 'createBy', '0', '0', NULL, '1', NULL, NULL, NULL, 'EQ', 'input', '', 9, 'admin', '2021-01-27 11:41:57', '', NULL); -INSERT INTO `gen_table_column` VALUES (162, '13', 'update_by', '更新人', 'varchar(32)', 'String', 'updateBy', '0', '0', NULL, '1', '1', NULL, NULL, 'EQ', 'input', '', 10, 'admin', '2021-01-27 11:41:57', '', NULL); -INSERT INTO `gen_table_column` VALUES (163, '13', 'create_time', '创建时间', 'datetime', 'Date', 'createTime', '0', '0', '1', '1', NULL, NULL, NULL, 'EQ', 'datetime', '', 11, 'admin', '2021-01-27 11:41:57', '', NULL); -INSERT INTO `gen_table_column` VALUES (164, '13', 'update_time', '更新时间', 'datetime', 'Date', 'updateTime', '0', '0', '1', '1', '1', NULL, NULL, 'EQ', 'datetime', '', 12, 'admin', '2021-01-27 11:41:57', '', NULL); -INSERT INTO `gen_table_column` VALUES (165, '14', 'id', '文档集id', 'bigint(20)', 'Long', 'id', '1', '1', NULL, '1', NULL, NULL, NULL, 'EQ', 'input', '', 1, 'admin', '2021-01-27 11:42:34', '', NULL); -INSERT INTO `gen_table_column` VALUES (166, '14', 'title', '标题', 'varchar(255)', 'String', 'title', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 2, 'admin', '2021-01-27 11:42:34', '', NULL); -INSERT INTO `gen_table_column` VALUES (167, '14', 'sub_title', '子标题', 'varchar(255)', 'String', 'subTitle', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 3, 'admin', '2021-01-27 11:42:34', '', NULL); -INSERT INTO `gen_table_column` VALUES (168, '14', 'price', '文档价格', 'decimal(10,2)', 'BigDecimal', 'price', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 4, 'admin', '2021-01-27 11:42:34', '', NULL); -INSERT INTO `gen_table_column` VALUES (169, '14', 'origin_price', '原始价格', 'decimal(10,2)', 'BigDecimal', 'originPrice', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 5, 'admin', '2021-01-27 11:42:35', '', NULL); -INSERT INTO `gen_table_column` VALUES (170, '14', 'image', '集照片', 'varchar(255)', 'String', 'image', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'imageUpload', '', 6, 'admin', '2021-01-27 11:42:35', '', NULL); -INSERT INTO `gen_table_column` VALUES (171, '14', 'summary', '集摘要', 'varchar(255)', 'String', 'summary', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 7, 'admin', '2021-01-27 11:42:35', '', NULL); -INSERT INTO `gen_table_column` VALUES (172, '14', 'del_flag', '删除标识', 'char(1)', 'String', 'delFlag', '0', '0', NULL, '1', NULL, NULL, NULL, 'EQ', 'input', '', 8, 'admin', '2021-01-27 11:42:35', '', NULL); -INSERT INTO `gen_table_column` VALUES (173, '14', 'create_by', '创建人', 'varchar(32)', 'String', 'createBy', '0', '0', NULL, '1', NULL, NULL, NULL, 'EQ', 'input', '', 9, 'admin', '2021-01-27 11:42:35', '', NULL); -INSERT INTO `gen_table_column` VALUES (174, '14', 'update_by', '更新人', 'varchar(32)', 'String', 'updateBy', '0', '0', NULL, '1', '1', NULL, NULL, 'EQ', 'input', '', 10, 'admin', '2021-01-27 11:42:35', '', NULL); -INSERT INTO `gen_table_column` VALUES (175, '14', 'create_time', '创建时间', 'datetime', 'Date', 'createTime', '0', '0', '1', '1', NULL, NULL, NULL, 'EQ', 'datetime', '', 11, 'admin', '2021-01-27 11:42:35', '', NULL); -INSERT INTO `gen_table_column` VALUES (176, '14', 'update_time', '更新时间', 'datetime', 'Date', 'updateTime', '0', '0', '1', '1', '1', NULL, NULL, 'EQ', 'datetime', '', 12, 'admin', '2021-01-27 11:42:35', '', NULL); -INSERT INTO `gen_table_column` VALUES (177, '15', 'id', '主键id', 'bigint(20)', 'Long', 'id', '1', '1', NULL, '1', NULL, NULL, NULL, 'EQ', 'input', '', 1, 'admin', '2021-01-27 11:43:29', '', '2021-02-18 16:47:52'); -INSERT INTO `gen_table_column` VALUES (178, '15', 'code', '接口编码', 'varchar(255)', 'String', 'code', '0', '0', '1', '1', '1', '1', '1', 'EQ', 'input', '', 2, 'admin', '2021-01-27 11:43:29', '', '2021-02-18 16:47:52'); -INSERT INTO `gen_table_column` VALUES (179, '15', 'name', '接口名称', 'varchar(100)', 'String', 'name', '0', '0', NULL, '1', '1', '1', '1', 'LIKE', 'input', '', 3, 'admin', '2021-01-27 11:43:29', '', '2021-02-18 16:47:52'); -INSERT INTO `gen_table_column` VALUES (180, '15', 'notes', '接口描述', 'varchar(200)', 'String', 'notes', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 4, 'admin', '2021-01-27 11:43:29', '', '2021-02-18 16:47:53'); -INSERT INTO `gen_table_column` VALUES (181, '15', 'method', '请求方法', 'varchar(20)', 'String', 'method', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 5, 'admin', '2021-01-27 11:43:29', '', '2021-02-18 16:47:53'); -INSERT INTO `gen_table_column` VALUES (182, '15', 'class_name', '类名', 'varchar(255)', 'String', 'className', '0', '0', NULL, '1', '1', '1', '1', 'LIKE', 'input', '', 6, 'admin', '2021-01-27 11:43:29', '', '2021-02-18 16:47:53'); -INSERT INTO `gen_table_column` VALUES (183, '15', 'method_name', '方法名', 'varchar(100)', 'String', 'methodName', '0', '0', NULL, '1', '1', '1', '1', 'LIKE', 'input', '', 7, 'admin', '2021-01-27 11:43:29', '', '2021-02-18 16:47:53'); -INSERT INTO `gen_table_column` VALUES (184, '15', 'path', '请求路径', 'varchar(255)', 'String', 'path', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 8, 'admin', '2021-01-27 11:43:29', '', '2021-02-18 16:47:53'); -INSERT INTO `gen_table_column` VALUES (185, '15', 'content_type', '响应类型', 'varchar(100)', 'String', 'contentType', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'select', '', 9, 'admin', '2021-01-27 11:43:30', '', '2021-02-18 16:47:53'); -INSERT INTO `gen_table_column` VALUES (186, '15', 'service_id', '服务ID', 'varchar(100)', 'String', 'serviceId', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 10, 'admin', '2021-01-27 11:43:30', '', '2021-02-18 16:47:53'); -INSERT INTO `gen_table_column` VALUES (187, '15', 'status', 'API状态:0:禁用 1:启用', 'char(1)', 'String', 'status', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'radio', '', 11, 'admin', '2021-01-27 11:43:30', '', '2021-02-18 16:47:53'); -INSERT INTO `gen_table_column` VALUES (188, '15', 'auth', '是否认证:0:不认证 1:认证', 'char(1)', 'String', 'auth', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 12, 'admin', '2021-01-27 11:43:30', '', '2021-02-18 16:47:53'); -INSERT INTO `gen_table_column` VALUES (189, '15', 'permission', '菜单权限', 'varchar(32)', 'String', 'permission', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 13, 'admin', '2021-01-27 11:43:30', '', '2021-02-18 16:47:53'); -INSERT INTO `gen_table_column` VALUES (190, '15', 'create_by', '创建人', 'varchar(32)', 'String', 'createBy', '0', '0', NULL, '1', NULL, NULL, NULL, 'EQ', 'input', '', 14, 'admin', '2021-01-27 11:43:30', '', '2021-02-18 16:47:53'); -INSERT INTO `gen_table_column` VALUES (191, '15', 'update_by', '更新人', 'varchar(32)', 'String', 'updateBy', '0', '0', NULL, '1', '1', NULL, NULL, 'EQ', 'input', '', 15, 'admin', '2021-01-27 11:43:30', '', '2021-02-18 16:47:53'); -INSERT INTO `gen_table_column` VALUES (192, '15', 'create_time', '创建时间', 'datetime', 'Date', 'createTime', '0', '0', '1', '1', NULL, NULL, NULL, 'EQ', 'datetime', '', 16, 'admin', '2021-01-27 11:43:30', '', '2021-02-18 16:47:53'); -INSERT INTO `gen_table_column` VALUES (193, '15', 'update_time', '更新时间', 'datetime', 'Date', 'updateTime', '0', '0', NULL, '1', '1', NULL, NULL, 'EQ', 'datetime', '', 17, 'admin', '2021-01-27 11:43:30', '', '2021-02-18 16:47:54'); -INSERT INTO `gen_table_column` VALUES (194, '15', 'is_deleted', '删除标识', 'char(1)', 'String', 'isDeleted', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 18, 'admin', '2021-01-27 11:43:30', '', '2021-02-18 16:47:54'); -INSERT INTO `gen_table_column` VALUES (195, '15', 'tenant_id', '租户ID', 'int(11)', 'Long', 'tenantId', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 19, 'admin', '2021-01-27 11:43:30', '', '2021-02-18 16:47:54'); -INSERT INTO `gen_table_column` VALUES (196, '16', 'id', '主键', 'bigint(64)', 'Long', 'id', '1', '1', NULL, '1', NULL, NULL, NULL, 'EQ', 'input', '', 1, 'admin', '2021-01-27 11:43:45', '', NULL); -INSERT INTO `gen_table_column` VALUES (197, '16', 'client_id', '客户端id', 'varchar(48)', 'String', 'clientId', '0', '0', '1', '1', '1', '1', '1', 'EQ', 'input', '', 2, 'admin', '2021-01-27 11:43:45', '', NULL); -INSERT INTO `gen_table_column` VALUES (198, '16', 'client_secret', '客户端密钥', 'varchar(256)', 'String', 'clientSecret', '0', '0', '1', '1', '1', '1', '1', 'EQ', 'input', '', 3, 'admin', '2021-01-27 11:43:45', '', NULL); -INSERT INTO `gen_table_column` VALUES (199, '16', 'resource_ids', '资源集合', 'varchar(256)', 'String', 'resourceIds', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 4, 'admin', '2021-01-27 11:43:45', '', NULL); -INSERT INTO `gen_table_column` VALUES (200, '16', 'scope', '授权范围', 'varchar(256)', 'String', 'scope', '0', '0', '1', '1', '1', '1', '1', 'EQ', 'input', '', 5, 'admin', '2021-01-27 11:43:45', '', NULL); -INSERT INTO `gen_table_column` VALUES (201, '16', 'authorized_grant_types', '授权类型', 'varchar(256)', 'String', 'authorizedGrantTypes', '0', '0', '1', '1', '1', '1', '1', 'EQ', 'input', '', 6, 'admin', '2021-01-27 11:43:45', '', NULL); -INSERT INTO `gen_table_column` VALUES (202, '16', 'web_server_redirect_uri', '回调地址', 'varchar(256)', 'String', 'webServerRedirectUri', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 7, 'admin', '2021-01-27 11:43:45', '', NULL); -INSERT INTO `gen_table_column` VALUES (203, '16', 'authorities', '权限', 'varchar(256)', 'String', 'authorities', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 8, 'admin', '2021-01-27 11:43:45', '', NULL); -INSERT INTO `gen_table_column` VALUES (204, '16', 'access_token_validity', '令牌过期秒数', 'int(11)', 'Long', 'accessTokenValidity', '0', '0', '1', '1', '1', '1', '1', 'EQ', 'input', '', 9, 'admin', '2021-01-27 11:43:45', '', NULL); -INSERT INTO `gen_table_column` VALUES (205, '16', 'refresh_token_validity', '刷新令牌过期秒数', 'int(11)', 'Long', 'refreshTokenValidity', '0', '0', '1', '1', '1', '1', '1', 'EQ', 'input', '', 10, 'admin', '2021-01-27 11:43:45', '', NULL); -INSERT INTO `gen_table_column` VALUES (206, '16', 'additional_information', '附加说明', 'varchar(4096)', 'String', 'additionalInformation', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'textarea', '', 11, 'admin', '2021-01-27 11:43:46', '', NULL); -INSERT INTO `gen_table_column` VALUES (207, '16', 'autoapprove', '自动授权', 'varchar(256)', 'String', 'autoapprove', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 12, 'admin', '2021-01-27 11:43:46', '', NULL); -INSERT INTO `gen_table_column` VALUES (208, '16', 'create_by', '创建人', 'varchar(32)', 'String', 'createBy', '0', '0', NULL, '1', NULL, NULL, NULL, 'EQ', 'input', '', 13, 'admin', '2021-01-27 11:43:46', '', NULL); -INSERT INTO `gen_table_column` VALUES (209, '16', 'update_by', '更新人', 'varchar(32)', 'String', 'updateBy', '0', '0', NULL, '1', '1', NULL, NULL, 'EQ', 'input', '', 14, 'admin', '2021-01-27 11:43:46', '', NULL); -INSERT INTO `gen_table_column` VALUES (210, '16', 'create_time', '创建时间', 'datetime', 'Date', 'createTime', '0', '0', NULL, '1', NULL, NULL, NULL, 'EQ', 'datetime', '', 15, 'admin', '2021-01-27 11:43:46', '', NULL); -INSERT INTO `gen_table_column` VALUES (211, '16', 'update_time', '更新时间', 'datetime', 'Date', 'updateTime', '0', '0', NULL, '1', '1', NULL, NULL, 'EQ', 'datetime', '', 16, 'admin', '2021-01-27 11:43:46', '', NULL); -INSERT INTO `gen_table_column` VALUES (212, '16', 'status', '状态', 'char(1)', 'String', 'status', '0', '0', '1', '1', '1', '1', '1', 'EQ', 'radio', '', 17, 'admin', '2021-01-27 11:43:46', '', NULL); -INSERT INTO `gen_table_column` VALUES (213, '16', 'is_deleted', '是否已删除', 'int(2)', 'Integer', 'isDeleted', '0', '0', '1', '1', '1', '1', '1', 'EQ', 'input', '', 18, 'admin', '2021-01-27 11:43:46', '', NULL); -INSERT INTO `gen_table_column` VALUES (214, '17', 'id', '主键', 'bigint(64)', 'Long', 'id', '1', '1', NULL, '1', NULL, NULL, NULL, 'EQ', 'input', '', 1, 'admin', '2021-01-27 11:43:46', '', NULL); -INSERT INTO `gen_table_column` VALUES (215, '17', 'parent_id', '父主键', 'bigint(64)', 'Long', 'parentId', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 2, 'admin', '2021-01-27 11:43:46', '', NULL); -INSERT INTO `gen_table_column` VALUES (216, '17', 'code', '码', 'varchar(255)', 'String', 'code', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 3, 'admin', '2021-01-27 11:43:46', '', NULL); -INSERT INTO `gen_table_column` VALUES (217, '17', 'c_key', '值', 'varchar(255)', 'String', 'cKey', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 4, 'admin', '2021-01-27 11:43:46', '', NULL); -INSERT INTO `gen_table_column` VALUES (218, '17', 'value', '名称', 'varchar(255)', 'String', 'value', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 5, 'admin', '2021-01-27 11:43:47', '', NULL); -INSERT INTO `gen_table_column` VALUES (219, '17', 'sort', '排序', 'int(11)', 'Long', 'sort', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 6, 'admin', '2021-01-27 11:43:47', '', NULL); -INSERT INTO `gen_table_column` VALUES (220, '17', 'remark', '备注', 'varchar(255)', 'String', 'remark', '0', '0', NULL, '1', '1', '1', NULL, 'EQ', 'input', '', 7, 'admin', '2021-01-27 11:43:47', '', NULL); -INSERT INTO `gen_table_column` VALUES (221, '17', 'create_by', '创建人', 'varchar(32)', 'String', 'createBy', '0', '0', NULL, '1', NULL, NULL, NULL, 'EQ', 'input', '', 8, 'admin', '2021-01-27 11:43:47', '', NULL); -INSERT INTO `gen_table_column` VALUES (222, '17', 'update_by', '更新人', 'varchar(32)', 'String', 'updateBy', '0', '0', NULL, '1', '1', NULL, NULL, 'EQ', 'input', '', 9, 'admin', '2021-01-27 11:43:47', '', NULL); -INSERT INTO `gen_table_column` VALUES (223, '17', 'create_time', '创建时间', 'datetime', 'Date', 'createTime', '0', '0', NULL, '1', NULL, NULL, NULL, 'EQ', 'datetime', '', 10, 'admin', '2021-01-27 11:43:47', '', NULL); -INSERT INTO `gen_table_column` VALUES (224, '17', 'update_time', '修改时间', 'datetime', 'Date', 'updateTime', '0', '0', NULL, '1', '1', NULL, NULL, 'EQ', 'datetime', '', 11, 'admin', '2021-01-27 11:43:47', '', NULL); -INSERT INTO `gen_table_column` VALUES (225, '17', 'tenant_id', NULL, 'int(11)', 'Long', 'tenantId', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 12, 'admin', '2021-01-27 11:43:47', '', NULL); -INSERT INTO `gen_table_column` VALUES (226, '17', 'is_deleted', '是否已删除', 'int(2)', 'Integer', 'isDeleted', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 13, 'admin', '2021-01-27 11:43:47', '', NULL); -INSERT INTO `gen_table_column` VALUES (227, '18', 'id', '自增id', 'int(11)', 'Long', 'id', '1', '1', NULL, '1', NULL, NULL, NULL, 'EQ', 'input', '', 1, 'admin', '2021-01-27 11:43:47', '', NULL); -INSERT INTO `gen_table_column` VALUES (228, '18', 'name', '名称', 'varchar(100)', 'String', 'name', '0', '0', NULL, '1', '1', '1', '1', 'LIKE', 'input', '', 2, 'admin', '2021-01-27 11:43:47', '', NULL); -INSERT INTO `gen_table_column` VALUES (229, '18', 'db_type', '数据库类型', 'varchar(50)', 'String', 'dbType', '0', '0', '1', '1', '1', '1', '1', 'EQ', 'select', '', 3, 'admin', '2021-01-27 11:43:47', '', NULL); -INSERT INTO `gen_table_column` VALUES (230, '18', 'driver_class', '驱动类型', 'varchar(100)', 'String', 'driverClass', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 4, 'admin', '2021-01-27 11:43:48', '', NULL); -INSERT INTO `gen_table_column` VALUES (231, '18', 'url', '连接地址', 'varchar(500)', 'String', 'url', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'textarea', '', 5, 'admin', '2021-01-27 11:43:48', '', NULL); -INSERT INTO `gen_table_column` VALUES (232, '18', 'username', '用户名', 'varchar(50)', 'String', 'username', '0', '0', NULL, '1', '1', '1', '1', 'LIKE', 'input', '', 6, 'admin', '2021-01-27 11:43:48', '', NULL); -INSERT INTO `gen_table_column` VALUES (233, '18', 'password', '密码', 'varchar(50)', 'String', 'password', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 7, 'admin', '2021-01-27 11:43:48', '', NULL); -INSERT INTO `gen_table_column` VALUES (234, '18', 'remark', '备注', 'varchar(255)', 'String', 'remark', '0', '0', NULL, '1', '1', '1', NULL, 'EQ', 'input', '', 8, 'admin', '2021-01-27 11:43:48', '', NULL); -INSERT INTO `gen_table_column` VALUES (235, '18', 'status', '状态', 'tinyint(1)', 'Integer', 'status', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'radio', '', 9, 'admin', '2021-01-27 11:43:48', '', NULL); -INSERT INTO `gen_table_column` VALUES (236, '18', 'create_by', '创建人', 'varchar(32)', 'String', 'createBy', '0', '0', NULL, '1', NULL, NULL, NULL, 'EQ', 'input', '', 10, 'admin', '2021-01-27 11:43:48', '', NULL); -INSERT INTO `gen_table_column` VALUES (237, '18', 'update_by', '更新人', 'varchar(32)', 'String', 'updateBy', '0', '0', NULL, '1', '1', NULL, NULL, 'EQ', 'input', '', 11, 'admin', '2021-01-27 11:43:48', '', NULL); -INSERT INTO `gen_table_column` VALUES (238, '18', 'create_time', '创建时间', 'datetime', 'Date', 'createTime', '0', '0', NULL, '1', NULL, NULL, NULL, 'EQ', 'datetime', '', 12, 'admin', '2021-01-27 11:43:48', '', NULL); -INSERT INTO `gen_table_column` VALUES (239, '18', 'update_time', '更新时间', 'datetime', 'Date', 'updateTime', '0', '0', NULL, '1', '1', NULL, NULL, 'EQ', 'datetime', '', 13, 'admin', '2021-01-27 11:43:48', '', NULL); -INSERT INTO `gen_table_column` VALUES (240, '18', 'is_deleted', '逻辑删除', 'tinyint(1)', 'Integer', 'isDeleted', '0', '0', '1', '1', '1', '1', '1', 'EQ', 'input', '', 14, 'admin', '2021-01-27 11:43:48', '', NULL); -INSERT INTO `gen_table_column` VALUES (241, '19', 'id', '主键id', 'bigint(20)', 'Long', 'id', '1', '1', NULL, '1', NULL, NULL, NULL, 'EQ', 'input', '', 1, 'admin', '2021-01-27 11:44:10', '', NULL); -INSERT INTO `gen_table_column` VALUES (242, '19', 'type', '日志类型', 'char(1)', 'String', 'type', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'select', '', 2, 'admin', '2021-01-27 11:44:10', '', NULL); -INSERT INTO `gen_table_column` VALUES (243, '19', 'trace_id', '跟踪ID', 'varchar(64)', 'String', 'traceId', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 3, 'admin', '2021-01-27 11:44:10', '', NULL); -INSERT INTO `gen_table_column` VALUES (244, '19', 'title', '日志标题', 'varchar(64)', 'String', 'title', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 4, 'admin', '2021-01-27 11:44:10', '', NULL); -INSERT INTO `gen_table_column` VALUES (245, '19', 'operation', '操作内容', 'text', 'String', 'operation', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'textarea', '', 5, 'admin', '2021-01-27 11:44:10', '', NULL); -INSERT INTO `gen_table_column` VALUES (246, '19', 'method', '执行方法', 'varchar(64)', 'String', 'method', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 6, 'admin', '2021-01-27 11:44:10', '', NULL); -INSERT INTO `gen_table_column` VALUES (247, '19', 'params', '参数', 'text', 'String', 'params', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'textarea', '', 7, 'admin', '2021-01-27 11:44:10', '', NULL); -INSERT INTO `gen_table_column` VALUES (248, '19', 'url', '请求路径', 'varchar(128)', 'String', 'url', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 8, 'admin', '2021-01-27 11:44:10', '', NULL); -INSERT INTO `gen_table_column` VALUES (249, '19', 'ip', 'ip地址', 'varchar(64)', 'String', 'ip', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 9, 'admin', '2021-01-27 11:44:10', '', NULL); -INSERT INTO `gen_table_column` VALUES (250, '19', 'exception', NULL, 'text', 'String', 'exception', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'textarea', '', 10, 'admin', '2021-01-27 11:44:11', '', NULL); -INSERT INTO `gen_table_column` VALUES (251, '19', 'execute_time', '耗时', 'decimal(11,0)', 'Long', 'executeTime', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 11, 'admin', '2021-01-27 11:44:11', '', NULL); -INSERT INTO `gen_table_column` VALUES (252, '19', 'location', '地区', 'varchar(64)', 'String', 'location', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 12, 'admin', '2021-01-27 11:44:11', '', NULL); -INSERT INTO `gen_table_column` VALUES (253, '19', 'create_by', '创建人', 'varchar(32)', 'String', 'createBy', '0', '0', NULL, '1', NULL, NULL, NULL, 'EQ', 'input', '', 13, 'admin', '2021-01-27 11:44:11', '', NULL); -INSERT INTO `gen_table_column` VALUES (254, '19', 'update_by', '更新人', 'varchar(32)', 'String', 'updateBy', '0', '0', NULL, '1', '1', NULL, NULL, 'EQ', 'input', '', 14, 'admin', '2021-01-27 11:44:11', '', NULL); -INSERT INTO `gen_table_column` VALUES (255, '19', 'create_time', '创建时间', 'datetime', 'Date', 'createTime', '0', '0', '1', '1', NULL, NULL, NULL, 'EQ', 'datetime', '', 15, 'admin', '2021-01-27 11:44:11', '', NULL); -INSERT INTO `gen_table_column` VALUES (256, '19', 'update_time', '更新时间', 'datetime', 'Date', 'updateTime', '0', '0', NULL, '1', '1', NULL, NULL, 'EQ', 'datetime', '', 16, 'admin', '2021-01-27 11:44:11', '', NULL); -INSERT INTO `gen_table_column` VALUES (257, '19', 'is_deleted', '删除标识', 'char(1)', 'String', 'isDeleted', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 17, 'admin', '2021-01-27 11:44:11', '', NULL); -INSERT INTO `gen_table_column` VALUES (258, '19', 'tenant_id', '租户ID', 'int(11)', 'Long', 'tenantId', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 18, 'admin', '2021-01-27 11:44:11', '', NULL); -INSERT INTO `gen_table_column` VALUES (259, '20', 'id', '附件ID', 'bigint(20)', 'Long', 'id', '1', '1', NULL, '1', NULL, NULL, NULL, 'EQ', 'input', '', 1, 'admin', '2021-01-27 16:17:51', '', NULL); -INSERT INTO `gen_table_column` VALUES (260, '20', 'storage_id', '存储ID', 'bigint(20)', 'Long', 'storageId', '0', '0', '1', '1', '1', '1', '1', 'EQ', 'input', '', 2, 'admin', '2021-01-27 16:17:51', '', NULL); -INSERT INTO `gen_table_column` VALUES (261, '20', 'attachment_group_id', '组ID', 'int(11)', 'Long', 'attachmentGroupId', '0', '0', '1', '1', '1', '1', '1', 'EQ', 'input', '', 3, 'admin', '2021-01-27 16:17:51', '', NULL); -INSERT INTO `gen_table_column` VALUES (262, '20', 'name', '文件名称', 'varchar(128)', 'String', 'name', '0', '0', '1', '1', '1', '1', '1', 'LIKE', 'input', '', 4, 'admin', '2021-01-27 16:17:51', '', NULL); -INSERT INTO `gen_table_column` VALUES (263, '20', 'size', '文件大小', 'int(11)', 'Long', 'size', '0', '0', '1', '1', '1', '1', '1', 'EQ', 'input', '', 5, 'admin', '2021-01-27 16:17:51', '', NULL); -INSERT INTO `gen_table_column` VALUES (264, '20', 'url', '文件地址', 'varchar(2080)', 'String', 'url', '0', '0', '1', '1', '1', '1', '1', 'EQ', 'textarea', '', 6, 'admin', '2021-01-27 16:17:51', '', NULL); -INSERT INTO `gen_table_column` VALUES (265, '20', 'file_name', '上传文件名', 'varchar(200)', 'String', 'fileName', '0', '0', NULL, '1', '1', '1', '1', 'LIKE', 'input', '', 7, 'admin', '2021-01-27 16:17:51', '', NULL); -INSERT INTO `gen_table_column` VALUES (266, '20', 'thumb_url', '缩略图地址', 'varchar(2080)', 'String', 'thumbUrl', '0', '0', '1', '1', '1', '1', '1', 'EQ', 'textarea', '', 8, 'admin', '2021-01-27 16:17:51', '', NULL); -INSERT INTO `gen_table_column` VALUES (267, '20', 'type', '类型', 'tinyint(2)', 'Integer', 'type', '0', '0', '1', '1', '1', '1', '1', 'EQ', 'select', '', 9, 'admin', '2021-01-27 16:17:51', '', NULL); -INSERT INTO `gen_table_column` VALUES (268, '20', 'create_by', '创建人', 'varchar(32)', 'String', 'createBy', '0', '0', NULL, '1', NULL, NULL, NULL, 'EQ', 'input', '', 10, 'admin', '2021-01-27 16:17:51', '', NULL); -INSERT INTO `gen_table_column` VALUES (269, '20', 'update_by', '更新人', 'varchar(32)', 'String', 'updateBy', '0', '0', NULL, '1', '1', NULL, NULL, 'EQ', 'input', '', 11, 'admin', '2021-01-27 16:17:51', '', NULL); -INSERT INTO `gen_table_column` VALUES (270, '20', 'create_time', '创建时间', 'datetime', 'Date', 'createTime', '0', '0', NULL, '1', NULL, NULL, NULL, 'EQ', 'datetime', '', 12, 'admin', '2021-01-27 16:17:52', '', NULL); -INSERT INTO `gen_table_column` VALUES (271, '20', 'update_time', '修改时间', 'datetime', 'Date', 'updateTime', '0', '0', NULL, '1', '1', NULL, NULL, 'EQ', 'datetime', '', 13, 'admin', '2021-01-27 16:17:52', '', NULL); -INSERT INTO `gen_table_column` VALUES (272, '20', 'is_deleted', '删除标识', 'char(1)', 'String', 'isDeleted', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 14, 'admin', '2021-01-27 16:17:52', '', NULL); -INSERT INTO `gen_table_column` VALUES (273, '20', 'is_recycle', '是否加入回收站 0.否|1.是', 'tinyint(1)', 'Integer', 'isRecycle', '0', '0', '1', '1', '1', '1', '1', 'EQ', 'input', '', 15, 'admin', '2021-01-27 16:17:52', '', NULL); -INSERT INTO `gen_table_column` VALUES (274, '21', 'id', '部门ID', 'bigint(20)', 'Long', 'id', '1', '1', NULL, '1', NULL, NULL, NULL, 'EQ', 'input', '', 1, 'admin', '2021-01-27 16:17:52', '', '2021-02-19 15:59:08'); -INSERT INTO `gen_table_column` VALUES (275, '21', 'name', '部门名称', 'varchar(50)', 'String', 'name', '0', '0', NULL, '1', '1', '1', '1', 'LIKE', 'input', '', 2, 'admin', '2021-01-27 16:17:52', '', '2021-02-19 15:59:08'); -INSERT INTO `gen_table_column` VALUES (276, '21', 'sort', '排序', 'int(11)', 'Long', 'sort', '0', '0', '1', '1', '1', '1', '1', 'GT', 'input', 'status', 3, 'admin', '2021-01-27 16:17:52', '', '2021-02-19 15:59:08'); -INSERT INTO `gen_table_column` VALUES (277, '21', 'create_by', '创建人', 'varchar(32)', 'String', 'createBy', '0', '0', NULL, '1', NULL, NULL, NULL, 'EQ', 'input', '', 4, 'admin', '2021-01-27 16:17:52', '', '2021-02-19 15:59:08'); -INSERT INTO `gen_table_column` VALUES (278, '21', 'update_by', '更新人', 'varchar(32)', 'String', 'updateBy', '0', '0', NULL, '1', '1', NULL, NULL, 'EQ', 'input', '', 5, 'admin', '2021-01-27 16:17:52', '', '2021-02-19 15:59:08'); -INSERT INTO `gen_table_column` VALUES (279, '21', 'create_time', '创建时间', 'datetime', 'Date', 'createTime', '0', '0', NULL, '1', NULL, NULL, NULL, 'EQ', 'datetime', '', 6, 'admin', '2021-01-27 16:17:52', '', '2021-02-19 15:59:08'); -INSERT INTO `gen_table_column` VALUES (280, '21', 'update_time', '修改时间', 'datetime', 'Date', 'updateTime', '0', '0', NULL, '1', '1', NULL, NULL, 'EQ', 'datetime', '', 7, 'admin', '2021-01-27 16:17:52', '', '2021-02-19 15:59:08'); -INSERT INTO `gen_table_column` VALUES (281, '21', 'is_deleted', '删除标识', 'char(1)', 'String', 'isDeleted', '0', '0', NULL, '1', '1', '1', '1', 'BETWEEN', 'input', '', 8, 'admin', '2021-01-27 16:17:52', '', '2021-02-19 15:59:08'); -INSERT INTO `gen_table_column` VALUES (282, '21', 'parent_id', '上级ID', 'bigint(20)', 'Long', 'parentId', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 9, 'admin', '2021-01-27 16:17:53', '', '2021-02-19 15:59:08'); -INSERT INTO `gen_table_column` VALUES (283, '21', 'parent_ids', '上级ID集合', 'varchar(255)', 'String', 'parentIds', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 10, 'admin', '2021-01-27 16:17:53', '', '2021-02-19 15:59:08'); -INSERT INTO `gen_table_column` VALUES (284, '21', 'tenant_id', '租户ID', 'bigint(20)', 'Long', 'tenantId', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 11, 'admin', '2021-01-27 16:17:53', '', '2021-02-19 15:59:08'); -INSERT INTO `gen_table_column` VALUES (285, '22', 'id', '主键id', 'bigint(20)', 'Long', 'id', '1', '1', NULL, '1', NULL, NULL, NULL, 'EQ', 'input', '', 1, 'admin', '2021-01-27 16:18:04', '', NULL); -INSERT INTO `gen_table_column` VALUES (286, '22', 'role_name', '角色名称', 'varchar(64)', 'String', 'roleName', '0', '0', NULL, '1', '1', '1', '1', 'LIKE', 'input', '', 2, 'admin', '2021-01-27 16:18:04', '', NULL); -INSERT INTO `gen_table_column` VALUES (287, '22', 'role_code', '角色编码', 'varchar(64)', 'String', 'roleCode', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 3, 'admin', '2021-01-27 16:18:05', '', NULL); -INSERT INTO `gen_table_column` VALUES (288, '22', 'data_scope', '数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限 5:仅限自己插入的添加的数据)', 'char(1)', 'String', 'dataScope', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 4, 'admin', '2021-01-27 16:18:05', '', NULL); -INSERT INTO `gen_table_column` VALUES (289, '22', 'description', '描述', 'varchar(255)', 'String', 'description', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 5, 'admin', '2021-01-27 16:18:05', '', NULL); -INSERT INTO `gen_table_column` VALUES (290, '22', 'create_by', '创建人', 'varchar(32)', 'String', 'createBy', '0', '0', NULL, '1', NULL, NULL, NULL, 'EQ', 'input', '', 6, 'admin', '2021-01-27 16:18:05', '', NULL); -INSERT INTO `gen_table_column` VALUES (291, '22', 'update_by', '更新人', 'varchar(32)', 'String', 'updateBy', '0', '0', NULL, '1', '1', NULL, NULL, 'EQ', 'input', '', 7, 'admin', '2021-01-27 16:18:05', '', NULL); -INSERT INTO `gen_table_column` VALUES (292, '22', 'create_time', '创建时间', 'datetime', 'Date', 'createTime', '0', '0', '1', '1', NULL, NULL, NULL, 'EQ', 'datetime', '', 8, 'admin', '2021-01-27 16:18:05', '', NULL); -INSERT INTO `gen_table_column` VALUES (293, '22', 'update_time', '更新时间', 'datetime', 'Date', 'updateTime', '0', '0', NULL, '1', '1', NULL, NULL, 'EQ', 'datetime', '', 9, 'admin', '2021-01-27 16:18:05', '', NULL); -INSERT INTO `gen_table_column` VALUES (294, '22', 'is_deleted', '删除标识', 'char(1)', 'String', 'isDeleted', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 10, 'admin', '2021-01-27 16:18:05', '', NULL); -INSERT INTO `gen_table_column` VALUES (295, '22', 'tenant_id', '租户ID', 'int(11)', 'Long', 'tenantId', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 11, 'admin', '2021-01-27 16:18:05', '', NULL); -INSERT INTO `gen_table_column` VALUES (296, '23', 'role_id', '角色ID', 'bigint(20)', 'Long', 'roleId', '1', '0', NULL, '1', NULL, NULL, NULL, 'EQ', 'input', '', 1, 'admin', '2021-01-27 16:18:05', '', NULL); -INSERT INTO `gen_table_column` VALUES (297, '23', 'dept_id', '部门ID', 'bigint(20)', 'Long', 'deptId', '1', '0', NULL, '1', NULL, NULL, NULL, 'EQ', 'input', '', 2, 'admin', '2021-01-27 16:18:05', '', NULL); -INSERT INTO `gen_table_column` VALUES (298, '24', 'id', '主键', 'bigint(64)', 'Long', 'id', '1', '1', NULL, '1', NULL, NULL, NULL, 'EQ', 'input', '', 1, 'admin', '2021-01-27 16:18:06', '', NULL); -INSERT INTO `gen_table_column` VALUES (299, '24', 'menu_id', '菜单id', 'bigint(64)', 'Long', 'menuId', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 2, 'admin', '2021-01-27 16:18:06', '', NULL); -INSERT INTO `gen_table_column` VALUES (300, '24', 'role_id', '角色id', 'bigint(64)', 'Long', 'roleId', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 3, 'admin', '2021-01-27 16:18:06', '', NULL); -INSERT INTO `gen_table_column` VALUES (301, '25', 'id', '菜单ID', 'bigint(20)', 'Long', 'id', '1', '1', NULL, '1', NULL, NULL, NULL, 'EQ', 'input', '', 1, 'admin', '2021-02-02 15:45:48', '', '2021-02-02 15:52:38'); -INSERT INTO `gen_table_column` VALUES (302, '25', 'name', '菜单标题', 'varchar(32)', 'String', 'name', '0', '0', NULL, '1', '1', '1', '1', 'LIKE', 'input', '', 2, 'admin', '2021-02-02 15:45:48', '', '2021-02-02 15:52:38'); -INSERT INTO `gen_table_column` VALUES (303, '25', 'permission', '菜单权限', 'varchar(32)', 'String', 'permission', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 3, 'admin', '2021-02-02 15:45:48', '', '2021-02-02 15:52:38'); -INSERT INTO `gen_table_column` VALUES (304, '25', 'path', '路径', 'varchar(128)', 'String', 'path', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 4, 'admin', '2021-02-02 15:45:48', '', '2021-02-02 15:52:38'); -INSERT INTO `gen_table_column` VALUES (305, '25', 'parent_id', '父菜单ID', 'bigint(20)', 'Long', 'parentId', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 5, 'admin', '2021-02-02 15:45:49', '', '2021-02-02 15:52:38'); -INSERT INTO `gen_table_column` VALUES (306, '25', 'parent_ids', '上级ID集合', 'varchar(255)', 'String', 'parentIds', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 6, 'admin', '2021-02-02 15:45:49', '', '2021-02-02 15:52:38'); -INSERT INTO `gen_table_column` VALUES (307, '25', 'icon', '菜单图标', 'varchar(32)', 'String', 'icon', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 7, 'admin', '2021-02-02 15:45:49', '', '2021-02-02 15:52:38'); -INSERT INTO `gen_table_column` VALUES (308, '25', 'sort', '排序值', 'int(11)', 'Long', 'sort', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 8, 'admin', '2021-02-02 15:45:49', '', '2021-02-02 15:52:38'); -INSERT INTO `gen_table_column` VALUES (309, '25', 'keep_alive', '是否缓存该页面: 1:是 0:不是', 'char(1)', 'String', 'keepAlive', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 9, 'admin', '2021-02-02 15:45:49', '', '2021-02-02 15:52:38'); -INSERT INTO `gen_table_column` VALUES (310, '25', 'type', '菜单类型', 'char(1)', 'String', 'type', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'select', '', 10, 'admin', '2021-02-02 15:45:49', '', '2021-02-02 15:52:39'); -INSERT INTO `gen_table_column` VALUES (311, '25', 'hidden', '是否显示', 'char(1)', 'String', 'hidden', '0', '0', '1', '1', '1', '1', '1', 'EQ', 'input', '', 11, 'admin', '2021-02-02 15:45:49', '', '2021-02-02 15:52:39'); -INSERT INTO `gen_table_column` VALUES (312, '25', 'target', '是否外链', 'char(1)', 'String', 'target', '0', '0', '1', '1', '1', '1', '1', 'EQ', 'input', '', 12, 'admin', '2021-02-02 15:45:49', '', '2021-02-02 15:52:39'); -INSERT INTO `gen_table_column` VALUES (313, '25', 'create_by', '创建人', 'varchar(32)', 'String', 'createBy', '0', '0', NULL, '1', NULL, NULL, NULL, 'EQ', 'input', '', 13, 'admin', '2021-02-02 15:45:49', '', '2021-02-02 15:52:39'); -INSERT INTO `gen_table_column` VALUES (314, '25', 'update_by', '更新人', 'varchar(32)', 'String', 'updateBy', '0', '0', NULL, '1', '1', NULL, NULL, 'EQ', 'input', '', 14, 'admin', '2021-02-02 15:45:49', '', '2021-02-02 15:52:39'); -INSERT INTO `gen_table_column` VALUES (315, '25', 'create_time', '创建时间', 'datetime', 'Date', 'createTime', '0', '0', NULL, '1', NULL, NULL, NULL, 'EQ', 'datetime', '', 15, 'admin', '2021-02-02 15:45:49', '', '2021-02-02 15:52:39'); -INSERT INTO `gen_table_column` VALUES (316, '25', 'update_time', '更新时间', 'datetime', 'Date', 'updateTime', '0', '0', NULL, '1', '1', NULL, NULL, 'EQ', 'datetime', '', 16, 'admin', '2021-02-02 15:45:49', '', '2021-02-02 15:52:39'); -INSERT INTO `gen_table_column` VALUES (317, '25', 'status', '状态', 'char(1)', 'String', 'status', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'radio', '', 17, 'admin', '2021-02-02 15:45:50', '', '2021-02-02 15:52:39'); -INSERT INTO `gen_table_column` VALUES (318, '25', 'is_deleted', '删除标识', 'char(1)', 'String', 'isDeleted', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 18, 'admin', '2021-02-02 15:45:50', '', '2021-02-02 15:52:39'); -INSERT INTO `gen_table_column` VALUES (319, '25', 'tenant_id', '租户ID', 'bigint(20) unsigned', 'Long', 'tenantId', '0', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 19, 'admin', '2021-02-02 15:45:50', '', '2021-02-02 15:52:39'); - -SET FOREIGN_KEY_CHECKS = 1; diff --git a/mate-core/mate-starter-auth/pom.xml b/mate-core/mate-starter-auth/pom.xml index dc6cb959c6b905c11bd47bf0e23b9dfcb475044a..7dbe99ff93be0a8a7a77a3dc3be610255b883d57 100644 --- a/mate-core/mate-starter-auth/pom.xml +++ b/mate-core/mate-starter-auth/pom.xml @@ -5,7 +5,7 @@ mate-core vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-core/mate-starter-cloud/pom.xml b/mate-core/mate-starter-cloud/pom.xml index 58f9a468f3b381a646fa1dc40aeec765fa168310..e53b25cf9d7f9e57f51905971ee484cfd088eb6e 100644 --- a/mate-core/mate-starter-cloud/pom.xml +++ b/mate-core/mate-starter-cloud/pom.xml @@ -5,7 +5,7 @@ mate-core vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-core/mate-starter-common/pom.xml b/mate-core/mate-starter-common/pom.xml index a629a870e354ce30efbb6f5409ccc4b66baa416a..a0b0a484e90b342a904d0f9f5c10dc9f50986303 100644 --- a/mate-core/mate-starter-common/pom.xml +++ b/mate-core/mate-starter-common/pom.xml @@ -5,7 +5,7 @@ mate-core vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-core/mate-starter-common/src/main/java/vip/mate/core/common/constant/MateConstant.java b/mate-core/mate-starter-common/src/main/java/vip/mate/core/common/constant/MateConstant.java index 2fe3718fbeaf21eae84c90b9308069007430eb1e..5a5ca3278bd9324840c66a3712c7a3b07a190efc 100644 --- a/mate-core/mate-starter-common/src/main/java/vip/mate/core/common/constant/MateConstant.java +++ b/mate-core/mate-starter-common/src/main/java/vip/mate/core/common/constant/MateConstant.java @@ -13,7 +13,7 @@ public class MateConstant { /** * 应用版本号 */ - public static final String MATE_APP_VERSION = "3.1.8"; + public static final String MATE_APP_VERSION = "3.2.8"; /** * Spring 应用名 prop key diff --git a/mate-core/mate-starter-database/pom.xml b/mate-core/mate-starter-database/pom.xml index 81b18a9de54e0c2c95c603ddbe3d4dea7ae5d82c..5ef8cb4a6cc4c73fac086468dd7e7197b06f107b 100644 --- a/mate-core/mate-starter-database/pom.xml +++ b/mate-core/mate-starter-database/pom.xml @@ -5,7 +5,7 @@ mate-core vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-core/mate-starter-dependencies/pom.xml b/mate-core/mate-starter-dependencies/pom.xml index 43b3dd9c936f15b37c941c4f7564cf54e9e1beca..497624504edc05d49a3a8abf5b6f642c5583cb45 100644 --- a/mate-core/mate-starter-dependencies/pom.xml +++ b/mate-core/mate-starter-dependencies/pom.xml @@ -12,7 +12,7 @@ vip.mate mate-starter-dependencies - 3.1.8 + 3.2.8 pom mate-starter-dependencies based on Spring Cloud Alibaba dependencies @@ -39,7 +39,7 @@ - 3.1.8 + 3.2.8 UTF-8 2.4.5 @@ -57,7 +57,7 @@ 8.0.22 12.2.0.1 42.2.6 - 1.2.5 + 1.2.6 3.4.2 3.4.1 3.3.2 @@ -77,7 +77,7 @@ 2.3.1 4.1.2 - 2.0.0 + 2.0.1 4.3.0 1.7.2 1.15.8 diff --git a/mate-core/mate-starter-dozer/pom.xml b/mate-core/mate-starter-dozer/pom.xml index b03114587de9d1728d35272d2637fe5f99e7cf10..e0566df463a33a77381f56b87d2eab36e6193765 100644 --- a/mate-core/mate-starter-dozer/pom.xml +++ b/mate-core/mate-starter-dozer/pom.xml @@ -5,7 +5,7 @@ mate-core vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-core/mate-starter-dubbo/pom.xml b/mate-core/mate-starter-dubbo/pom.xml index 3859d7f22e2a10f940df984c33d5167604a8e828..49f8e44ec38c47fa9f4b4f85599ccafa51f71bb6 100644 --- a/mate-core/mate-starter-dubbo/pom.xml +++ b/mate-core/mate-starter-dubbo/pom.xml @@ -5,7 +5,7 @@ mate-core vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-core/mate-starter-elasticsearch/pom.xml b/mate-core/mate-starter-elasticsearch/pom.xml index 4e3e7c14aeeb37562bcfa937ed989813e4cb4669..0faeb119d151c04603ca6ff850e6531ee965a5d2 100644 --- a/mate-core/mate-starter-elasticsearch/pom.xml +++ b/mate-core/mate-starter-elasticsearch/pom.xml @@ -5,7 +5,7 @@ mate-core vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-core/mate-starter-encrypt/pom.xml b/mate-core/mate-starter-encrypt/pom.xml index 83c687813c60b956511c7bb79a64bf6f56e3f1b4..29316d5f900cf36a07e4051aefd60be921b8996b 100644 --- a/mate-core/mate-starter-encrypt/pom.xml +++ b/mate-core/mate-starter-encrypt/pom.xml @@ -5,7 +5,7 @@ mate-core vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-core/mate-starter-feign/pom.xml b/mate-core/mate-starter-feign/pom.xml index 277e2017d461de15f38a0a31e46ea4e1eab2d0f4..61e41d2b5b53c9849650be61923d9147619d8f4f 100644 --- a/mate-core/mate-starter-feign/pom.xml +++ b/mate-core/mate-starter-feign/pom.xml @@ -5,7 +5,7 @@ mate-core vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-core/mate-starter-file/pom.xml b/mate-core/mate-starter-file/pom.xml index fb758ed0a8c2ffea5d0f7c30d372264fec9beec3..da48fe25deb070cbcd242bfb3126714194174689 100644 --- a/mate-core/mate-starter-file/pom.xml +++ b/mate-core/mate-starter-file/pom.xml @@ -5,7 +5,7 @@ mate-core vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-core/mate-starter-gray/pom.xml b/mate-core/mate-starter-gray/pom.xml index 6f81ef08039890311b9ac0f585b0a1bd3c958538..d646708b498beaf6e98ddbfe0f83ba444ad06a28 100644 --- a/mate-core/mate-starter-gray/pom.xml +++ b/mate-core/mate-starter-gray/pom.xml @@ -5,7 +5,7 @@ mate-core vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-core/mate-starter-idempotent/pom.xml b/mate-core/mate-starter-idempotent/pom.xml index 394c0d433160c3d8ff44c347e440d7bc2bc453cf..2753d50eac358ee7fcf4cac834501b6ab07af5c6 100644 --- a/mate-core/mate-starter-idempotent/pom.xml +++ b/mate-core/mate-starter-idempotent/pom.xml @@ -5,7 +5,7 @@ mate-core vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-core/mate-starter-idempotent/src/main/java/vip/mate/core/ide/aspect/IdeAspect.java b/mate-core/mate-starter-idempotent/src/main/java/vip/mate/core/ide/aspect/IdeAspect.java index cdb73839f2f6db393bc25d569b6cf529b5fe2e56..a417d2baeaa2823803a56a9f11fb6ba8010c95e6 100644 --- a/mate-core/mate-starter-idempotent/src/main/java/vip/mate/core/ide/aspect/IdeAspect.java +++ b/mate-core/mate-starter-idempotent/src/main/java/vip/mate/core/ide/aspect/IdeAspect.java @@ -1,8 +1,8 @@ package vip.mate.core.ide.aspect; +import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; -import io.micrometer.core.instrument.util.StringUtils; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.aspectj.lang.JoinPoint; @@ -90,7 +90,7 @@ public class IdeAspect extends BaseAspect { //2.1.通过rid模式判断是否属于重复提交 String rid = request.getHeader(HEADER_RID_KEY); - if (StringUtils.isNotBlank(rid)) { + if (StrUtil.isNotBlank(rid)) { Boolean result = redisService.tryLock(REDIS_KEY_PREFIX + rid, LOCK_WAIT_TIME); if (!result) { throw new IdeException("命中RID重复请求"); @@ -105,7 +105,7 @@ public class IdeAspect extends BaseAspect { || ide.ideTypeEnum() == IdeTypeEnum.KEY) { //2.2.通过自定义key模式判断是否属于重复提交 String key = ide.key(); - if (StringUtils.isNotBlank(key)) { + if (StrUtil.isNotBlank(key)) { String val = ""; Object[] paramValues = joinPoint.getArgs(); String[] paramNames = ((CodeSignature) joinPoint.getSignature()).getParameterNames(); @@ -128,7 +128,7 @@ public class IdeAspect extends BaseAspect { //判断重复提交的条件 String perFix = ide.perFix(); - if (StringUtils.isNotBlank(val)) { + if (StrUtil.isNotBlank(val)) { perFix = perFix + ":" + val; try { @@ -165,7 +165,7 @@ public class IdeAspect extends BaseAspect { ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); HttpServletRequest request = attributes.getRequest(); String rid = request.getHeader(HEADER_RID_KEY); - if (StringUtils.isNotBlank(rid)) { + if (StrUtil.isNotBlank(rid)) { try { // redisService.unLock(REDIS_KEY_PREFIX + rid); log.info("msg1=当前请求已成功处理,,rid={}", rid); @@ -180,7 +180,7 @@ public class IdeAspect extends BaseAspect { || ide.ideTypeEnum() == IdeTypeEnum.KEY) { // 自定义key String key = ide.key(); - if (StringUtils.isNotBlank(key) && StringUtils.isNotBlank(PER_FIX_KEY.get())) { + if (StrUtil.isNotBlank(key) && StrUtil.isNotBlank(PER_FIX_KEY.get())) { try { // redisService.unLock(PER_FIX_KEY.get()); log.info("msg1=当前请求已成功释放,,key={}", PER_FIX_KEY.get()); diff --git a/mate-core/mate-starter-j2cache/pom.xml b/mate-core/mate-starter-j2cache/pom.xml index 5f2388710903b48e1e62ca6502930645c253f65e..289b0c235b0d72d9562a6c1e7880669dcb7acd47 100644 --- a/mate-core/mate-starter-j2cache/pom.xml +++ b/mate-core/mate-starter-j2cache/pom.xml @@ -5,7 +5,7 @@ mate-core vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-core/mate-starter-jetcache/pom.xml b/mate-core/mate-starter-jetcache/pom.xml index 7774cc2f5a6005b29a32e823e6a2f8dd3830d43d..f1a176b09fb1b7deaabadf876ad7d0c127401a1c 100644 --- a/mate-core/mate-starter-jetcache/pom.xml +++ b/mate-core/mate-starter-jetcache/pom.xml @@ -5,7 +5,7 @@ mate-core vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-core/mate-starter-job/pom.xml b/mate-core/mate-starter-job/pom.xml index 23ddc3231fad75b706a5943daae58dacbaa79aea..4e77389ffbb94f8af0616b2f45c10cc1b3b36333 100644 --- a/mate-core/mate-starter-job/pom.xml +++ b/mate-core/mate-starter-job/pom.xml @@ -5,7 +5,7 @@ mate-core vip.mate - 3.1.8 + 3.2.8 4.0.0 jar diff --git a/mate-core/mate-starter-kafka/pom.xml b/mate-core/mate-starter-kafka/pom.xml index 368f089039590a919b44602e15ce9359a65b0d54..af626dbb5a4f4712aa2cc2a26e41141ca3ad35d0 100644 --- a/mate-core/mate-starter-kafka/pom.xml +++ b/mate-core/mate-starter-kafka/pom.xml @@ -5,7 +5,7 @@ mate-core vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-core/mate-starter-lock/pom.xml b/mate-core/mate-starter-lock/pom.xml index 3c19a3d1fbad867f28d73b90f749f273698a24c4..bf883c6e52fcb629d1d8bd850f322c052d11924c 100644 --- a/mate-core/mate-starter-lock/pom.xml +++ b/mate-core/mate-starter-lock/pom.xml @@ -5,7 +5,7 @@ mate-core vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-core/mate-starter-log/pom.xml b/mate-core/mate-starter-log/pom.xml index 382bff4f26aa68709b1c296f14b2f464fbcbf6e8..c37cf4d3ffda9fae5e20acbb99869c3f21bab22d 100644 --- a/mate-core/mate-starter-log/pom.xml +++ b/mate-core/mate-starter-log/pom.xml @@ -5,7 +5,7 @@ mate-core vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-core/mate-starter-mail/pom.xml b/mate-core/mate-starter-mail/pom.xml index 5a9fb478f53be9707490c669d2091438fc622ce4..29481f6c94f7b3994d83f0e72bd2960733518364 100644 --- a/mate-core/mate-starter-mail/pom.xml +++ b/mate-core/mate-starter-mail/pom.xml @@ -5,7 +5,7 @@ mate-core vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-core/mate-starter-mongodb/pom.xml b/mate-core/mate-starter-mongodb/pom.xml index 790f96176153fef12f69922783e0df70c1d41654..50147dcffa20edc0382ef48a09478d6d6263ef27 100644 --- a/mate-core/mate-starter-mongodb/pom.xml +++ b/mate-core/mate-starter-mongodb/pom.xml @@ -5,7 +5,7 @@ mate-core vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-core/mate-starter-mybatis/pom.xml b/mate-core/mate-starter-mybatis/pom.xml index 0246c318a2091cfbc87f65ad9ce3c836143330e3..17e39a3663d2660f47267ed2002f7b733079c0b5 100644 --- a/mate-core/mate-starter-mybatis/pom.xml +++ b/mate-core/mate-starter-mybatis/pom.xml @@ -5,7 +5,7 @@ mate-core vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-core/mate-starter-oss/pom.xml b/mate-core/mate-starter-oss/pom.xml index 793fcd854ce196e53565d76a0ac6778fc2ddeebf..774d171c42f13c838195df9ec4ac14a4a21341ff 100644 --- a/mate-core/mate-starter-oss/pom.xml +++ b/mate-core/mate-starter-oss/pom.xml @@ -5,7 +5,7 @@ mate-core vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-core/mate-starter-prometheus/pom.xml b/mate-core/mate-starter-prometheus/pom.xml index bffd062650196d1a6e0d388b187b47ffb7a9bb49..0f50433de3d9cc90f035d713e4ec5add6c323632 100644 --- a/mate-core/mate-starter-prometheus/pom.xml +++ b/mate-core/mate-starter-prometheus/pom.xml @@ -5,7 +5,7 @@ mate-core vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-core/mate-starter-rabbit/pom.xml b/mate-core/mate-starter-rabbit/pom.xml index 568978ff648d7a61a9fbeb4be825c7257b11a6ab..912d4f06f58efcb6407ccb1c13959f6776bada13 100644 --- a/mate-core/mate-starter-rabbit/pom.xml +++ b/mate-core/mate-starter-rabbit/pom.xml @@ -5,7 +5,7 @@ mate-core vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-core/mate-starter-redis/pom.xml b/mate-core/mate-starter-redis/pom.xml index 269f761e79f35e036869658235fbf52210cd9a93..3e5b84d6216c371dba24067ccb15fc8f1708ebf5 100644 --- a/mate-core/mate-starter-redis/pom.xml +++ b/mate-core/mate-starter-redis/pom.xml @@ -5,7 +5,7 @@ mate-core vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-core/mate-starter-retrofit/pom.xml b/mate-core/mate-starter-retrofit/pom.xml index 30a4e3e6d5c6fb323c0bc39754df5cd5a3f5f950..b67e2a2a8c28486f1df48485d3000a77caf17f31 100644 --- a/mate-core/mate-starter-retrofit/pom.xml +++ b/mate-core/mate-starter-retrofit/pom.xml @@ -5,7 +5,7 @@ mate-core vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-core/mate-starter-rocketmq/pom.xml b/mate-core/mate-starter-rocketmq/pom.xml index 0d23cfb24b5ddbaff4a392bdb4e7635bd4ccd85e..c57954c2a4970a48ec28712246786974ad1e6214 100644 --- a/mate-core/mate-starter-rocketmq/pom.xml +++ b/mate-core/mate-starter-rocketmq/pom.xml @@ -5,7 +5,7 @@ mate-core vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-core/mate-starter-rule/pom.xml b/mate-core/mate-starter-rule/pom.xml index 8f31fbf4cb068e2bbb7f6b3e15b651a5cf66e50f..fa43c669c484723d428b86e527b24301506e46af 100644 --- a/mate-core/mate-starter-rule/pom.xml +++ b/mate-core/mate-starter-rule/pom.xml @@ -5,7 +5,7 @@ mate-core vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-core/mate-starter-seata/pom.xml b/mate-core/mate-starter-seata/pom.xml index 84780716ac07bf72eade0b9d3cc3a4bec5572564..07409606b2881a5563103cbbf21753b6183cf7a7 100644 --- a/mate-core/mate-starter-seata/pom.xml +++ b/mate-core/mate-starter-seata/pom.xml @@ -5,7 +5,7 @@ mate-core vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-core/mate-starter-security/pom.xml b/mate-core/mate-starter-security/pom.xml index aec0865b40d31937c5197aacb5ce693d1e38a448..d5dd192a17dc168d272acadbc473eaeecb4ddd43 100644 --- a/mate-core/mate-starter-security/pom.xml +++ b/mate-core/mate-starter-security/pom.xml @@ -5,7 +5,7 @@ mate-core vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-core/mate-starter-sentinel/pom.xml b/mate-core/mate-starter-sentinel/pom.xml index b878ae2efc2927d1d72cd3d05117da41e663112e..f07b0d6cff3726d00c696d6e31da3f224c4b1f0d 100644 --- a/mate-core/mate-starter-sentinel/pom.xml +++ b/mate-core/mate-starter-sentinel/pom.xml @@ -5,7 +5,7 @@ mate-core vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-core/mate-starter-sharding/pom.xml b/mate-core/mate-starter-sharding/pom.xml index 46a4dc92bf79a0aacbd65a997a3d7ffdbf47a133..950e173e5ec4e1cec96da646ff91ee4804f807ba 100644 --- a/mate-core/mate-starter-sharding/pom.xml +++ b/mate-core/mate-starter-sharding/pom.xml @@ -5,7 +5,7 @@ mate-core vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-core/mate-starter-sms/pom.xml b/mate-core/mate-starter-sms/pom.xml index 46b26122c31b42e98e45fe12c4018602eaad275f..7f0b10be10a8db6dd2458010cb5ede5ab4bff1f0 100644 --- a/mate-core/mate-starter-sms/pom.xml +++ b/mate-core/mate-starter-sms/pom.xml @@ -5,7 +5,7 @@ mate-core vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-core/mate-starter-strategy/pom.xml b/mate-core/mate-starter-strategy/pom.xml index 225c24c71d438afc2adaebe9f966deb88ad5550d..44cb9ab60bf3aef191eabecf94e76ccba56e41d1 100644 --- a/mate-core/mate-starter-strategy/pom.xml +++ b/mate-core/mate-starter-strategy/pom.xml @@ -5,7 +5,7 @@ mate-core vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-core/mate-starter-web/pom.xml b/mate-core/mate-starter-web/pom.xml index 7a45c2047c4d5f0a1eeb91253dc7c5618896a9f4..af378bd17b40ee01b8fb32e52e6f1b7bbdd4658c 100644 --- a/mate-core/mate-starter-web/pom.xml +++ b/mate-core/mate-starter-web/pom.xml @@ -5,7 +5,7 @@ mate-core vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-core/pom.xml b/mate-core/pom.xml index 595ae16d79ef690bb7e05c66be86b76f6f835526..2db0446eb09b09246182e4aa948b9c4e9937ef1a 100644 --- a/mate-core/pom.xml +++ b/mate-core/pom.xml @@ -6,7 +6,7 @@ mate-core vip.mate - 3.1.8 + 3.2.8 pom mate-core based on Spring Cloud Alibaba microservice components @@ -72,7 +72,7 @@ - 3.1.8 + 3.2.8 2.9.2 1.5.21 1.9.4 diff --git a/mate-examples/pom.xml b/mate-examples/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..ec8964d119bf3403057020cf8dd1239be1445b43 --- /dev/null +++ b/mate-examples/pom.xml @@ -0,0 +1,23 @@ + + + + matecloud + vip.mate + 3.2.8 + + 4.0.0 + + mate-examples + pom + + sso-ui-example + + + + 8 + 8 + + + \ No newline at end of file diff --git a/mate-support/mate-generator/pom.xml b/mate-examples/sso-ui-example/pom.xml similarity index 82% rename from mate-support/mate-generator/pom.xml rename to mate-examples/sso-ui-example/pom.xml index 4c6c66724874d097ef889c9ddd5577f1a0a3211d..658ef2b95d30c35b3cd2cf39fe27676d52a51cc1 100644 --- a/mate-support/mate-generator/pom.xml +++ b/mate-examples/sso-ui-example/pom.xml @@ -3,13 +3,13 @@ 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"> - mate-support + mate-examples vip.mate - 3.1.8 + 3.2.8 4.0.0 - mate-generator + sso-ui-example 8 @@ -27,22 +27,7 @@ vip.mate - mate-starter-log - - - mysql - mysql-connector-java - - - org.apache.velocity - velocity-engine-core - 2.2 - - - - com.github.pagehelper - pagehelper-spring-boot-starter - 1.3.0 + mate-starter-security @@ -103,4 +88,5 @@ ${project.artifactId} + \ No newline at end of file diff --git a/mate-support/mate-generator/src/main/java/vip/mate/generator/MateGeneratorServer.java b/mate-examples/sso-ui-example/src/main/java/vip/mate/sso/SsoApplication.java similarity index 45% rename from mate-support/mate-generator/src/main/java/vip/mate/generator/MateGeneratorServer.java rename to mate-examples/sso-ui-example/src/main/java/vip/mate/sso/SsoApplication.java index 48e211b07060fa3e3c11e3d75e85ab4b00a9bc2a..e553cedc6ad14c98eee68eac439714a270e3fd39 100644 --- a/mate-support/mate-generator/src/main/java/vip/mate/generator/MateGeneratorServer.java +++ b/mate-examples/sso-ui-example/src/main/java/vip/mate/sso/SsoApplication.java @@ -1,19 +1,18 @@ -package vip.mate.generator; +package vip.mate.sso; -import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import vip.mate.core.feign.annotation.EnableMateFeign; /** - * 代码生成增强版本启动类 + * 单点登录启动类 * * @author pangu - * @since 2.3.8 */ +@EnableMateFeign @SpringBootApplication -@MapperScan({"vip.mate.generator.mapper"}) -public class MateGeneratorServer { +public class SsoApplication { public static void main(String[] args) { - SpringApplication.run(MateGeneratorServer.class, args); + SpringApplication.run(SsoApplication.class, args); } } diff --git a/mate-examples/sso-ui-example/src/main/java/vip/mate/sso/config/WebSecurityConfig.java b/mate-examples/sso-ui-example/src/main/java/vip/mate/sso/config/WebSecurityConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..a42cbf14a0b83fb6ff0778aed123373b7f1e6a6a --- /dev/null +++ b/mate-examples/sso-ui-example/src/main/java/vip/mate/sso/config/WebSecurityConfig.java @@ -0,0 +1,25 @@ +package vip.mate.sso.config; + +import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; + +/** + * 安全配置 + * + * @author pangu + */ +@EnableOAuth2Sso +@Configuration +public class WebSecurityConfig extends WebSecurityConfigurerAdapter { + + @Override + public void configure(HttpSecurity http) throws Exception { + http + .authorizeRequests() + .anyRequest() + .authenticated(); + http.csrf().disable(); + } +} diff --git a/mate-examples/sso-ui-example/src/main/java/vip/mate/sso/controller/IndexController.java b/mate-examples/sso-ui-example/src/main/java/vip/mate/sso/controller/IndexController.java new file mode 100644 index 0000000000000000000000000000000000000000..e93e463738b4a67f8ef3ee36f50fe5afde3f2b19 --- /dev/null +++ b/mate-examples/sso-ui-example/src/main/java/vip/mate/sso/controller/IndexController.java @@ -0,0 +1,30 @@ +package vip.mate.sso.controller; + +import lombok.AllArgsConstructor; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; +import vip.mate.core.common.api.Result; +import vip.mate.core.common.entity.LoginUser; +import vip.mate.core.common.util.SecurityUtil; + +import javax.servlet.http.HttpServletRequest; + +@RestController +@AllArgsConstructor +public class IndexController { + + private final HttpServletRequest request; + + /** + * 欢迎页 + * + * @return + */ + @GetMapping("/") + public Result index(ModelMap modelMap) { + LoginUser user = SecurityUtil.getUsername(request); + modelMap.put("user", user); + return Result.data(modelMap); + } +} diff --git a/mate-support/mate-generator/src/main/resources/application-prod.yml b/mate-examples/sso-ui-example/src/main/resources/application-dev.yml similarity index 39% rename from mate-support/mate-generator/src/main/resources/application-prod.yml rename to mate-examples/sso-ui-example/src/main/resources/application-dev.yml index 9f2edbe6992ea2b6129a2a29d44a13d6f9faa709..8041d76613f2962f212a697ce1bec04758d352be 100644 --- a/mate-support/mate-generator/src/main/resources/application-prod.yml +++ b/mate-examples/sso-ui-example/src/main/resources/application-dev.yml @@ -1,5 +1,5 @@ server: - port: 30002 + port: 32001 spring: application: name: @artifactId@ @@ -8,3 +8,12 @@ spring: url: ${mate.datasource.url} username: ${mate.datasource.username} password: ${mate.datasource.password} +security: + oauth2: + client: + client-id: mate + client-secret: mate_secret + access-token-uri: http://127.0.0.1:20001/oauth/token + user-authorization-uri: http://127.0.0.1:20001/oauth/authorize + resource: + token-info-uri: http://127.0.0.1:20001/oauth/check_token diff --git a/mate-support/mate-generator/src/main/resources/application-local.yml b/mate-examples/sso-ui-example/src/main/resources/application-local.yml similarity index 39% rename from mate-support/mate-generator/src/main/resources/application-local.yml rename to mate-examples/sso-ui-example/src/main/resources/application-local.yml index 9f2edbe6992ea2b6129a2a29d44a13d6f9faa709..c58b3c4b89f3da30416703dd344793e3ce681672 100644 --- a/mate-support/mate-generator/src/main/resources/application-local.yml +++ b/mate-examples/sso-ui-example/src/main/resources/application-local.yml @@ -1,5 +1,5 @@ server: - port: 30002 + port: 32001 spring: application: name: @artifactId@ @@ -8,3 +8,12 @@ spring: url: ${mate.datasource.url} username: ${mate.datasource.username} password: ${mate.datasource.password} +security: + oauth2: + client: + client-id: mate + client-secret: mate_secret + access-token-uri: http://127.0.0.1:20001/oauth/token + user-authorization-uri: http://127.0.0.1:20001/oauth/authorize + resource: + token-info-uri: http://127.0.0.1:20001/oauth/check_token \ No newline at end of file diff --git a/mate-gateway/pom.xml b/mate-gateway/pom.xml index 02d34835d2f2b6422b3c6577f945db9d7c3d8c33..b17956773a15ad350e624890380fbe94c5cb2c43 100644 --- a/mate-gateway/pom.xml +++ b/mate-gateway/pom.xml @@ -5,7 +5,7 @@ matecloud vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-mq/mate-log-producer/pom.xml b/mate-mq/mate-log-producer/pom.xml index 93d0bc185e5ef3233c475bcfb3ad789a5ded727e..ab266c98440e98bc2d8ee5b485ba21e1526054fa 100644 --- a/mate-mq/mate-log-producer/pom.xml +++ b/mate-mq/mate-log-producer/pom.xml @@ -5,7 +5,7 @@ mate-mq vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-mq/mate-message-consumer/pom.xml b/mate-mq/mate-message-consumer/pom.xml index 22dc97bf40aa62526cf445b9544bbe16a13e470f..b783b269ff019d72c3b6aceeecd04cac04eddfba 100644 --- a/mate-mq/mate-message-consumer/pom.xml +++ b/mate-mq/mate-message-consumer/pom.xml @@ -5,7 +5,7 @@ mate-mq vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-mq/mate-message-producer/pom.xml b/mate-mq/mate-message-producer/pom.xml index d0141f251206916146300483bdf04dbe3dd420d3..a10af511f2bcf76e389df84af1122773f7871c1e 100644 --- a/mate-mq/mate-message-producer/pom.xml +++ b/mate-mq/mate-message-producer/pom.xml @@ -5,7 +5,7 @@ mate-mq vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-mq/mate-message-producer/src/main/java/vip/mate/message/controller/SmsController.java b/mate-mq/mate-message-producer/src/main/java/vip/mate/message/controller/SmsController.java index 54ed175c42718217304e3b7385e0a0b7f044e49c..338677f82ff67b14a9f235c5453cee166fc70f05 100644 --- a/mate-mq/mate-message-producer/src/main/java/vip/mate/message/controller/SmsController.java +++ b/mate-mq/mate-message-producer/src/main/java/vip/mate/message/controller/SmsController.java @@ -5,6 +5,7 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import vip.mate.core.common.api.Result; import vip.mate.message.service.ISmsService; +import vip.mate.message.service.ITransactionOrderService; /** * 发送短信控制器 @@ -17,7 +18,7 @@ public class SmsController { private final ISmsService smsService; -// private final ITransactionOrderService transactionOrderService; + private final ITransactionOrderService transactionOrderService; @GetMapping("/send/sms") public Result sendSms(String message) { @@ -25,11 +26,9 @@ public class SmsController { return Result.success("操作成功"); } -// @GetMapping("/send/order") -// public Result sendOrder() { -// transactionOrderService.testStreamTransaction(); -// return Result.success("操作成功"); -// } - - + @GetMapping("/send/order") + public Result sendOrder() { + transactionOrderService.testStreamTransaction(); + return Result.success("操作成功"); + } } diff --git a/mate-mq/mate-message-producer/src/main/java/vip/mate/message/listener/OrderTransactionListener.java b/mate-mq/mate-message-producer/src/main/java/vip/mate/message/listener/OrderTransactionListener.java index 6a0d676e7579185d646a474d6e60ec3839f5beb4..df7da21188ed6870e5124ce621425a58efa86ef9 100644 --- a/mate-mq/mate-message-producer/src/main/java/vip/mate/message/listener/OrderTransactionListener.java +++ b/mate-mq/mate-message-producer/src/main/java/vip/mate/message/listener/OrderTransactionListener.java @@ -1,75 +1,75 @@ -//package vip.mate.message.listener; -// -//import com.alibaba.fastjson.JSON; -//import com.alibaba.fastjson.JSONObject; -//import lombok.extern.slf4j.Slf4j; -//import org.apache.rocketmq.spring.annotation.RocketMQTransactionListener; -//import org.apache.rocketmq.spring.core.RocketMQLocalTransactionListener; -//import org.apache.rocketmq.spring.core.RocketMQLocalTransactionState; -//import org.apache.rocketmq.spring.support.RocketMQHeaders; -//import org.springframework.messaging.Message; -//import org.springframework.messaging.MessageHeaders; -//import vip.mate.core.rocketmq.constant.MessageConstant; -//import vip.mate.core.rocketmq.entity.Order; -// -//import java.util.ArrayList; -//import java.util.List; -// -///** -// * 发送之后用于控制原子性的类 -// * 在消息发送之后,收到rocketmq的发送结果通知后才提交的本地事务。 -// * -// * @author pangu -// * @link https://blog.csdn.net/guzhangyu12345/article/details/107989633 -// */ -//@Slf4j -//@RocketMQTransactionListener(txProducerGroup = MessageConstant.ORDER_BINDER_GROUP) -//public class OrderTransactionListener implements RocketMQLocalTransactionListener { -// -// /** -// * rocketmq 消息发送成功之后,提交本地事务 -// * -// * @param message 消息 -// * @param o  args -// * @return RocketMQLocalTransactionState -// */ -// @Override -// public RocketMQLocalTransactionState executeLocalTransaction(Message message, Object o) { -// -// MessageHeaders headers = message.getHeaders(); -// String transactionId = String.valueOf(headers.get(RocketMQHeaders.TRANSACTION_ID)); -// Long shareId = Long.valueOf(String.valueOf(headers.get("share_id"))); -// Order order = null; -// try { -// order = JSONObject.parseObject(new String((byte[]) message.getPayload()), Order.class); -// } catch (Exception e) { -// e.printStackTrace(); -// } -// -// -// Long args = (Long) o; -// log.info(String.format("half message\npayload:%s, arg:%s, transactionId:%s", order, args, message.getHeaders().get(RocketMQHeaders.TRANSACTION_ID))); -// return RocketMQLocalTransactionState.COMMIT; -// -// } -// -// /** -// * rocketmq 回查,判断提交还是回滚 -// * -// * @param message Message -// * @return RocketMQLocalTransactionState -// */ -// @Override -// public RocketMQLocalTransactionState checkLocalTransaction(Message message) { -// Order order = JSON.parseObject(new String((byte[]) message.getPayload()), Order.class); -// // 业务查询本地事务是否执行成功 -// List orders = new ArrayList<>(); -// orders.add(order); -// // 根据message去查询本地事务是否执行成功,如果成功,则commit -// if (orders.size() > 0) { -// return RocketMQLocalTransactionState.COMMIT; -// } else { -// return RocketMQLocalTransactionState.ROLLBACK; -// } -// } -//} +package vip.mate.message.listener; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import lombok.extern.slf4j.Slf4j; +import org.apache.rocketmq.spring.annotation.RocketMQTransactionListener; +import org.apache.rocketmq.spring.core.RocketMQLocalTransactionListener; +import org.apache.rocketmq.spring.core.RocketMQLocalTransactionState; +import org.apache.rocketmq.spring.support.RocketMQHeaders; +import org.springframework.messaging.Message; +import org.springframework.messaging.MessageHeaders; +import vip.mate.core.rocketmq.constant.MessageConstant; +import vip.mate.core.rocketmq.entity.Order; + +import java.util.ArrayList; +import java.util.List; + +/** + * 发送之后用于控制原子性的类 + * 在消息发送之后,收到rocketmq的发送结果通知后才提交的本地事务。 + * + * @author pangu + * @link https://blog.csdn.net/guzhangyu12345/article/details/107989633 + */ +@Slf4j +@RocketMQTransactionListener(txProducerGroup = MessageConstant.ORDER_BINDER_GROUP) +public class OrderTransactionListener implements RocketMQLocalTransactionListener { + + /** + * rocketmq 消息发送成功之后,提交本地事务 + * + * @param message 消息 + * @param o  args + * @return RocketMQLocalTransactionState + */ + @Override + public RocketMQLocalTransactionState executeLocalTransaction(Message message, Object o) { + + MessageHeaders headers = message.getHeaders(); + String transactionId = String.valueOf(headers.get(RocketMQHeaders.TRANSACTION_ID)); + Long shareId = Long.valueOf(String.valueOf(headers.get("share_id"))); + Order order = null; + try { + order = JSONObject.parseObject(new String((byte[]) message.getPayload()), Order.class); + } catch (Exception e) { + e.printStackTrace(); + } + + + Long args = (Long) o; + log.info(String.format("half message\npayload:%s, arg:%s, transactionId:%s", order, args, message.getHeaders().get(RocketMQHeaders.TRANSACTION_ID))); + return RocketMQLocalTransactionState.COMMIT; + + } + + /** + * rocketmq 回查,判断提交还是回滚 + * + * @param message Message + * @return RocketMQLocalTransactionState + */ + @Override + public RocketMQLocalTransactionState checkLocalTransaction(Message message) { + Order order = JSON.parseObject(new String((byte[]) message.getPayload()), Order.class); + // 业务查询本地事务是否执行成功 + List orders = new ArrayList<>(); + orders.add(order); + // 根据message去查询本地事务是否执行成功,如果成功,则commit + if (orders.size() > 0) { + return RocketMQLocalTransactionState.COMMIT; + } else { + return RocketMQLocalTransactionState.ROLLBACK; + } + } +} diff --git a/mate-mq/mate-message-producer/src/main/java/vip/mate/message/service/ITransactionOrderService.java b/mate-mq/mate-message-producer/src/main/java/vip/mate/message/service/ITransactionOrderService.java index 1cf7019158e52d7bad81ee754c2798df6dc9ef42..bc5a4e6a03ce984f93e0733c3cf1b8775d64b737 100644 --- a/mate-mq/mate-message-producer/src/main/java/vip/mate/message/service/ITransactionOrderService.java +++ b/mate-mq/mate-message-producer/src/main/java/vip/mate/message/service/ITransactionOrderService.java @@ -1,20 +1,20 @@ -//package vip.mate.message.service; -// -///** -// * 订单事务消息 -// * -// * @author xuzhanfu -// */ -//public interface ITransactionOrderService { -// -// /** -// * 测试事务消息 -// */ -// void testTransaction(); -// -// /** -// * 通过stream方式发送消息 -// * 注意配置spring.cloud.stream.rocketmq.bindings.order-output.producer.transactional=true -// */ -// void testStreamTransaction(); -//} +package vip.mate.message.service; + +/** + * 订单事务消息 + * + * @author xuzhanfu + */ +public interface ITransactionOrderService { + + /** + * 测试事务消息 + */ + void testTransaction(); + + /** + * 通过stream方式发送消息 + * 注意配置spring.cloud.stream.rocketmq.bindings.order-output.producer.transactional=true + */ + void testStreamTransaction(); +} diff --git a/mate-mq/mate-message-producer/src/main/java/vip/mate/message/service/impl/TransactionOrderServiceImpl.java b/mate-mq/mate-message-producer/src/main/java/vip/mate/message/service/impl/TransactionOrderServiceImpl.java index c47141a7e14a894be33f0427fbe2c2dfcf960884..23a27652a6ea7481779799576b6aeeec1c49af71 100644 --- a/mate-mq/mate-message-producer/src/main/java/vip/mate/message/service/impl/TransactionOrderServiceImpl.java +++ b/mate-mq/mate-message-producer/src/main/java/vip/mate/message/service/impl/TransactionOrderServiceImpl.java @@ -1,79 +1,77 @@ -//package vip.mate.message.service.impl; -// -//import lombok.AllArgsConstructor; -//import lombok.extern.slf4j.Slf4j; -//import org.apache.rocketmq.spring.core.RocketMQTemplate; -//import org.apache.rocketmq.spring.support.RocketMQHeaders; -//import org.springframework.messaging.support.MessageBuilder; -//import org.springframework.stereotype.Service; -//import vip.mate.core.common.constant.MateConstant; -//import vip.mate.core.rocketmq.channel.MateSource; -//import vip.mate.core.rocketmq.constant.MessageConstant; -//import vip.mate.core.rocketmq.entity.Order; -//import vip.mate.message.service.ITransactionOrderService; -// -//import java.math.BigDecimal; -//import java.time.LocalDateTime; -//import java.util.UUID; -// -///** -// * @author pangu -// */ -//@Slf4j -//@Service -//@AllArgsConstructor -//public class TransactionOrderServiceImpl implements ITransactionOrderService { -// -// private final RocketMQTemplate rocketMQTemplate; -// -// private final MateSource mateSource; -// -// /** -// * 这里消息发送只是half发送, -// * 后面消息队列中half成功后,在TestTransactionListener中的executeLocalTransaction的方法中决定是否要提交本地事务 -// */ -// @Override -// public void testTransaction() { -// Order order = Order.builder() -// .id(1L) -// .goodsId(100L) -// .goodsPrice(BigDecimal.valueOf(100.00)) -// .tradeId(100L) -// .number(2) -// .createTime(LocalDateTime.now()) -// .build(); -// -// // 事务id -// String transactionId = UUID.randomUUID().toString(); -// rocketMQTemplate.sendMessageInTransaction(MessageConstant.ORDER_BINDER_GROUP, -// MessageConstant.ORDER_MESSAGE_OUTPUT, -// MessageBuilder.withPayload(order) -// .setHeader(RocketMQHeaders.TRANSACTION_ID, transactionId) -// .setHeader("share_id", 3).build(), -// 4L); -// -// log.info("half消息发送成功"); -// -// } -// -// @Override -// public void testStreamTransaction() { -// -// Order order = Order.builder() -// .id(1L) -// .goodsId(100L) -// .goodsPrice(BigDecimal.valueOf(100.00)) -// .tradeId(100L) -// .number(2) -// .createTime(LocalDateTime.now()) -// .build(); -// // 事务id -// String transactionId = UUID.randomUUID().toString(); -// mateSource.orderOutput().send( -// MessageBuilder.withPayload(order) -// .setHeader(RocketMQHeaders.TRANSACTION_ID, transactionId) -// .setHeader("share_id", 3).build() -// ); -// log.info("half消息发送成功"); -// } -//} +package vip.mate.message.service.impl; + +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.rocketmq.spring.core.RocketMQTemplate; +import org.apache.rocketmq.spring.support.RocketMQHeaders; +import org.springframework.cloud.stream.function.StreamBridge; +import org.springframework.messaging.support.MessageBuilder; +import org.springframework.stereotype.Service; +import vip.mate.core.rocketmq.constant.MessageConstant; +import vip.mate.core.rocketmq.entity.Order; +import vip.mate.message.service.ITransactionOrderService; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.UUID; + +/** + * @author pangu + */ +@Slf4j +@Service +@AllArgsConstructor +public class TransactionOrderServiceImpl implements ITransactionOrderService { + + private final RocketMQTemplate rocketMQTemplate; + + private final StreamBridge streamBridge; + + /** + * 这里消息发送只是half发送, + * 后面消息队列中half成功后,在TestTransactionListener中的executeLocalTransaction的方法中决定是否要提交本地事务 + */ + @Override + public void testTransaction() { + Order order = Order.builder() + .id(1L) + .goodsId(100L) + .goodsPrice(BigDecimal.valueOf(100.00)) + .tradeId(100L) + .number(2) + .createTime(LocalDateTime.now()) + .build(); + + // 事务id + String transactionId = UUID.randomUUID().toString(); + rocketMQTemplate.sendMessageInTransaction(MessageConstant.ORDER_BINDER_GROUP, + MessageConstant.ORDER_MESSAGE_OUTPUT, + MessageBuilder.withPayload(order) + .setHeader(RocketMQHeaders.TRANSACTION_ID, transactionId) + .setHeader("share_id", 3).build(), + 4L); + + log.info("half消息发送成功"); + + } + + @Override + public void testStreamTransaction() { + + Order order = Order.builder() + .id(1L) + .goodsId(100L) + .goodsPrice(BigDecimal.valueOf(100.00)) + .tradeId(100L) + .number(2) + .createTime(LocalDateTime.now()) + .build(); + // 事务id + String transactionId = UUID.randomUUID().toString(); + + streamBridge.send(MessageConstant.ORDER_MESSAGE_OUTPUT, MessageBuilder.withPayload(order) + .setHeader(RocketMQHeaders.TRANSACTION_ID, transactionId) + .setHeader("share_id", 3).build()); + log.info("half消息发送成功"); + } +} diff --git a/mate-mq/pom.xml b/mate-mq/pom.xml index 91f585695d22e53c329f2e11c65cfafc8c0e7ddb..4970619f39398f6c1be512995c23f8668db1c4d6 100644 --- a/mate-mq/pom.xml +++ b/mate-mq/pom.xml @@ -5,7 +5,7 @@ matecloud vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-platform/mate-component-api/pom.xml b/mate-platform/mate-component-api/pom.xml index d66881d3ed1fc6b87b36899685309e37a88a4cd1..1d7067d84aa1ae1db41042560a80dc482189f5e1 100644 --- a/mate-platform/mate-component-api/pom.xml +++ b/mate-platform/mate-component-api/pom.xml @@ -5,7 +5,7 @@ mate-platform vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-platform/mate-component/pom.xml b/mate-platform/mate-component/pom.xml index 6c05d1028bf083043eed532b4221285506c88402..43b7ca97fa42ee5d17a93cbe427558f64b418b67 100644 --- a/mate-platform/mate-component/pom.xml +++ b/mate-platform/mate-component/pom.xml @@ -5,7 +5,7 @@ mate-platform vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-platform/mate-system-api/pom.xml b/mate-platform/mate-system-api/pom.xml index 4508df08fafa2ff671beaa87dbcd82b713752ebe..f8845161e120fdd2cef74f7bea5d13b447093334 100644 --- a/mate-platform/mate-system-api/pom.xml +++ b/mate-platform/mate-system-api/pom.xml @@ -5,7 +5,7 @@ mate-platform vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-platform/mate-system/pom.xml b/mate-platform/mate-system/pom.xml index 9b8e8cd6db4ac0a3806181586f00c8704d34311e..73fde232798ccccb1454e3ef67eb8f921115ffa8 100644 --- a/mate-platform/mate-system/pom.xml +++ b/mate-platform/mate-system/pom.xml @@ -5,7 +5,7 @@ mate-platform vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-platform/pom.xml b/mate-platform/pom.xml index 7f93b40e40487de2c7c48b88de4010bf7db19967..aeae794441b253fde2a82b2a940d31c249c1433d 100644 --- a/mate-platform/pom.xml +++ b/mate-platform/pom.xml @@ -5,7 +5,7 @@ matecloud vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-support/mate-admin/pom.xml b/mate-support/mate-admin/pom.xml index 9fce854096c3d1828d712fd1763b136e1655fc27..59745193b96557cf714e86ce4291ea7abe54cdec 100644 --- a/mate-support/mate-admin/pom.xml +++ b/mate-support/mate-admin/pom.xml @@ -5,7 +5,7 @@ mate-support vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-support/mate-code/pom.xml b/mate-support/mate-code/pom.xml index 58a8ccc255ab3746d2e9423359e2743a1bf89ea5..cde96b19657dff754baa515657b9e67b9d9f073c 100644 --- a/mate-support/mate-code/pom.xml +++ b/mate-support/mate-code/pom.xml @@ -5,7 +5,7 @@ mate-support vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-support/mate-generator/README.md b/mate-support/mate-generator/README.md deleted file mode 100644 index 71ab3605394ba692fecf191b4d8cadc677310220..0000000000000000000000000000000000000000 --- a/mate-support/mate-generator/README.md +++ /dev/null @@ -1 +0,0 @@ -## 代码生成增强版本 \ No newline at end of file diff --git a/mate-support/mate-generator/src/main/java/vip/mate/generator/config/GenConfig.java b/mate-support/mate-generator/src/main/java/vip/mate/generator/config/GenConfig.java deleted file mode 100644 index ca6c1171aeec033ea7019472759afe664508fb73..0000000000000000000000000000000000000000 --- a/mate-support/mate-generator/src/main/java/vip/mate/generator/config/GenConfig.java +++ /dev/null @@ -1,73 +0,0 @@ -package vip.mate.generator.config; - -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.PropertySource; -import org.springframework.stereotype.Component; - -/** - * 读取代码生成相关配置 - * - * @author ruoyi - */ -@Component -@ConfigurationProperties(prefix = "gen") -@PropertySource(value = { "classpath:generator.yml" }) -public class GenConfig -{ - /** 作者 */ - public static String author; - - /** 生成包路径 */ - public static String packageName; - - /** 自动去除表前缀,默认是false */ - public static boolean autoRemovePre; - - /** 表前缀(类名不会包含表前缀) */ - public static String tablePrefix; - - public static String getAuthor() - { - return author; - } - - @Value("${author}") - public void setAuthor(String author) - { - GenConfig.author = author; - } - - public static String getPackageName() - { - return packageName; - } - - @Value("${packageName}") - public void setPackageName(String packageName) - { - GenConfig.packageName = packageName; - } - - public static boolean getAutoRemovePre() - { - return autoRemovePre; - } - - @Value("${autoRemovePre}") - public void setAutoRemovePre(boolean autoRemovePre) - { - GenConfig.autoRemovePre = autoRemovePre; - } - - public static String getTablePrefix() - { - return tablePrefix; - } - - @Value("${tablePrefix}") - public void setTablePrefix(String tablePrefix) - { - GenConfig.tablePrefix = tablePrefix; - } -} diff --git a/mate-support/mate-generator/src/main/java/vip/mate/generator/controller/GenController.java b/mate-support/mate-generator/src/main/java/vip/mate/generator/controller/GenController.java deleted file mode 100644 index 28aa42c23f5ab157700eff5a06fe0b05c0b29005..0000000000000000000000000000000000000000 --- a/mate-support/mate-generator/src/main/java/vip/mate/generator/controller/GenController.java +++ /dev/null @@ -1,220 +0,0 @@ -package vip.mate.generator.controller; - - -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; -import org.apache.commons.io.IOUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; -import vip.mate.core.web.controller.BaseController; -import vip.mate.generator.entity.*; -import vip.mate.generator.service.IGenTableColumnService; -import vip.mate.generator.service.IGenTableService; -import vip.mate.generator.util.SqlUtil; -import vip.mate.generator.util.StringUtils; - -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * 代码生成 操作处理 - * - * @author ruoyi - */ -@RestController -@RequestMapping("/tool/gen") -public class GenController extends BaseController -{ - @Autowired - private IGenTableService genTableService; - - @Autowired - private IGenTableColumnService genTableColumnService; - - /** - * 查询代码生成列表 - */ - @GetMapping("/list") - public TableDataInfo genList(GenTable genTable) - { - startPage(); - List list = genTableService.selectGenTableList(genTable); - return getDataTable(list); - } - - /** - * 修改代码生成业务 - */ - @GetMapping(value = "/{talbleId}") - public AjaxResult getInfo(@PathVariable Long talbleId) - { - GenTable table = genTableService.selectGenTableById(talbleId); - List tables = genTableService.selectGenTableAll(); - List list = genTableColumnService.selectGenTableColumnListByTableId(talbleId); - Map map = new HashMap(); - map.put("info", table); - map.put("rows", list); - map.put("tables", tables); - return AjaxResult.success(map); - } - - /** - * 查询数据库列表 - */ - @GetMapping("/db/list") - public TableDataInfo dataList(GenTable genTable) - { - startPage(); - List list = genTableService.selectDbTableList(genTable); - return getDataTable(list); - } - - /** - * 查询数据表字段列表 - */ - @GetMapping(value = "/column/{talbleId}") - public TableDataInfo columnList(Long tableId) - { - TableDataInfo dataInfo = new TableDataInfo(); - List list = genTableColumnService.selectGenTableColumnListByTableId(tableId); - dataInfo.setRows(list); - dataInfo.setTotal(list.size()); - return dataInfo; - } - - /** - * 导入表结构(保存) - */ - @PostMapping("/importTable") - public AjaxResult importTableSave(String tables) - { - String[] tableNames = tables.split(","); - // 查询表信息 - List tableList = genTableService.selectDbTableListByNames(tableNames); - genTableService.importGenTable(tableList); - return AjaxResult.success(); - } - - /** - * 修改保存代码生成业务 - */ - @PutMapping - public AjaxResult editSave(@Validated @RequestBody GenTable genTable) - { - genTableService.validateEdit(genTable); - genTableService.updateGenTable(genTable); - return AjaxResult.success(); - } - - /** - * 删除代码生成 - */ - @DeleteMapping("/{tableIds}") - public AjaxResult remove(@PathVariable Long[] tableIds) - { - genTableService.deleteGenTableByIds(tableIds); - return AjaxResult.success(); - } - - /** - * 预览代码 - */ - @GetMapping("/preview/{tableId}") - public AjaxResult preview(@PathVariable("tableId") Long tableId) throws IOException - { - Map dataMap = genTableService.previewCode(tableId); - return AjaxResult.success(dataMap); - } - - /** - * 生成代码(下载方式) - */ - @GetMapping("/download/{tableName}") - public void download(HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException - { - byte[] data = genTableService.downloadCode(tableName); - genCode(response, data); - } - - /** - * 生成代码(自定义路径) - */ - @GetMapping("/genCode/{tableName}") - public AjaxResult genCode(@PathVariable("tableName") String tableName) - { - genTableService.generatorCode(tableName); - return AjaxResult.success(); - } - - /** - * 同步数据库 - */ - @GetMapping("/synchDb/{tableName}") - public AjaxResult synchDb(@PathVariable("tableName") String tableName) - { - genTableService.synchDb(tableName); - return AjaxResult.success(); - } - - /** - * 批量生成代码 - */ - @GetMapping("/batchGenCode") - public void batchGenCode(HttpServletResponse response, String tables) throws IOException - { - String[] tableNames = tables.split(","); - byte[] data = genTableService.downloadCode(tableNames); - genCode(response, data); - } - - /** - * 生成zip文件 - */ - private void genCode(HttpServletResponse response, byte[] data) throws IOException - { - response.reset(); -// response.addHeader("Access-Control-Allow-Origin", "*"); - response.addHeader("Access-Control-Expose-Headers", "Content-Disposition"); - response.setHeader("Content-Disposition", "attachment; filename=\"ruoyi.zip\""); - response.addHeader("Content-Length", "" + data.length); - response.setContentType("application/octet-stream; charset=UTF-8"); - IOUtils.write(data, response.getOutputStream()); - } - - /** - * 设置请求分页数据 - */ - protected void startPage() - { - PageDomain pageDomain = TableSupport.buildPageRequest(); - Integer pageNum = pageDomain.getPageNum(); - Integer pageSize = pageDomain.getPageSize(); - if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) - { - String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy()); - PageHelper.startPage(pageNum, pageSize, orderBy); - } - } - - /** - * 响应请求分页数据 - */ - @SuppressWarnings({ "rawtypes", "unchecked" }) - protected TableDataInfo getDataTable(List list) - { - TableDataInfo rspData = new TableDataInfo(); - rspData.setCode(200); - rspData.setMsg("查询成功"); - rspData.setRows(list); - rspData.setTotal(new PageInfo(list).getTotal()); - return rspData; - } - - - - -} \ No newline at end of file diff --git a/mate-support/mate-generator/src/main/java/vip/mate/generator/controller/package-info.java b/mate-support/mate-generator/src/main/java/vip/mate/generator/controller/package-info.java deleted file mode 100644 index 1ec078e35adc1c55cc35c74ff46e0ff3bf7b0164..0000000000000000000000000000000000000000 --- a/mate-support/mate-generator/src/main/java/vip/mate/generator/controller/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package vip.mate.generator.controller; \ No newline at end of file diff --git a/mate-support/mate-generator/src/main/java/vip/mate/generator/entity/AjaxResult.java b/mate-support/mate-generator/src/main/java/vip/mate/generator/entity/AjaxResult.java deleted file mode 100644 index 4e801742548b4324306732681d03ca66c4eb6947..0000000000000000000000000000000000000000 --- a/mate-support/mate-generator/src/main/java/vip/mate/generator/entity/AjaxResult.java +++ /dev/null @@ -1,146 +0,0 @@ -package vip.mate.generator.entity; - -import java.util.HashMap; - -/** - * 操作消息提醒 - * - * @author ruoyi - */ -public class AjaxResult extends HashMap -{ - private static final long serialVersionUID = 1L; - - /** 状态码 */ - public static final String CODE_TAG = "code"; - - /** 返回内容 */ - public static final String MSG_TAG = "msg"; - - /** 数据对象 */ - public static final String DATA_TAG = "data"; - - /** - * 初始化一个新创建的 AjaxResult 对象,使其表示一个空消息。 - */ - public AjaxResult() - { - } - - /** - * 初始化一个新创建的 AjaxResult 对象 - * - * @param code 状态码 - * @param msg 返回内容 - */ - public AjaxResult(int code, String msg) - { - super.put(CODE_TAG, code); - super.put(MSG_TAG, msg); - } - - /** - * 初始化一个新创建的 AjaxResult 对象 - * - * @param code 状态码 - * @param msg 返回内容 - * @param data 数据对象 - */ - public AjaxResult(int code, String msg, Object data) - { - super.put(CODE_TAG, code); - super.put(MSG_TAG, msg); - if (data!=null) - { - super.put(DATA_TAG, data); - } - } - - /** - * 返回成功消息 - * - * @return 成功消息 - */ - public static AjaxResult success() - { - return AjaxResult.success("操作成功"); - } - - /** - * 返回成功数据 - * - * @return 成功消息 - */ - public static AjaxResult success(Object data) - { - return AjaxResult.success("操作成功", data); - } - - /** - * 返回成功消息 - * - * @param msg 返回内容 - * @return 成功消息 - */ - public static AjaxResult success(String msg) - { - return AjaxResult.success(msg, null); - } - - /** - * 返回成功消息 - * - * @param msg 返回内容 - * @param data 数据对象 - * @return 成功消息 - */ - public static AjaxResult success(String msg, Object data) - { - return new AjaxResult(200, msg, data); - } - - /** - * 返回错误消息 - * - * @return - */ - public static AjaxResult error() - { - return AjaxResult.error("操作失败"); - } - - /** - * 返回错误消息 - * - * @param msg 返回内容 - * @return 警告消息 - */ - public static AjaxResult error(String msg) - { - return AjaxResult.error(msg, null); - } - - /** - * 返回错误消息 - * - * @param msg 返回内容 - * @param data 数据对象 - * @return 警告消息 - */ - public static AjaxResult error(String msg, Object data) - { - return new AjaxResult(500, msg, data); - } - - /** - * 返回错误消息 - * - * @param code 状态码 - * @param msg 返回内容 - * @return 警告消息 - */ - public static AjaxResult error(int code, String msg) - { - return new AjaxResult(code, msg, null); - } -} diff --git a/mate-support/mate-generator/src/main/java/vip/mate/generator/entity/CodeBaseEntity.java b/mate-support/mate-generator/src/main/java/vip/mate/generator/entity/CodeBaseEntity.java deleted file mode 100644 index 180c2488a66c77327fb6728cfede01006287b255..0000000000000000000000000000000000000000 --- a/mate-support/mate-generator/src/main/java/vip/mate/generator/entity/CodeBaseEntity.java +++ /dev/null @@ -1,115 +0,0 @@ -package vip.mate.generator.entity; - -import com.fasterxml.jackson.annotation.JsonFormat; - -import java.io.Serializable; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - -/** - * Entity基类 - * - * @author ruoyi - */ -public class CodeBaseEntity implements Serializable -{ - private static final long serialVersionUID = 1L; - - /** 搜索值 */ - private String searchValue; - - /** 创建者 */ - private String createBy; - - /** 创建时间 */ - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date createTime; - - /** 更新者 */ - private String updateBy; - - /** 更新时间 */ - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date updateTime; - - /** 备注 */ - private String remark; - - /** 请求参数 */ - private Map params; - - public String getSearchValue() - { - return searchValue; - } - - public void setSearchValue(String searchValue) - { - this.searchValue = searchValue; - } - - public String getCreateBy() - { - return createBy; - } - - public void setCreateBy(String createBy) - { - this.createBy = createBy; - } - - public Date getCreateTime() - { - return createTime; - } - - public void setCreateTime(Date createTime) - { - this.createTime = createTime; - } - - public String getUpdateBy() - { - return updateBy; - } - - public void setUpdateBy(String updateBy) - { - this.updateBy = updateBy; - } - - public Date getUpdateTime() - { - return updateTime; - } - - public void setUpdateTime(Date updateTime) - { - this.updateTime = updateTime; - } - - public String getRemark() - { - return remark; - } - - public void setRemark(String remark) - { - this.remark = remark; - } - - public Map getParams() - { - if (params == null) - { - params = new HashMap<>(); - } - return params; - } - - public void setParams(Map params) - { - this.params = params; - } -} diff --git a/mate-support/mate-generator/src/main/java/vip/mate/generator/entity/GenConstants.java b/mate-support/mate-generator/src/main/java/vip/mate/generator/entity/GenConstants.java deleted file mode 100644 index 608806f443a9afcd0944f65619f7c916ee1b34e8..0000000000000000000000000000000000000000 --- a/mate-support/mate-generator/src/main/java/vip/mate/generator/entity/GenConstants.java +++ /dev/null @@ -1,115 +0,0 @@ -package vip.mate.generator.entity; - -/** - * 代码生成通用常量 - * - * @author ruoyi - */ -public class GenConstants -{ - /** 单表(增删改查) */ - public static final String TPL_CRUD = "crud"; - - /** 树表(增删改查) */ - public static final String TPL_TREE = "tree"; - - /** 主子表(增删改查) */ - public static final String TPL_SUB = "sub"; - - /** 树编码字段 */ - public static final String TREE_CODE = "treeCode"; - - /** 树父编码字段 */ - public static final String TREE_PARENT_CODE = "treeParentCode"; - - /** 树名称字段 */ - public static final String TREE_NAME = "treeName"; - - /** 上级菜单ID字段 */ - public static final String PARENT_MENU_ID = "parentMenuId"; - - /** 上级菜单名称字段 */ - public static final String PARENT_MENU_NAME = "parentMenuName"; - - /** 数据库字符串类型 */ - public static final String[] COLUMNTYPE_STR = { "char", "varchar", "nvarchar", "varchar2" }; - - /** 数据库文本类型 */ - public static final String[] COLUMNTYPE_TEXT = { "tinytext", "text", "mediumtext", "longtext" }; - - /** 数据库时间类型 */ - public static final String[] COLUMNTYPE_TIME = { "datetime", "time", "date", "timestamp" }; - - /** 数据库数字类型 */ - public static final String[] COLUMNTYPE_NUMBER = { "tinyint", "smallint", "mediumint", "int", "number", "integer", - "bit", "bigint", "float", "double", "decimal" }; - - /** 页面不需要编辑字段 */ - public static final String[] COLUMNNAME_NOT_EDIT = { "id", "create_by", "create_time", "del_flag" }; - - /** 页面不需要显示的列表字段 */ - public static final String[] COLUMNNAME_NOT_LIST = { "id", "create_by", "create_time", "del_flag", "update_by", - "update_time" }; - - /** 页面不需要查询字段 */ - public static final String[] COLUMNNAME_NOT_QUERY = { "id", "create_by", "create_time", "del_flag", "update_by", - "update_time", "remark" }; - - /** Entity基类字段 */ - public static final String[] BASE_ENTITY = { "id","createBy", "createTime", "updateBy", "updateTime" }; - - /** Tree基类字段 */ - public static final String[] TREE_ENTITY = { "id","createBy", "createTime", "updateBy", "updateTime" }; -// public static final String[] TREE_ENTITY = { "children" }; - - /** 文本框 */ - public static final String HTML_INPUT = "input"; - - /** 文本域 */ - public static final String HTML_TEXTAREA = "textarea"; - - /** 下拉框 */ - public static final String HTML_SELECT = "select"; - - /** 单选框 */ - public static final String HTML_RADIO = "radio"; - - /** 复选框 */ - public static final String HTML_CHECKBOX = "checkbox"; - - /** 日期控件 */ - public static final String HTML_DATETIME = "datetime"; - - /** 图片上传控件 */ - public static final String HTML_IMAGE_UPLOAD = "imageUpload"; - - /** 文件上传控件 */ - public static final String HTML_FILE_UPLOAD = "fileUpload"; - - /** 富文本控件 */ - public static final String HTML_EDITOR = "editor"; - - /** 字符串类型 */ - public static final String TYPE_STRING = "String"; - - /** 整型 */ - public static final String TYPE_INTEGER = "Integer"; - - /** 长整型 */ - public static final String TYPE_LONG = "Long"; - - /** 浮点型 */ - public static final String TYPE_DOUBLE = "Double"; - - /** 高精度计算类型 */ - public static final String TYPE_BIGDECIMAL = "BigDecimal"; - - /** 时间类型 */ - public static final String TYPE_DATE = "Date"; - - /** 模糊查询 */ - public static final String QUERY_LIKE = "LIKE"; - - /** 需要 */ - public static final String REQUIRE = "1"; -} diff --git a/mate-support/mate-generator/src/main/java/vip/mate/generator/entity/GenTable.java b/mate-support/mate-generator/src/main/java/vip/mate/generator/entity/GenTable.java deleted file mode 100644 index de9e6e3b61a76afe71b1e6d73bcc65c43d0a3048..0000000000000000000000000000000000000000 --- a/mate-support/mate-generator/src/main/java/vip/mate/generator/entity/GenTable.java +++ /dev/null @@ -1,372 +0,0 @@ -package vip.mate.generator.entity; - - -import org.apache.commons.lang3.ArrayUtils; -import org.apache.commons.lang3.StringUtils; - -import javax.validation.Valid; -import javax.validation.constraints.NotBlank; -import java.util.List; - -/** - * 业务表 gen_table - * - * @author ruoyi - */ -public class GenTable extends CodeBaseEntity -{ - private static final long serialVersionUID = 1L; - - /** 编号 */ - private Long tableId; - - /** 表名称 */ - @NotBlank(message = "表名称不能为空") - private String tableName; - - /** 表描述 */ - @NotBlank(message = "表描述不能为空") - private String tableComment; - - /** 关联父表的表名 */ - private String subTableName; - - /** 本表关联父表的外键名 */ - private String subTableFkName; - - /** 实体类名称(首字母大写) */ - @NotBlank(message = "实体类名称不能为空") - private String className; - - /** 使用的模板(crud单表操作 tree树表操作 sub主子表操作) */ - private String tplCategory; - - /** 生成包路径 */ - @NotBlank(message = "生成包路径不能为空") - private String packageName; - - /** 生成模块名 */ - @NotBlank(message = "生成模块名不能为空") - private String moduleName; - - /** 生成业务名 */ - @NotBlank(message = "生成业务名不能为空") - private String businessName; - - /** 生成功能名 */ - @NotBlank(message = "生成功能名不能为空") - private String functionName; - - /** 生成作者 */ - @NotBlank(message = "作者不能为空") - private String functionAuthor; - - /** 生成代码方式(0zip压缩包 1自定义路径) */ - private String genType; - - /** 生成路径(不填默认项目路径) */ - private String genPath; - - /** 主键信息 */ - private GenTableColumn pkColumn; - - /** 子表信息 */ - private GenTable subTable; - - /** 表列信息 */ - @Valid - private List columns; - - /** 其它生成选项 */ - private String options; - - /** 树编码字段 */ - private String treeCode; - - /** 树父编码字段 */ - private String treeParentCode; - - /** 树名称字段 */ - private String treeName; - - /** 上级菜单ID字段 */ - private String parentMenuId; - - /** 上级菜单名称字段 */ - private String parentMenuName; - - public Long getTableId() - { - return tableId; - } - - public void setTableId(Long tableId) - { - this.tableId = tableId; - } - - public String getTableName() - { - return tableName; - } - - public void setTableName(String tableName) - { - this.tableName = tableName; - } - - public String getTableComment() - { - return tableComment; - } - - public void setTableComment(String tableComment) - { - this.tableComment = tableComment; - } - - public String getSubTableName() - { - return subTableName; - } - - public void setSubTableName(String subTableName) - { - this.subTableName = subTableName; - } - - public String getSubTableFkName() - { - return subTableFkName; - } - - public void setSubTableFkName(String subTableFkName) - { - this.subTableFkName = subTableFkName; - } - - public String getClassName() - { - return className; - } - - public void setClassName(String className) - { - this.className = className; - } - - public String getTplCategory() - { - return tplCategory; - } - - public void setTplCategory(String tplCategory) - { - this.tplCategory = tplCategory; - } - - public String getPackageName() - { - return packageName; - } - - public void setPackageName(String packageName) - { - this.packageName = packageName; - } - - public String getModuleName() - { - return moduleName; - } - - public void setModuleName(String moduleName) - { - this.moduleName = moduleName; - } - - public String getBusinessName() - { - return businessName; - } - - public void setBusinessName(String businessName) - { - this.businessName = businessName; - } - - public String getFunctionName() - { - return functionName; - } - - public void setFunctionName(String functionName) - { - this.functionName = functionName; - } - - public String getFunctionAuthor() - { - return functionAuthor; - } - - public void setFunctionAuthor(String functionAuthor) - { - this.functionAuthor = functionAuthor; - } - - public String getGenType() - { - return genType; - } - - public void setGenType(String genType) - { - this.genType = genType; - } - - public String getGenPath() - { - return genPath; - } - - public void setGenPath(String genPath) - { - this.genPath = genPath; - } - - public GenTableColumn getPkColumn() - { - return pkColumn; - } - - public void setPkColumn(GenTableColumn pkColumn) - { - this.pkColumn = pkColumn; - } - - public GenTable getSubTable() - { - return subTable; - } - - public void setSubTable(GenTable subTable) - { - this.subTable = subTable; - } - - public List getColumns() - { - return columns; - } - - public void setColumns(List columns) - { - this.columns = columns; - } - - public String getOptions() - { - return options; - } - - public void setOptions(String options) - { - this.options = options; - } - - public String getTreeCode() - { - return treeCode; - } - - public void setTreeCode(String treeCode) - { - this.treeCode = treeCode; - } - - public String getTreeParentCode() - { - return treeParentCode; - } - - public void setTreeParentCode(String treeParentCode) - { - this.treeParentCode = treeParentCode; - } - - public String getTreeName() - { - return treeName; - } - - public void setTreeName(String treeName) - { - this.treeName = treeName; - } - - public String getParentMenuId() - { - return parentMenuId; - } - - public void setParentMenuId(String parentMenuId) - { - this.parentMenuId = parentMenuId; - } - - public String getParentMenuName() - { - return parentMenuName; - } - - public void setParentMenuName(String parentMenuName) - { - this.parentMenuName = parentMenuName; - } - - public boolean isSub() - { - return isSub(this.tplCategory); - } - - public static boolean isSub(String tplCategory) - { - return tplCategory != null && StringUtils.equals(GenConstants.TPL_SUB, tplCategory); - } - - public boolean isTree() - { - return isTree(this.tplCategory); - } - - public static boolean isTree(String tplCategory) - { - return tplCategory != null && StringUtils.equals(GenConstants.TPL_TREE, tplCategory); - } - - public boolean isCrud() - { - return isCrud(this.tplCategory); - } - - public static boolean isCrud(String tplCategory) - { - return tplCategory != null && StringUtils.equals(GenConstants.TPL_CRUD, tplCategory); - } - - public boolean isSuperColumn(String javaField) - { - return isSuperColumn(this.tplCategory, javaField); - } - - public static boolean isSuperColumn(String tplCategory, String javaField) - { - if (isTree(tplCategory)) - { - return StringUtils.equalsAnyIgnoreCase(javaField, - ArrayUtils.addAll(GenConstants.TREE_ENTITY, GenConstants.BASE_ENTITY)); - } - return StringUtils.equalsAnyIgnoreCase(javaField, GenConstants.BASE_ENTITY); - } -} \ No newline at end of file diff --git a/mate-support/mate-generator/src/main/java/vip/mate/generator/entity/GenTableColumn.java b/mate-support/mate-generator/src/main/java/vip/mate/generator/entity/GenTableColumn.java deleted file mode 100644 index aad2c7b0eb572f6b4648cb53b505372e148de5a4..0000000000000000000000000000000000000000 --- a/mate-support/mate-generator/src/main/java/vip/mate/generator/entity/GenTableColumn.java +++ /dev/null @@ -1,375 +0,0 @@ -package vip.mate.generator.entity; - - -import org.apache.commons.lang3.StringUtils; -import vip.mate.core.database.entity.BaseEntity; - -import javax.validation.constraints.NotBlank; - -/** - * 代码生成业务字段表 gen_table_column - * - * @author ruoyi - */ -public class GenTableColumn extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** 编号 */ - private Long columnId; - - /** 归属表编号 */ - private Long tableId; - - /** 列名称 */ - private String columnName; - - /** 列描述 */ - private String columnComment; - - /** 列类型 */ - private String columnType; - - /** JAVA类型 */ - private String javaType; - - /** JAVA字段名 */ - @NotBlank(message = "Java属性不能为空") - private String javaField; - - /** 是否主键(1是) */ - private String isPk; - - /** 是否自增(1是) */ - private String isIncrement; - - /** 是否必填(1是) */ - private String isRequired; - - /** 是否为插入字段(1是) */ - private String isInsert; - - /** 是否编辑字段(1是) */ - private String isEdit; - - /** 是否列表字段(1是) */ - private String isList; - - /** 是否查询字段(1是) */ - private String isQuery; - - /** 查询方式(EQ等于、NE不等于、GT大于、LT小于、LIKE模糊、BETWEEN范围) */ - private String queryType; - - /** 显示类型(input文本框、textarea文本域、select下拉框、checkbox复选框、radio单选框、datetime日期控件、image图片上传控件、upload文件上传控件、editor富文本控件) */ - private String htmlType; - - /** 字典类型 */ - private String dictType; - - /** 排序 */ - private Integer sort; - - public void setColumnId(Long columnId) - { - this.columnId = columnId; - } - - public Long getColumnId() - { - return columnId; - } - - public void setTableId(Long tableId) - { - this.tableId = tableId; - } - - public Long getTableId() - { - return tableId; - } - - public void setColumnName(String columnName) - { - this.columnName = columnName; - } - - public String getColumnName() - { - return columnName; - } - - public void setColumnComment(String columnComment) - { - this.columnComment = columnComment; - } - - public String getColumnComment() - { - return columnComment; - } - - public void setColumnType(String columnType) - { - this.columnType = columnType; - } - - public String getColumnType() - { - return columnType; - } - - public void setJavaType(String javaType) - { - this.javaType = javaType; - } - - public String getJavaType() - { - return javaType; - } - - public void setJavaField(String javaField) - { - this.javaField = javaField; - } - - public String getJavaField() - { - return javaField; - } - - public String getCapJavaField() - { - return StringUtils.capitalize(javaField); - } - - public void setIsPk(String isPk) - { - this.isPk = isPk; - } - - public String getIsPk() - { - return isPk; - } - - public boolean isPk() - { - return isPk(this.isPk); - } - - public boolean isPk(String isPk) - { - return isPk != null && StringUtils.equals("1", isPk); - } - - public String getIsIncrement() - { - return isIncrement; - } - - public void setIsIncrement(String isIncrement) - { - this.isIncrement = isIncrement; - } - - public boolean isIncrement() - { - return isIncrement(this.isIncrement); - } - - public boolean isIncrement(String isIncrement) - { - return isIncrement != null && StringUtils.equals("1", isIncrement); - } - - public void setIsRequired(String isRequired) - { - this.isRequired = isRequired; - } - - public String getIsRequired() - { - return isRequired; - } - - public boolean isRequired() - { - return isRequired(this.isRequired); - } - - public boolean isRequired(String isRequired) - { - return isRequired != null && StringUtils.equals("1", isRequired); - } - - public void setIsInsert(String isInsert) - { - this.isInsert = isInsert; - } - - public String getIsInsert() - { - return isInsert; - } - - public boolean isInsert() - { - return isInsert(this.isInsert); - } - - public boolean isInsert(String isInsert) - { - return isInsert != null && StringUtils.equals("1", isInsert); - } - - public void setIsEdit(String isEdit) - { - this.isEdit = isEdit; - } - - public String getIsEdit() - { - return isEdit; - } - - public boolean isEdit() - { - return isInsert(this.isEdit); - } - - public boolean isEdit(String isEdit) - { - return isEdit != null && StringUtils.equals("1", isEdit); - } - - public void setIsList(String isList) - { - this.isList = isList; - } - - public String getIsList() - { - return isList; - } - - public boolean isList() - { - return isList(this.isList); - } - - public boolean isList(String isList) - { - return isList != null && StringUtils.equals("1", isList); - } - - public void setIsQuery(String isQuery) - { - this.isQuery = isQuery; - } - - public String getIsQuery() - { - return isQuery; - } - - public boolean isQuery() - { - return isQuery(this.isQuery); - } - - public boolean isQuery(String isQuery) - { - return isQuery != null && StringUtils.equals("1", isQuery); - } - - public void setQueryType(String queryType) - { - this.queryType = queryType; - } - - public String getQueryType() - { - return queryType; - } - - public String getHtmlType() - { - return htmlType; - } - - public void setHtmlType(String htmlType) - { - this.htmlType = htmlType; - } - - public void setDictType(String dictType) - { - this.dictType = dictType; - } - - public String getDictType() - { - return dictType; - } - - public void setSort(Integer sort) - { - this.sort = sort; - } - - public Integer getSort() - { - return sort; - } - - public boolean isSuperColumn() - { - return isSuperColumn(this.javaField); - } - - public static boolean isSuperColumn(String javaField) - { - return StringUtils.equalsAnyIgnoreCase(javaField, - // BaseEntity - "createBy", "createTime", "updateBy", "updateTime", "remark", - // TreeEntity - "parentName", "parentId", "orderNum", "ancestors"); - } - - public boolean isUsableColumn() - { - return isUsableColumn(javaField); - } - - public static boolean isUsableColumn(String javaField) - { - // isSuperColumn()中的名单用于避免生成多余Domain属性,若某些属性在生成页面时需要用到不能忽略,则放在此处白名单 - return StringUtils.equalsAnyIgnoreCase(javaField, "parentId", "orderNum", "remark"); - } - - public String readConverterExp() - { - String remarks = StringUtils.substringBetween(this.columnComment, "(", ")"); - StringBuffer sb = new StringBuffer(); - if (StringUtils.isNotEmpty(remarks)) - { - for (String value : remarks.split(" ")) - { - if (StringUtils.isNotEmpty(value)) - { - Object startStr = value.subSequence(0, 1); - String endStr = value.substring(1); - sb.append("").append(startStr).append("=").append(endStr).append(","); - } - } - return sb.deleteCharAt(sb.length() - 1).toString(); - } - else - { - return this.columnComment; - } - } -} diff --git a/mate-support/mate-generator/src/main/java/vip/mate/generator/entity/PageDomain.java b/mate-support/mate-generator/src/main/java/vip/mate/generator/entity/PageDomain.java deleted file mode 100644 index ea7a47278cbba585c7b2f446b30f78393e34a6b6..0000000000000000000000000000000000000000 --- a/mate-support/mate-generator/src/main/java/vip/mate/generator/entity/PageDomain.java +++ /dev/null @@ -1,73 +0,0 @@ -package vip.mate.generator.entity; - - -import vip.mate.generator.util.StringUtils; - -/** - * 分页数据 - * - * @author ruoyi - */ -public class PageDomain -{ - /** 当前记录起始索引 */ - private Integer pageNum; - - /** 每页显示记录数 */ - private Integer pageSize; - - /** 排序列 */ - private String orderByColumn; - - /** 排序的方向desc或者asc */ - private String isAsc = "asc"; - - public String getOrderBy() - { - if (StringUtils.isEmpty(orderByColumn)) - { - return ""; - } - return StringUtils.toUnderScoreCase(orderByColumn) + " " + isAsc; - } - - public Integer getPageNum() - { - return pageNum; - } - - public void setPageNum(Integer pageNum) - { - this.pageNum = pageNum; - } - - public Integer getPageSize() - { - return pageSize; - } - - public void setPageSize(Integer pageSize) - { - this.pageSize = pageSize; - } - - public String getOrderByColumn() - { - return orderByColumn; - } - - public void setOrderByColumn(String orderByColumn) - { - this.orderByColumn = orderByColumn; - } - - public String getIsAsc() - { - return isAsc; - } - - public void setIsAsc(String isAsc) - { - this.isAsc = isAsc; - } -} diff --git a/mate-support/mate-generator/src/main/java/vip/mate/generator/entity/TableDataInfo.java b/mate-support/mate-generator/src/main/java/vip/mate/generator/entity/TableDataInfo.java deleted file mode 100644 index a82fc20e959c50d356e77ac4486facb20c345e9e..0000000000000000000000000000000000000000 --- a/mate-support/mate-generator/src/main/java/vip/mate/generator/entity/TableDataInfo.java +++ /dev/null @@ -1,85 +0,0 @@ -package vip.mate.generator.entity; - -import java.io.Serializable; -import java.util.List; - -/** - * 表格分页数据对象 - * - * @author ruoyi - */ -public class TableDataInfo implements Serializable -{ - private static final long serialVersionUID = 1L; - - /** 总记录数 */ - private long total; - - /** 列表数据 */ - private List rows; - - /** 消息状态码 */ - private int code; - - /** 消息内容 */ - private String msg; - - /** - * 表格数据对象 - */ - public TableDataInfo() - { - } - - /** - * 分页 - * - * @param list 列表数据 - * @param total 总记录数 - */ - public TableDataInfo(List list, int total) - { - this.rows = list; - this.total = total; - } - - public long getTotal() - { - return total; - } - - public void setTotal(long total) - { - this.total = total; - } - - public List getRows() - { - return rows; - } - - public void setRows(List rows) - { - this.rows = rows; - } - - public int getCode() - { - return code; - } - - public void setCode(int code) - { - this.code = code; - } - - public String getMsg() - { - return msg; - } - - public void setMsg(String msg) - { - this.msg = msg; - } -} diff --git a/mate-support/mate-generator/src/main/java/vip/mate/generator/entity/TableSupport.java b/mate-support/mate-generator/src/main/java/vip/mate/generator/entity/TableSupport.java deleted file mode 100644 index 8ce8731496a2c52ad2390fc2cd0c12bc96b9845b..0000000000000000000000000000000000000000 --- a/mate-support/mate-generator/src/main/java/vip/mate/generator/entity/TableSupport.java +++ /dev/null @@ -1,50 +0,0 @@ -package vip.mate.generator.entity; - - -import vip.mate.generator.util.ServletUtils; - -/** - * 表格数据处理 - * - * @author ruoyi - */ -public class TableSupport -{ - /** - * 当前记录起始索引 - */ - public static final String PAGE_NUM = "pageNum"; - - /** - * 每页显示记录数 - */ - public static final String PAGE_SIZE = "pageSize"; - - /** - * 排序列 - */ - public static final String ORDER_BY_COLUMN = "orderByColumn"; - - /** - * 排序的方向 "desc" 或者 "asc". - */ - public static final String IS_ASC = "isAsc"; - - /** - * 封装分页对象 - */ - public static PageDomain getPageDomain() - { - PageDomain pageDomain = new PageDomain(); - pageDomain.setPageNum(ServletUtils.getParameterToInt(PAGE_NUM)); - pageDomain.setPageSize(ServletUtils.getParameterToInt(PAGE_SIZE)); - pageDomain.setOrderByColumn(ServletUtils.getParameter(ORDER_BY_COLUMN)); - pageDomain.setIsAsc(ServletUtils.getParameter(IS_ASC)); - return pageDomain; - } - - public static PageDomain buildPageRequest() - { - return getPageDomain(); - } -} diff --git a/mate-support/mate-generator/src/main/java/vip/mate/generator/entity/package-info.java b/mate-support/mate-generator/src/main/java/vip/mate/generator/entity/package-info.java deleted file mode 100644 index 24cb61f73645e418d6c58bf38d7fb033a8c687e0..0000000000000000000000000000000000000000 --- a/mate-support/mate-generator/src/main/java/vip/mate/generator/entity/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package vip.mate.generator.entity; \ No newline at end of file diff --git a/mate-support/mate-generator/src/main/java/vip/mate/generator/mapper/GenTableColumnMapper.java b/mate-support/mate-generator/src/main/java/vip/mate/generator/mapper/GenTableColumnMapper.java deleted file mode 100644 index d524b4c399d7aa61603620c6f921c4c4e320a619..0000000000000000000000000000000000000000 --- a/mate-support/mate-generator/src/main/java/vip/mate/generator/mapper/GenTableColumnMapper.java +++ /dev/null @@ -1,61 +0,0 @@ -package vip.mate.generator.mapper; - -import vip.mate.generator.entity.GenTableColumn; - -import java.util.List; - -/** - * 业务字段 数据层 - * - * @author ruoyi - */ -public interface GenTableColumnMapper -{ - /** - * 根据表名称查询列信息 - * - * @param tableName 表名称 - * @return 列信息 - */ - public List selectDbTableColumnsByName(String tableName); - - /** - * 查询业务字段列表 - * - * @param tableId 业务字段编号 - * @return 业务字段集合 - */ - public List selectGenTableColumnListByTableId(Long tableId); - - /** - * 新增业务字段 - * - * @param genTableColumn 业务字段信息 - * @return 结果 - */ - public int insertGenTableColumn(GenTableColumn genTableColumn); - - /** - * 修改业务字段 - * - * @param genTableColumn 业务字段信息 - * @return 结果 - */ - public int updateGenTableColumn(GenTableColumn genTableColumn); - - /** - * 删除业务字段 - * - * @param genTableColumns 列数据 - * @return 结果 - */ - public int deleteGenTableColumns(List genTableColumns); - - /** - * 批量删除业务字段 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteGenTableColumnByIds(Long[] ids); -} diff --git a/mate-support/mate-generator/src/main/java/vip/mate/generator/mapper/GenTableColumnMapper.xml b/mate-support/mate-generator/src/main/java/vip/mate/generator/mapper/GenTableColumnMapper.xml deleted file mode 100644 index b46e4ba26d512bd899ebc213f10c348472079cc9..0000000000000000000000000000000000000000 --- a/mate-support/mate-generator/src/main/java/vip/mate/generator/mapper/GenTableColumnMapper.xml +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - select column_id, table_id, column_name, column_comment, column_type, java_type, java_field, is_pk, is_increment, is_required, is_insert, is_edit, is_list, is_query, query_type, html_type, dict_type, sort, create_by, create_time, update_by, update_time from gen_table_column - - - - - - - - insert into gen_table_column ( - table_id, - column_name, - column_comment, - column_type, - java_type, - java_field, - is_pk, - is_increment, - is_required, - is_insert, - is_edit, - is_list, - is_query, - query_type, - html_type, - dict_type, - sort, - create_by, - create_time - )values( - #{tableId}, - #{columnName}, - #{columnComment}, - #{columnType}, - #{javaType}, - #{javaField}, - #{isPk}, - #{isIncrement}, - #{isRequired}, - #{isInsert}, - #{isEdit}, - #{isList}, - #{isQuery}, - #{queryType}, - #{htmlType}, - #{dictType}, - #{sort}, - #{createBy}, - sysdate() - ) - - - - update gen_table_column - - column_comment = #{columnComment}, - java_type = #{javaType}, - java_field = #{javaField}, - is_insert = #{isInsert}, - is_edit = #{isEdit}, - is_list = #{isList}, - is_query = #{isQuery}, - is_required = #{isRequired}, - query_type = #{queryType}, - html_type = #{htmlType}, - dict_type = #{dictType}, - sort = #{sort}, - update_by = #{updateBy}, - update_time = sysdate() - - where column_id = #{columnId} - - - - delete from gen_table_column where table_id in - - #{tableId} - - - - - delete from gen_table_column where column_id in - - #{item.columnId} - - - - \ No newline at end of file diff --git a/mate-support/mate-generator/src/main/java/vip/mate/generator/mapper/GenTableMapper.java b/mate-support/mate-generator/src/main/java/vip/mate/generator/mapper/GenTableMapper.java deleted file mode 100644 index 374a6bd56e7eb65525c7492fe2430896532939f9..0000000000000000000000000000000000000000 --- a/mate-support/mate-generator/src/main/java/vip/mate/generator/mapper/GenTableMapper.java +++ /dev/null @@ -1,85 +0,0 @@ -package vip.mate.generator.mapper; - - -import vip.mate.generator.entity.GenTable; - -import java.util.List; - -/** - * 业务 数据层 - * - * @author ruoyi - */ -public interface GenTableMapper -{ - /** - * 查询业务列表 - * - * @param genTable 业务信息 - * @return 业务集合 - */ - public List selectGenTableList(GenTable genTable); - - /** - * 查询据库列表 - * - * @param genTable 业务信息 - * @return 数据库表集合 - */ - public List selectDbTableList(GenTable genTable); - - /** - * 查询据库列表 - * - * @param tableNames 表名称组 - * @return 数据库表集合 - */ - public List selectDbTableListByNames(String[] tableNames); - - /** - * 查询所有表信息 - * - * @return 表信息集合 - */ - public List selectGenTableAll(); - - /** - * 查询表ID业务信息 - * - * @param id 业务ID - * @return 业务信息 - */ - public GenTable selectGenTableById(Long id); - - /** - * 查询表名称业务信息 - * - * @param tableName 表名称 - * @return 业务信息 - */ - public GenTable selectGenTableByName(String tableName); - - /** - * 新增业务 - * - * @param genTable 业务信息 - * @return 结果 - */ - public int insertGenTable(GenTable genTable); - - /** - * 修改业务 - * - * @param genTable 业务信息 - * @return 结果 - */ - public int updateGenTable(GenTable genTable); - - /** - * 批量删除业务 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteGenTableByIds(Long[] ids); -} diff --git a/mate-support/mate-generator/src/main/java/vip/mate/generator/mapper/GenTableMapper.xml b/mate-support/mate-generator/src/main/java/vip/mate/generator/mapper/GenTableMapper.xml deleted file mode 100644 index 417e7b1d4944b9813650e9f58d73546725477767..0000000000000000000000000000000000000000 --- a/mate-support/mate-generator/src/main/java/vip/mate/generator/mapper/GenTableMapper.xml +++ /dev/null @@ -1,201 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - select table_id, table_name, table_comment, sub_table_name, sub_table_fk_name, class_name, tpl_category, package_name, module_name, business_name, function_name, function_author, gen_type, gen_path, options, create_by, create_time, update_by, update_time, remark from gen_table - - - - - - - - - - - - - - - - - - insert into gen_table ( - table_name, - table_comment, - class_name, - tpl_category, - package_name, - module_name, - business_name, - function_name, - function_author, - gen_type, - gen_path, - remark, - create_by, - create_time - )values( - #{tableName}, - #{tableComment}, - #{className}, - #{tplCategory}, - #{packageName}, - #{moduleName}, - #{businessName}, - #{functionName}, - #{functionAuthor}, - #{genType}, - #{genPath}, - #{remark}, - #{createBy}, - sysdate() - ) - - - - update gen_table - - table_name = #{tableName}, - table_comment = #{tableComment}, - sub_table_name = #{subTableName}, - sub_table_fk_name = #{subTableFkName}, - class_name = #{className}, - function_author = #{functionAuthor}, - gen_type = #{genType}, - gen_path = #{genPath}, - tpl_category = #{tplCategory}, - package_name = #{packageName}, - module_name = #{moduleName}, - business_name = #{businessName}, - function_name = #{functionName}, - options = #{options}, - update_by = #{updateBy}, - remark = #{remark}, - update_time = sysdate() - - where table_id = #{tableId} - - - - delete from gen_table where table_id in - - #{tableId} - - - - \ No newline at end of file diff --git a/mate-support/mate-generator/src/main/java/vip/mate/generator/mapper/package-info.java b/mate-support/mate-generator/src/main/java/vip/mate/generator/mapper/package-info.java deleted file mode 100644 index d1c51620f972e417673be419fd8737f95acb0648..0000000000000000000000000000000000000000 --- a/mate-support/mate-generator/src/main/java/vip/mate/generator/mapper/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package vip.mate.generator.mapper; \ No newline at end of file diff --git a/mate-support/mate-generator/src/main/java/vip/mate/generator/service/GenTableColumnServiceImpl.java b/mate-support/mate-generator/src/main/java/vip/mate/generator/service/GenTableColumnServiceImpl.java deleted file mode 100644 index 00720b4ec31be18cbe7722f588b32ddb47719823..0000000000000000000000000000000000000000 --- a/mate-support/mate-generator/src/main/java/vip/mate/generator/service/GenTableColumnServiceImpl.java +++ /dev/null @@ -1,129 +0,0 @@ -package vip.mate.generator.service; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import vip.mate.generator.entity.GenTableColumn; -import vip.mate.generator.mapper.GenTableColumnMapper; -import vip.mate.generator.util.StringUtils; - -import java.math.BigDecimal; -import java.util.List; - -/** - * 业务字段 服务层实现 - * - * @author ruoyi - */ -@Service -public class GenTableColumnServiceImpl implements IGenTableColumnService -{ - @Autowired - private GenTableColumnMapper genTableColumnMapper; - - /** - * 查询业务字段列表 - * - * @param tableId 业务字段编号 - * @return 业务字段集合 - */ - @Override - public List selectGenTableColumnListByTableId(Long tableId) - { - return genTableColumnMapper.selectGenTableColumnListByTableId(tableId); - } - - /** - * 新增业务字段 - * - * @param genTableColumn 业务字段信息 - * @return 结果 - */ - @Override - public int insertGenTableColumn(GenTableColumn genTableColumn) - { - return genTableColumnMapper.insertGenTableColumn(genTableColumn); - } - - /** - * 修改业务字段 - * - * @param genTableColumn 业务字段信息 - * @return 结果 - */ - @Override - public int updateGenTableColumn(GenTableColumn genTableColumn) - { - return genTableColumnMapper.updateGenTableColumn(genTableColumn); - } - - /** - * 删除业务字段对象 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - @Override - public int deleteGenTableColumnByIds(String ids) - { - return genTableColumnMapper.deleteGenTableColumnByIds(toLongArray(",",ids)); - } - - private Long[] toLongArray(String split, String str) - { - if (StringUtils.isEmpty(str)) - { - return new Long[] {}; - } - String[] arr = str.split(split); - final Long[] longs = new Long[arr.length]; - for (int i = 0; i < arr.length; i++) - { - final Long v = toLong(arr[i], null); - longs[i] = v; - } - return longs; - } - - private Long toLong(Object value, Long defaultValue) - { - if (value == null) - { - return defaultValue; - } - if (value instanceof Long) - { - return (Long) value; - } - if (value instanceof Number) - { - return ((Number) value).longValue(); - } - final String valueStr = toStr(value, null); - if (StringUtils.isEmpty(valueStr)) - { - return defaultValue; - } - try - { - // 支持科学计数法 - return new BigDecimal(valueStr.trim()).longValue(); - } - catch (Exception e) - { - return defaultValue; - } - } - - private String toStr(Object value, String defaultValue) - { - if (null == value) - { - return defaultValue; - } - if (value instanceof String) - { - return (String) value; - } - return value.toString(); - } -} diff --git a/mate-support/mate-generator/src/main/java/vip/mate/generator/service/GenTableServiceImpl.java b/mate-support/mate-generator/src/main/java/vip/mate/generator/service/GenTableServiceImpl.java deleted file mode 100644 index f440b026d9706b779e0cb41463badc9a1eb6f7c6..0000000000000000000000000000000000000000 --- a/mate-support/mate-generator/src/main/java/vip/mate/generator/service/GenTableServiceImpl.java +++ /dev/null @@ -1,498 +0,0 @@ -package vip.mate.generator.service; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import org.apache.commons.io.FileUtils; -import org.apache.commons.io.IOUtils; -import org.apache.velocity.Template; -import org.apache.velocity.VelocityContext; -import org.apache.velocity.app.Velocity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import vip.mate.core.common.exception.BaseException; -import vip.mate.generator.entity.GenConstants; -import vip.mate.generator.entity.GenTable; -import vip.mate.generator.entity.GenTableColumn; -import vip.mate.generator.mapper.GenTableColumnMapper; -import vip.mate.generator.mapper.GenTableMapper; -import vip.mate.generator.util.GenUtils; -import vip.mate.generator.util.StringUtils; -import vip.mate.generator.util.VelocityInitializer; -import vip.mate.generator.util.VelocityUtils; - -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.IOException; -import java.io.StringWriter; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.zip.ZipEntry; -import java.util.zip.ZipOutputStream; - -/** - * 业务 服务层实现 - * - * @author ruoyi - */ -@Service -public class GenTableServiceImpl implements IGenTableService -{ - private static final Logger log = LoggerFactory.getLogger(GenTableServiceImpl.class); - - @Autowired - private GenTableMapper genTableMapper; - - @Autowired - private GenTableColumnMapper genTableColumnMapper; - - /** - * 查询业务信息 - * - * @param id 业务ID - * @return 业务信息 - */ - @Override - public GenTable selectGenTableById(Long id) - { - GenTable genTable = genTableMapper.selectGenTableById(id); - setTableFromOptions(genTable); - return genTable; - } - - /** - * 查询业务列表 - * - * @param genTable 业务信息 - * @return 业务集合 - */ - @Override - public List selectGenTableList(GenTable genTable) - { - return genTableMapper.selectGenTableList(genTable); - } - - /** - * 查询据库列表 - * - * @param genTable 业务信息 - * @return 数据库表集合 - */ - @Override - public List selectDbTableList(GenTable genTable) - { - return genTableMapper.selectDbTableList(genTable); - } - - /** - * 查询据库列表 - * - * @param tableNames 表名称组 - * @return 数据库表集合 - */ - @Override - public List selectDbTableListByNames(String[] tableNames) - { - return genTableMapper.selectDbTableListByNames(tableNames); - } - - /** - * 查询所有表信息 - * - * @return 表信息集合 - */ - @Override - public List selectGenTableAll() - { - return genTableMapper.selectGenTableAll(); - } - - /** - * 修改业务 - * - * @param genTable 业务信息 - * @return 结果 - */ - @Override - @Transactional - public void updateGenTable(GenTable genTable) - { - String options = JSON.toJSONString(genTable.getParams()); - genTable.setOptions(options); - int row = genTableMapper.updateGenTable(genTable); - if (row > 0) - { - for (GenTableColumn cenTableColumn : genTable.getColumns()) - { - genTableColumnMapper.updateGenTableColumn(cenTableColumn); - } - } - } - - /** - * 删除业务对象 - * - * @param tableIds 需要删除的数据ID - * @return 结果 - */ - @Override - @Transactional - public void deleteGenTableByIds(Long[] tableIds) - { - genTableMapper.deleteGenTableByIds(tableIds); - genTableColumnMapper.deleteGenTableColumnByIds(tableIds); - } - - /** - * 导入表结构 - * - * @param tableList 导入表列表 - */ - @Override - @Transactional - public void importGenTable(List tableList) - { - String operName = "admin"; - try - { - for (GenTable table : tableList) - { - String tableName = table.getTableName(); - GenUtils.initTable(table, operName); - int row = genTableMapper.insertGenTable(table); - if (row > 0) - { - // 保存列信息 - List genTableColumns = genTableColumnMapper.selectDbTableColumnsByName(tableName); - for (GenTableColumn column : genTableColumns) - { - GenUtils.initColumnField(column, table); - genTableColumnMapper.insertGenTableColumn(column); - } - } - } - } - catch (Exception e) - { - throw new BaseException("导入失败:" + e.getMessage()); - } - } - - /** - * 预览代码 - * - * @param tableId 表编号 - * @return 预览数据列表 - */ - @Override - public Map previewCode(Long tableId) - { - Map dataMap = new LinkedHashMap<>(); - // 查询表信息 - GenTable table = genTableMapper.selectGenTableById(tableId); - // 设置主子表信息 - setSubTable(table); - // 设置主键列信息 - setPkColumn(table); - VelocityInitializer.initVelocity(); - - VelocityContext context = VelocityUtils.prepareContext(table); - - // 获取模板列表 - List templates = VelocityUtils.getTemplateList(table.getTplCategory()); - for (String template : templates) - { - // 渲染模板 - StringWriter sw = new StringWriter(); - Template tpl = Velocity.getTemplate(template, "UTF-8"); - tpl.merge(context, sw); - dataMap.put(template, sw.toString()); - } - return dataMap; - } - - /** - * 生成代码(下载方式) - * - * @param tableName 表名称 - * @return 数据 - */ - @Override - public byte[] downloadCode(String tableName) - { - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - ZipOutputStream zip = new ZipOutputStream(outputStream); - generatorCode(tableName, zip); - IOUtils.closeQuietly(zip); - return outputStream.toByteArray(); - } - - /** - * 生成代码(自定义路径) - * - * @param tableName 表名称 - */ - @Override - public void generatorCode(String tableName) - { - // 查询表信息 - GenTable table = genTableMapper.selectGenTableByName(tableName); - // 设置主子表信息 - setSubTable(table); - // 设置主键列信息 - setPkColumn(table); - - VelocityInitializer.initVelocity(); - - VelocityContext context = VelocityUtils.prepareContext(table); - - // 获取模板列表 - List templates = VelocityUtils.getTemplateList(table.getTplCategory()); - for (String template : templates) - { - if (!StringUtils.containsAny(template, "sql.vm", "api.js.vm", "index.vue.vm", "index-tree.vue.vm")) - { - // 渲染模板 - StringWriter sw = new StringWriter(); - Template tpl = Velocity.getTemplate(template, "UTF-8"); - tpl.merge(context, sw); - try - { - String path = getGenPath(table, template); - FileUtils.writeStringToFile(new File(path), sw.toString(), "UTF-8"); - } - catch (IOException e) - { - throw new BaseException("渲染模板失败,表名:" + table.getTableName()); - } - } - } - } - - /** - * 同步数据库 - * - * @param tableName 表名称 - */ - @Override - @Transactional - public void synchDb(String tableName) - { - GenTable table = genTableMapper.selectGenTableByName(tableName); - List tableColumns = table.getColumns(); - List tableColumnNames = tableColumns.stream().map(GenTableColumn::getColumnName).collect(Collectors.toList()); - - List dbTableColumns = genTableColumnMapper.selectDbTableColumnsByName(tableName); - if (StringUtils.isEmpty(dbTableColumns)) - { - throw new BaseException("同步数据失败,原表结构不存在"); - } - List dbTableColumnNames = dbTableColumns.stream().map(GenTableColumn::getColumnName).collect(Collectors.toList()); - - dbTableColumns.forEach(column -> { - if (!tableColumnNames.contains(column.getColumnName())) - { - GenUtils.initColumnField(column, table); - genTableColumnMapper.insertGenTableColumn(column); - } - }); - - List delColumns = tableColumns.stream().filter(column -> !dbTableColumnNames.contains(column.getColumnName())).collect(Collectors.toList()); - if (StringUtils.isNotEmpty(delColumns)) - { - genTableColumnMapper.deleteGenTableColumns(delColumns); - } - } - - /** - * 批量生成代码(下载方式) - * - * @param tableNames 表数组 - * @return 数据 - */ - @Override - public byte[] downloadCode(String[] tableNames) - { - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - ZipOutputStream zip = new ZipOutputStream(outputStream); - for (String tableName : tableNames) - { - generatorCode(tableName, zip); - } - IOUtils.closeQuietly(zip); - return outputStream.toByteArray(); - } - - /** - * 查询表信息并生成代码 - */ - private void generatorCode(String tableName, ZipOutputStream zip) - { - // 查询表信息 - GenTable table = genTableMapper.selectGenTableByName(tableName); - // 设置主子表信息 - setSubTable(table); - // 设置主键列信息 - setPkColumn(table); - - VelocityInitializer.initVelocity(); - - VelocityContext context = VelocityUtils.prepareContext(table); - - // 获取模板列表 - List templates = VelocityUtils.getTemplateList(table.getTplCategory()); - for (String template : templates) - { - // 渲染模板 - StringWriter sw = new StringWriter(); - Template tpl = Velocity.getTemplate(template, "UTF-8"); - tpl.merge(context, sw); - try - { - // 添加到zip - zip.putNextEntry(new ZipEntry(VelocityUtils.getFileName(template, table))); - IOUtils.write(sw.toString(), zip, "UTF-8"); - IOUtils.closeQuietly(sw); - zip.flush(); - zip.closeEntry(); - } - catch (IOException e) - { - log.error("渲染模板失败,表名:" + table.getTableName(), e); - } - } - } - - /** - * 修改保存参数校验 - * - * @param genTable 业务信息 - */ - @Override - public void validateEdit(GenTable genTable) - { - if (GenConstants.TPL_TREE.equals(genTable.getTplCategory())) - { - String options = JSON.toJSONString(genTable.getParams()); - JSONObject paramsObj = JSONObject.parseObject(options); - if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_CODE))) - { - throw new BaseException("树编码字段不能为空"); - } - else if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_PARENT_CODE))) - { - throw new BaseException("树父编码字段不能为空"); - } - else if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_NAME))) - { - throw new BaseException("树名称字段不能为空"); - } - else if (GenConstants.TPL_SUB.equals(genTable.getTplCategory())) - { - if (StringUtils.isEmpty(genTable.getSubTableName())) - { - throw new BaseException("关联子表的表名不能为空"); - } - else if (StringUtils.isEmpty(genTable.getSubTableFkName())) - { - throw new BaseException("子表关联的外键名不能为空"); - } - } - } - } - - /** - * 设置主键列信息 - * - * @param table 业务表信息 - */ - public void setPkColumn(GenTable table) - { - for (GenTableColumn column : table.getColumns()) - { - if (column.isPk()) - { - table.setPkColumn(column); - break; - } - } - if (StringUtils.isNull(table.getPkColumn())) - { - table.setPkColumn(table.getColumns().get(0)); - } - if (GenConstants.TPL_SUB.equals(table.getTplCategory())) - { - for (GenTableColumn column : table.getSubTable().getColumns()) - { - if (column.isPk()) - { - table.getSubTable().setPkColumn(column); - break; - } - } - if (StringUtils.isNull(table.getSubTable().getPkColumn())) - { - table.getSubTable().setPkColumn(table.getSubTable().getColumns().get(0)); - } - } - } - - /** - * 设置主子表信息 - * - * @param table 业务表信息 - */ - public void setSubTable(GenTable table) - { - String subTableName = table.getSubTableName(); - if (StringUtils.isNotEmpty(subTableName)) - { - table.setSubTable(genTableMapper.selectGenTableByName(subTableName)); - } - } - - /** - * 设置代码生成其他选项值 - * - * @param genTable 设置后的生成对象 - */ - public void setTableFromOptions(GenTable genTable) - { - JSONObject paramsObj = JSONObject.parseObject(genTable.getOptions()); - if (StringUtils.isNotNull(paramsObj)) - { - String treeCode = paramsObj.getString(GenConstants.TREE_CODE); - String treeParentCode = paramsObj.getString(GenConstants.TREE_PARENT_CODE); - String treeName = paramsObj.getString(GenConstants.TREE_NAME); - String parentMenuId = paramsObj.getString(GenConstants.PARENT_MENU_ID); - String parentMenuName = paramsObj.getString(GenConstants.PARENT_MENU_NAME); - - genTable.setTreeCode(treeCode); - genTable.setTreeParentCode(treeParentCode); - genTable.setTreeName(treeName); - genTable.setParentMenuId(parentMenuId); - genTable.setParentMenuName(parentMenuName); - } - } - - /** - * 获取代码生成地址 - * - * @param table 业务表信息 - * @param template 模板文件路径 - * @return 生成地址 - */ - public static String getGenPath(GenTable table, String template) - { - String genPath = table.getGenPath(); - if (StringUtils.equals(genPath, "/")) - { - return System.getProperty("user.dir") + File.separator + "src" + File.separator + VelocityUtils.getFileName(template, table); - } - return genPath + File.separator + VelocityUtils.getFileName(template, table); - } -} \ No newline at end of file diff --git a/mate-support/mate-generator/src/main/java/vip/mate/generator/service/IGenTableColumnService.java b/mate-support/mate-generator/src/main/java/vip/mate/generator/service/IGenTableColumnService.java deleted file mode 100644 index 0581e4cb8c9608bf9accb67aa29fcbd8688087d3..0000000000000000000000000000000000000000 --- a/mate-support/mate-generator/src/main/java/vip/mate/generator/service/IGenTableColumnService.java +++ /dev/null @@ -1,45 +0,0 @@ -package vip.mate.generator.service; - -import vip.mate.generator.entity.GenTableColumn; - -import java.util.List; - -/** - * 业务字段 服务层 - * - * @author ruoyi - */ -public interface IGenTableColumnService -{ - /** - * 查询业务字段列表 - * - * @param tableId 业务字段编号 - * @return 业务字段集合 - */ - public List selectGenTableColumnListByTableId(Long tableId); - - /** - * 新增业务字段 - * - * @param genTableColumn 业务字段信息 - * @return 结果 - */ - public int insertGenTableColumn(GenTableColumn genTableColumn); - - /** - * 修改业务字段 - * - * @param genTableColumn 业务字段信息 - * @return 结果 - */ - public int updateGenTableColumn(GenTableColumn genTableColumn); - - /** - * 删除业务字段信息 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteGenTableColumnByIds(String ids); -} diff --git a/mate-support/mate-generator/src/main/java/vip/mate/generator/service/IGenTableService.java b/mate-support/mate-generator/src/main/java/vip/mate/generator/service/IGenTableService.java deleted file mode 100644 index 14b788b5ffc8268fc138c3cbbbf7e8cf344937c8..0000000000000000000000000000000000000000 --- a/mate-support/mate-generator/src/main/java/vip/mate/generator/service/IGenTableService.java +++ /dev/null @@ -1,122 +0,0 @@ -package vip.mate.generator.service; - -import vip.mate.generator.entity.GenTable; - -import java.util.List; -import java.util.Map; - -/** - * 业务 服务层 - * - * @author ruoyi - */ -public interface IGenTableService -{ - /** - * 查询业务列表 - * - * @param genTable 业务信息 - * @return 业务集合 - */ - public List selectGenTableList(GenTable genTable); - - /** - * 查询据库列表 - * - * @param genTable 业务信息 - * @return 数据库表集合 - */ - public List selectDbTableList(GenTable genTable); - - /** - * 查询据库列表 - * - * @param tableNames 表名称组 - * @return 数据库表集合 - */ - public List selectDbTableListByNames(String[] tableNames); - - /** - * 查询所有表信息 - * - * @return 表信息集合 - */ - public List selectGenTableAll(); - - /** - * 查询业务信息 - * - * @param id 业务ID - * @return 业务信息 - */ - public GenTable selectGenTableById(Long id); - - /** - * 修改业务 - * - * @param genTable 业务信息 - * @return 结果 - */ - public void updateGenTable(GenTable genTable); - - /** - * 删除业务信息 - * - * @param tableIds 需要删除的表数据ID - * @return 结果 - */ - public void deleteGenTableByIds(Long[] tableIds); - - /** - * 导入表结构 - * - * @param tableList 导入表列表 - */ - public void importGenTable(List tableList); - - /** - * 预览代码 - * - * @param tableId 表编号 - * @return 预览数据列表 - */ - public Map previewCode(Long tableId); - - /** - * 生成代码(下载方式) - * - * @param tableName 表名称 - * @return 数据 - */ - public byte[] downloadCode(String tableName); - - /** - * 生成代码(自定义路径) - * - * @param tableName 表名称 - * @return 数据 - */ - public void generatorCode(String tableName); - - /** - * 同步数据库 - * - * @param tableName 表名称 - */ - public void synchDb(String tableName); - - /** - * 批量生成代码(下载方式) - * - * @param tableNames 表数组 - * @return 数据 - */ - public byte[] downloadCode(String[] tableNames); - - /** - * 修改保存参数校验 - * - * @param genTable 业务信息 - */ - public void validateEdit(GenTable genTable); -} diff --git a/mate-support/mate-generator/src/main/java/vip/mate/generator/service/package-info.java b/mate-support/mate-generator/src/main/java/vip/mate/generator/service/package-info.java deleted file mode 100644 index 24af3fd958841ad166fcccbc1ffec9dc7384a082..0000000000000000000000000000000000000000 --- a/mate-support/mate-generator/src/main/java/vip/mate/generator/service/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package vip.mate.generator.service; \ No newline at end of file diff --git a/mate-support/mate-generator/src/main/java/vip/mate/generator/util/Convert.java b/mate-support/mate-generator/src/main/java/vip/mate/generator/util/Convert.java deleted file mode 100644 index 17065c48d14da0f78ea2a661917563695bc3b8b5..0000000000000000000000000000000000000000 --- a/mate-support/mate-generator/src/main/java/vip/mate/generator/util/Convert.java +++ /dev/null @@ -1,998 +0,0 @@ -package vip.mate.generator.util; - -import java.math.BigDecimal; -import java.math.BigInteger; -import java.nio.ByteBuffer; -import java.nio.charset.Charset; -import java.text.NumberFormat; -import java.util.Set; - -/** - * 类型转换器 - * - * @author ruoyi - */ -public class Convert -{ - /** - * 转换为字符串
- * 如果给定的值为null,或者转换失败,返回默认值
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @param defaultValue 转换错误时的默认值 - * @return 结果 - */ - public static String toStr(Object value, String defaultValue) - { - if (null == value) - { - return defaultValue; - } - if (value instanceof String) - { - return (String) value; - } - return value.toString(); - } - - /** - * 转换为字符串
- * 如果给定的值为null,或者转换失败,返回默认值null
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @return 结果 - */ - public static String toStr(Object value) - { - return toStr(value, null); - } - - /** - * 转换为字符
- * 如果给定的值为null,或者转换失败,返回默认值
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @param defaultValue 转换错误时的默认值 - * @return 结果 - */ - public static Character toChar(Object value, Character defaultValue) - { - if (null == value) - { - return defaultValue; - } - if (value instanceof Character) - { - return (Character) value; - } - - final String valueStr = toStr(value, null); - return StringUtils.isEmpty(valueStr) ? defaultValue : valueStr.charAt(0); - } - - /** - * 转换为字符
- * 如果给定的值为null,或者转换失败,返回默认值null
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @return 结果 - */ - public static Character toChar(Object value) - { - return toChar(value, null); - } - - /** - * 转换为byte
- * 如果给定的值为null,或者转换失败,返回默认值
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @param defaultValue 转换错误时的默认值 - * @return 结果 - */ - public static Byte toByte(Object value, Byte defaultValue) - { - if (value == null) - { - return defaultValue; - } - if (value instanceof Byte) - { - return (Byte) value; - } - if (value instanceof Number) - { - return ((Number) value).byteValue(); - } - final String valueStr = toStr(value, null); - if (StringUtils.isEmpty(valueStr)) - { - return defaultValue; - } - try - { - return Byte.parseByte(valueStr); - } - catch (Exception e) - { - return defaultValue; - } - } - - /** - * 转换为byte
- * 如果给定的值为null,或者转换失败,返回默认值null
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @return 结果 - */ - public static Byte toByte(Object value) - { - return toByte(value, null); - } - - /** - * 转换为Short
- * 如果给定的值为null,或者转换失败,返回默认值
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @param defaultValue 转换错误时的默认值 - * @return 结果 - */ - public static Short toShort(Object value, Short defaultValue) - { - if (value == null) - { - return defaultValue; - } - if (value instanceof Short) - { - return (Short) value; - } - if (value instanceof Number) - { - return ((Number) value).shortValue(); - } - final String valueStr = toStr(value, null); - if (StringUtils.isEmpty(valueStr)) - { - return defaultValue; - } - try - { - return Short.parseShort(valueStr.trim()); - } - catch (Exception e) - { - return defaultValue; - } - } - - /** - * 转换为Short
- * 如果给定的值为null,或者转换失败,返回默认值null
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @return 结果 - */ - public static Short toShort(Object value) - { - return toShort(value, null); - } - - /** - * 转换为Number
- * 如果给定的值为空,或者转换失败,返回默认值
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @param defaultValue 转换错误时的默认值 - * @return 结果 - */ - public static Number toNumber(Object value, Number defaultValue) - { - if (value == null) - { - return defaultValue; - } - if (value instanceof Number) - { - return (Number) value; - } - final String valueStr = toStr(value, null); - if (StringUtils.isEmpty(valueStr)) - { - return defaultValue; - } - try - { - return NumberFormat.getInstance().parse(valueStr); - } - catch (Exception e) - { - return defaultValue; - } - } - - /** - * 转换为Number
- * 如果给定的值为空,或者转换失败,返回默认值null
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @return 结果 - */ - public static Number toNumber(Object value) - { - return toNumber(value, null); - } - - /** - * 转换为int
- * 如果给定的值为空,或者转换失败,返回默认值
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @param defaultValue 转换错误时的默认值 - * @return 结果 - */ - public static Integer toInt(Object value, Integer defaultValue) - { - if (value == null) - { - return defaultValue; - } - if (value instanceof Integer) - { - return (Integer) value; - } - if (value instanceof Number) - { - return ((Number) value).intValue(); - } - final String valueStr = toStr(value, null); - if (StringUtils.isEmpty(valueStr)) - { - return defaultValue; - } - try - { - return Integer.parseInt(valueStr.trim()); - } - catch (Exception e) - { - return defaultValue; - } - } - - /** - * 转换为int
- * 如果给定的值为null,或者转换失败,返回默认值null
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @return 结果 - */ - public static Integer toInt(Object value) - { - return toInt(value, null); - } - - /** - * 转换为Integer数组
- * - * @param str 被转换的值 - * @return 结果 - */ - public static Integer[] toIntArray(String str) - { - return toIntArray(",", str); - } - - /** - * 转换为Long数组
- * - * @param str 被转换的值 - * @return 结果 - */ - public static Long[] toLongArray(String str) - { - return toLongArray(",", str); - } - - /** - * 转换为Integer数组
- * - * @param split 分隔符 - * @param split 被转换的值 - * @return 结果 - */ - public static Integer[] toIntArray(String split, String str) - { - if (StringUtils.isEmpty(str)) - { - return new Integer[] {}; - } - String[] arr = str.split(split); - final Integer[] ints = new Integer[arr.length]; - for (int i = 0; i < arr.length; i++) - { - final Integer v = toInt(arr[i], 0); - ints[i] = v; - } - return ints; - } - - /** - * 转换为Long数组
- * - * @param split 分隔符 - * @param str 被转换的值 - * @return 结果 - */ - public static Long[] toLongArray(String split, String str) - { - if (StringUtils.isEmpty(str)) - { - return new Long[] {}; - } - String[] arr = str.split(split); - final Long[] longs = new Long[arr.length]; - for (int i = 0; i < arr.length; i++) - { - final Long v = toLong(arr[i], null); - longs[i] = v; - } - return longs; - } - - /** - * 转换为String数组
- * - * @param str 被转换的值 - * @return 结果 - */ - public static String[] toStrArray(String str) - { - return toStrArray(",", str); - } - - /** - * 转换为String数组
- * - * @param split 分隔符 - * @param split 被转换的值 - * @return 结果 - */ - public static String[] toStrArray(String split, String str) - { - return str.split(split); - } - - /** - * 转换为long
- * 如果给定的值为空,或者转换失败,返回默认值
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @param defaultValue 转换错误时的默认值 - * @return 结果 - */ - public static Long toLong(Object value, Long defaultValue) - { - if (value == null) - { - return defaultValue; - } - if (value instanceof Long) - { - return (Long) value; - } - if (value instanceof Number) - { - return ((Number) value).longValue(); - } - final String valueStr = toStr(value, null); - if (StringUtils.isEmpty(valueStr)) - { - return defaultValue; - } - try - { - // 支持科学计数法 - return new BigDecimal(valueStr.trim()).longValue(); - } - catch (Exception e) - { - return defaultValue; - } - } - - /** - * 转换为long
- * 如果给定的值为null,或者转换失败,返回默认值null
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @return 结果 - */ - public static Long toLong(Object value) - { - return toLong(value, null); - } - - /** - * 转换为double
- * 如果给定的值为空,或者转换失败,返回默认值
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @param defaultValue 转换错误时的默认值 - * @return 结果 - */ - public static Double toDouble(Object value, Double defaultValue) - { - if (value == null) - { - return defaultValue; - } - if (value instanceof Double) - { - return (Double) value; - } - if (value instanceof Number) - { - return ((Number) value).doubleValue(); - } - final String valueStr = toStr(value, null); - if (StringUtils.isEmpty(valueStr)) - { - return defaultValue; - } - try - { - // 支持科学计数法 - return new BigDecimal(valueStr.trim()).doubleValue(); - } - catch (Exception e) - { - return defaultValue; - } - } - - /** - * 转换为double
- * 如果给定的值为空,或者转换失败,返回默认值null
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @return 结果 - */ - public static Double toDouble(Object value) - { - return toDouble(value, null); - } - - /** - * 转换为Float
- * 如果给定的值为空,或者转换失败,返回默认值
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @param defaultValue 转换错误时的默认值 - * @return 结果 - */ - public static Float toFloat(Object value, Float defaultValue) - { - if (value == null) - { - return defaultValue; - } - if (value instanceof Float) - { - return (Float) value; - } - if (value instanceof Number) - { - return ((Number) value).floatValue(); - } - final String valueStr = toStr(value, null); - if (StringUtils.isEmpty(valueStr)) - { - return defaultValue; - } - try - { - return Float.parseFloat(valueStr.trim()); - } - catch (Exception e) - { - return defaultValue; - } - } - - /** - * 转换为Float
- * 如果给定的值为空,或者转换失败,返回默认值null
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @return 结果 - */ - public static Float toFloat(Object value) - { - return toFloat(value, null); - } - - /** - * 转换为boolean
- * String支持的值为:true、false、yes、ok、no,1,0 如果给定的值为空,或者转换失败,返回默认值
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @param defaultValue 转换错误时的默认值 - * @return 结果 - */ - public static Boolean toBool(Object value, Boolean defaultValue) - { - if (value == null) - { - return defaultValue; - } - if (value instanceof Boolean) - { - return (Boolean) value; - } - String valueStr = toStr(value, null); - if (StringUtils.isEmpty(valueStr)) - { - return defaultValue; - } - valueStr = valueStr.trim().toLowerCase(); - switch (valueStr) - { - case "true": - return true; - case "false": - return false; - case "yes": - return true; - case "ok": - return true; - case "no": - return false; - case "1": - return true; - case "0": - return false; - default: - return defaultValue; - } - } - - /** - * 转换为boolean
- * 如果给定的值为空,或者转换失败,返回默认值null
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @return 结果 - */ - public static Boolean toBool(Object value) - { - return toBool(value, null); - } - - /** - * 转换为Enum对象
- * 如果给定的值为空,或者转换失败,返回默认值
- * - * @param clazz Enum的Class - * @param value 值 - * @param defaultValue 默认值 - * @return Enum - */ - public static > E toEnum(Class clazz, Object value, E defaultValue) - { - if (value == null) - { - return defaultValue; - } - if (clazz.isAssignableFrom(value.getClass())) - { - @SuppressWarnings("unchecked") - E myE = (E) value; - return myE; - } - final String valueStr = toStr(value, null); - if (StringUtils.isEmpty(valueStr)) - { - return defaultValue; - } - try - { - return Enum.valueOf(clazz, valueStr); - } - catch (Exception e) - { - return defaultValue; - } - } - - /** - * 转换为Enum对象
- * 如果给定的值为空,或者转换失败,返回默认值null
- * - * @param clazz Enum的Class - * @param value 值 - * @return Enum - */ - public static > E toEnum(Class clazz, Object value) - { - return toEnum(clazz, value, null); - } - - /** - * 转换为BigInteger
- * 如果给定的值为空,或者转换失败,返回默认值
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @param defaultValue 转换错误时的默认值 - * @return 结果 - */ - public static BigInteger toBigInteger(Object value, BigInteger defaultValue) - { - if (value == null) - { - return defaultValue; - } - if (value instanceof BigInteger) - { - return (BigInteger) value; - } - if (value instanceof Long) - { - return BigInteger.valueOf((Long) value); - } - final String valueStr = toStr(value, null); - if (StringUtils.isEmpty(valueStr)) - { - return defaultValue; - } - try - { - return new BigInteger(valueStr); - } - catch (Exception e) - { - return defaultValue; - } - } - - /** - * 转换为BigInteger
- * 如果给定的值为空,或者转换失败,返回默认值null
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @return 结果 - */ - public static BigInteger toBigInteger(Object value) - { - return toBigInteger(value, null); - } - - /** - * 转换为BigDecimal
- * 如果给定的值为空,或者转换失败,返回默认值
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @param defaultValue 转换错误时的默认值 - * @return 结果 - */ - public static BigDecimal toBigDecimal(Object value, BigDecimal defaultValue) - { - if (value == null) - { - return defaultValue; - } - if (value instanceof BigDecimal) - { - return (BigDecimal) value; - } - if (value instanceof Long) - { - return new BigDecimal((Long) value); - } - if (value instanceof Double) - { - return new BigDecimal((Double) value); - } - if (value instanceof Integer) - { - return new BigDecimal((Integer) value); - } - final String valueStr = toStr(value, null); - if (StringUtils.isEmpty(valueStr)) - { - return defaultValue; - } - try - { - return new BigDecimal(valueStr); - } - catch (Exception e) - { - return defaultValue; - } - } - - /** - * 转换为BigDecimal
- * 如果给定的值为空,或者转换失败,返回默认值
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @return 结果 - */ - public static BigDecimal toBigDecimal(Object value) - { - return toBigDecimal(value, null); - } - - /** - * 将对象转为字符串
- * 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法 - * - * @param obj 对象 - * @return 字符串 - */ - public static String utf8Str(Object obj) - { - return str(obj, Charset.forName("UTF-8")); - } - - /** - * 将对象转为字符串
- * 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法 - * - * @param obj 对象 - * @param charsetName 字符集 - * @return 字符串 - */ - public static String str(Object obj, String charsetName) - { - return str(obj, Charset.forName(charsetName)); - } - - /** - * 将对象转为字符串
- * 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法 - * - * @param obj 对象 - * @param charset 字符集 - * @return 字符串 - */ - public static String str(Object obj, Charset charset) - { - if (null == obj) - { - return null; - } - - if (obj instanceof String) - { - return (String) obj; - } - else if (obj instanceof byte[] || obj instanceof Byte[]) - { - return str((Byte[]) obj, charset); - } - else if (obj instanceof ByteBuffer) - { - return str((ByteBuffer) obj, charset); - } - return obj.toString(); - } - - /** - * 将byte数组转为字符串 - * - * @param bytes byte数组 - * @param charset 字符集 - * @return 字符串 - */ - public static String str(byte[] bytes, String charset) - { - return str(bytes, StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset)); - } - - /** - * 解码字节码 - * - * @param data 字符串 - * @param charset 字符集,如果此字段为空,则解码的结果取决于平台 - * @return 解码后的字符串 - */ - public static String str(byte[] data, Charset charset) - { - if (data == null) - { - return null; - } - - if (null == charset) - { - return new String(data); - } - return new String(data, charset); - } - - /** - * 将编码的byteBuffer数据转换为字符串 - * - * @param data 数据 - * @param charset 字符集,如果为空使用当前系统字符集 - * @return 字符串 - */ - public static String str(ByteBuffer data, String charset) - { - if (data == null) - { - return null; - } - - return str(data, Charset.forName(charset)); - } - - /** - * 将编码的byteBuffer数据转换为字符串 - * - * @param data 数据 - * @param charset 字符集,如果为空使用当前系统字符集 - * @return 字符串 - */ - public static String str(ByteBuffer data, Charset charset) - { - if (null == charset) - { - charset = Charset.defaultCharset(); - } - return charset.decode(data).toString(); - } - - // ----------------------------------------------------------------------- 全角半角转换 - /** - * 半角转全角 - * - * @param input String. - * @return 全角字符串. - */ - public static String toSBC(String input) - { - return toSBC(input, null); - } - - /** - * 半角转全角 - * - * @param input String - * @param notConvertSet 不替换的字符集合 - * @return 全角字符串. - */ - public static String toSBC(String input, Set notConvertSet) - { - char c[] = input.toCharArray(); - for (int i = 0; i < c.length; i++) - { - if (null != notConvertSet && notConvertSet.contains(c[i])) - { - // 跳过不替换的字符 - continue; - } - - if (c[i] == ' ') - { - c[i] = '\u3000'; - } - else if (c[i] < '\177') - { - c[i] = (char) (c[i] + 65248); - - } - } - return new String(c); - } - - /** - * 全角转半角 - * - * @param input String. - * @return 半角字符串 - */ - public static String toDBC(String input) - { - return toDBC(input, null); - } - - /** - * 替换全角为半角 - * - * @param text 文本 - * @param notConvertSet 不替换的字符集合 - * @return 替换后的字符 - */ - public static String toDBC(String text, Set notConvertSet) - { - char c[] = text.toCharArray(); - for (int i = 0; i < c.length; i++) - { - if (null != notConvertSet && notConvertSet.contains(c[i])) - { - // 跳过不替换的字符 - continue; - } - - if (c[i] == '\u3000') - { - c[i] = ' '; - } - else if (c[i] > '\uFF00' && c[i] < '\uFF5F') - { - c[i] = (char) (c[i] - 65248); - } - } - String returnString = new String(c); - - return returnString; - } - - /** - * 数字金额大写转换 先写个完整的然后将如零拾替换成零 - * - * @param n 数字 - * @return 中文大写数字 - */ - public static String digitUppercase(double n) - { - String[] fraction = { "角", "分" }; - String[] digit = { "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" }; - String[][] unit = { { "元", "万", "亿" }, { "", "拾", "佰", "仟" } }; - - String head = n < 0 ? "负" : ""; - n = Math.abs(n); - - String s = ""; - for (int i = 0; i < fraction.length; i++) - { - s += (digit[(int) (Math.floor(n * 10 * Math.pow(10, i)) % 10)] + fraction[i]).replaceAll("(零.)+", ""); - } - if (s.length() < 1) - { - s = "整"; - } - int integerPart = (int) Math.floor(n); - - for (int i = 0; i < unit[0].length && integerPart > 0; i++) - { - String p = ""; - for (int j = 0; j < unit[1].length && n > 0; j++) - { - p = digit[integerPart % 10] + unit[1][j] + p; - integerPart = integerPart / 10; - } - s = p.replaceAll("(零.)*零$", "").replaceAll("^$", "零") + unit[0][i] + s; - } - return head + s.replaceAll("(零.)*零元", "元").replaceFirst("(零.)+", "").replaceAll("(零.)+", "零").replaceAll("^整$", "零元整"); - } -} diff --git a/mate-support/mate-generator/src/main/java/vip/mate/generator/util/GenUtils.java b/mate-support/mate-generator/src/main/java/vip/mate/generator/util/GenUtils.java deleted file mode 100644 index b6001785277df248c5369d04951cb28d49734d77..0000000000000000000000000000000000000000 --- a/mate-support/mate-generator/src/main/java/vip/mate/generator/util/GenUtils.java +++ /dev/null @@ -1,259 +0,0 @@ -package vip.mate.generator.util; - - -import org.apache.commons.lang3.RegExUtils; -import vip.mate.generator.config.GenConfig; -import vip.mate.generator.entity.GenConstants; -import vip.mate.generator.entity.GenTable; -import vip.mate.generator.entity.GenTableColumn; - -import java.util.Arrays; - -/** - * 代码生成器 工具类 - * - * @author ruoyi - */ -public class GenUtils -{ - /** - * 初始化表信息 - */ - public static void initTable(GenTable genTable, String operName) - { - genTable.setClassName(convertClassName(genTable.getTableName())); - genTable.setPackageName(GenConfig.getPackageName()); - genTable.setModuleName(getModuleName(GenConfig.getPackageName())); - genTable.setBusinessName(getBusinessName(genTable.getTableName())); - genTable.setFunctionName(replaceText(genTable.getTableComment())); - genTable.setFunctionAuthor(GenConfig.getAuthor()); - genTable.setCreateBy(operName); - } - - /** - * 初始化列属性字段 - */ - public static void initColumnField(GenTableColumn column, GenTable table) - { - String dataType = getDbType(column.getColumnType()); - String columnName = column.getColumnName(); - column.setTableId(table.getTableId()); - column.setCreateBy(table.getCreateBy()); - // 设置java字段名 - column.setJavaField(StringUtils.toCamelCase(columnName)); - // 设置默认类型 - column.setJavaType(GenConstants.TYPE_STRING); - - if (arraysContains(GenConstants.COLUMNTYPE_STR, dataType) || arraysContains(GenConstants.COLUMNTYPE_TEXT, dataType)) - { - // 字符串长度超过500设置为文本域 - Integer columnLength = getColumnLength(column.getColumnType()); - String htmlType = columnLength >= 500 || arraysContains(GenConstants.COLUMNTYPE_TEXT, dataType) ? GenConstants.HTML_TEXTAREA : GenConstants.HTML_INPUT; - column.setHtmlType(htmlType); - } - else if (arraysContains(GenConstants.COLUMNTYPE_TIME, dataType)) - { - column.setJavaType(GenConstants.TYPE_DATE); - column.setHtmlType(GenConstants.HTML_DATETIME); - } - else if (arraysContains(GenConstants.COLUMNTYPE_NUMBER, dataType)) - { - column.setHtmlType(GenConstants.HTML_INPUT); - - // 如果是浮点型 统一用BigDecimal - String[] str = StringUtils.split(StringUtils.substringBetween(column.getColumnType(), "(", ")"), ","); - if (str != null && str.length == 2 && Integer.parseInt(str[1]) > 0) - { - column.setJavaType(GenConstants.TYPE_BIGDECIMAL); - } - // 如果是整形 - else if (str != null && str.length == 1 && Integer.parseInt(str[0]) <= 10) - { - column.setJavaType(GenConstants.TYPE_INTEGER); - } - // 长整形 - else - { - column.setJavaType(GenConstants.TYPE_LONG); - } - } - - // 插入字段(默认所有字段都需要插入) - column.setIsInsert(GenConstants.REQUIRE); - - // 编辑字段 - if (!arraysContains(GenConstants.COLUMNNAME_NOT_EDIT, columnName) && !column.isPk()) - { - column.setIsEdit(GenConstants.REQUIRE); - } - // 列表字段 - if (!arraysContains(GenConstants.COLUMNNAME_NOT_LIST, columnName) && !column.isPk()) - { - column.setIsList(GenConstants.REQUIRE); - } - // 查询字段 - if (!arraysContains(GenConstants.COLUMNNAME_NOT_QUERY, columnName) && !column.isPk()) - { - column.setIsQuery(GenConstants.REQUIRE); - } - - // 查询字段类型 - if (StringUtils.endsWithIgnoreCase(columnName, "name")) - { - column.setQueryType(GenConstants.QUERY_LIKE); - } - // 状态字段设置单选框 - if (StringUtils.endsWithIgnoreCase(columnName, "status")) - { - column.setHtmlType(GenConstants.HTML_RADIO); - } - // 类型&性别字段设置下拉框 - else if (StringUtils.endsWithIgnoreCase(columnName, "type") - || StringUtils.endsWithIgnoreCase(columnName, "sex")) - { - column.setHtmlType(GenConstants.HTML_SELECT); - } - // 图片字段设置图片上传控件 - else if (StringUtils.endsWithIgnoreCase(columnName, "image")) - { - column.setHtmlType(GenConstants.HTML_IMAGE_UPLOAD); - } - // 文件字段设置文件上传控件 - else if (StringUtils.endsWithIgnoreCase(columnName, "file")) - { - column.setHtmlType(GenConstants.HTML_FILE_UPLOAD); - } - // 内容字段设置富文本控件 - else if (StringUtils.endsWithIgnoreCase(columnName, "content")) - { - column.setHtmlType(GenConstants.HTML_EDITOR); - } - } - - /** - * 校验数组是否包含指定值 - * - * @param arr 数组 - * @param targetValue 值 - * @return 是否包含 - */ - public static boolean arraysContains(String[] arr, String targetValue) - { - return Arrays.asList(arr).contains(targetValue); - } - - /** - * 获取模块名 - * - * @param packageName 包名 - * @return 模块名 - */ - public static String getModuleName(String packageName) - { - int lastIndex = packageName.lastIndexOf("."); - int nameLength = packageName.length(); - String moduleName = StringUtils.substring(packageName, lastIndex + 1, nameLength); - return moduleName; - } - - /** - * 获取业务名 - * - * @param tableName 表名 - * @return 业务名 - */ - public static String getBusinessName(String tableName) - { - int lastIndex = tableName.lastIndexOf("_"); - int nameLength = tableName.length(); - String businessName = StringUtils.substring(tableName, lastIndex + 1, nameLength); - return businessName; - } - - /** - * 表名转换成Java类名 - * - * @param tableName 表名称 - * @return 类名 - */ - public static String convertClassName(String tableName) - { - boolean autoRemovePre = GenConfig.getAutoRemovePre(); - String tablePrefix = GenConfig.getTablePrefix(); - if (autoRemovePre && StringUtils.isNotEmpty(tablePrefix)) - { - String[] searchList = StringUtils.split(tablePrefix, ","); - tableName = replaceFirst(tableName, searchList); - } - return StringUtils.convertToCamelCase(tableName); - } - - /** - * 批量替换前缀 - * - * @param replacementm 替换值 - * @param searchList 替换列表 - * @return - */ - public static String replaceFirst(String replacementm, String[] searchList) - { - String text = replacementm; - for (String searchString : searchList) - { - if (replacementm.startsWith(searchString)) - { - text = replacementm.replaceFirst(searchString, ""); - break; - } - } - return text; - } - - /** - * 关键字替换 - * - * @param text 需要被替换的名字 - * @return 替换后的名字 - */ - public static String replaceText(String text) - { - return RegExUtils.replaceAll(text, "(?:表|若依)", ""); - } - - /** - * 获取数据库类型字段 - * - * @param columnType 列类型 - * @return 截取后的列类型 - */ - public static String getDbType(String columnType) - { - if (StringUtils.indexOf(columnType, "(") > 0) - { - return StringUtils.substringBefore(columnType, "("); - } - else - { - return columnType; - } - } - - /** - * 获取字段长度 - * - * @param columnType 列类型 - * @return 截取后的列类型 - */ - public static Integer getColumnLength(String columnType) - { - if (StringUtils.indexOf(columnType, "(") > 0) - { - String length = StringUtils.substringBetween(columnType, "(", ")"); - return Integer.valueOf(length); - } - else - { - return 0; - } - } -} diff --git a/mate-support/mate-generator/src/main/java/vip/mate/generator/util/ServletUtils.java b/mate-support/mate-generator/src/main/java/vip/mate/generator/util/ServletUtils.java deleted file mode 100644 index df17c096dcf243f310f6f7ecf19c65e240f04ccc..0000000000000000000000000000000000000000 --- a/mate-support/mate-generator/src/main/java/vip/mate/generator/util/ServletUtils.java +++ /dev/null @@ -1,136 +0,0 @@ -package vip.mate.generator.util; - -import org.springframework.web.context.request.RequestAttributes; -import org.springframework.web.context.request.RequestContextHolder; -import org.springframework.web.context.request.ServletRequestAttributes; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; -import java.io.IOException; - -/** - * 客户端工具类 - * - * @author ruoyi - */ -public class ServletUtils -{ - /** - * 获取String参数 - */ - public static String getParameter(String name) - { - return getRequest().getParameter(name); - } - - /** - * 获取String参数 - */ - public static String getParameter(String name, String defaultValue) - { - return Convert.toStr(getRequest().getParameter(name), defaultValue); - } - - /** - * 获取Integer参数 - */ - public static Integer getParameterToInt(String name) - { - return Convert.toInt(getRequest().getParameter(name)); - } - - /** - * 获取Integer参数 - */ - public static Integer getParameterToInt(String name, Integer defaultValue) - { - return Convert.toInt(getRequest().getParameter(name), defaultValue); - } - - /** - * 获取request - */ - public static HttpServletRequest getRequest() - { - return getRequestAttributes().getRequest(); - } - - /** - * 获取response - */ - public static HttpServletResponse getResponse() - { - return getRequestAttributes().getResponse(); - } - - /** - * 获取session - */ - public static HttpSession getSession() - { - return getRequest().getSession(); - } - - public static ServletRequestAttributes getRequestAttributes() - { - RequestAttributes attributes = RequestContextHolder.getRequestAttributes(); - return (ServletRequestAttributes) attributes; - } - - /** - * 将字符串渲染到客户端 - * - * @param response 渲染对象 - * @param string 待渲染的字符串 - * @return null - */ - public static String renderString(HttpServletResponse response, String string) - { - try - { - response.setStatus(200); - response.setContentType("application/json"); - response.setCharacterEncoding("utf-8"); - response.getWriter().print(string); - } - catch (IOException e) - { - e.printStackTrace(); - } - return null; - } - - /** - * 是否是Ajax异步请求 - * - * @param request - */ - public static boolean isAjaxRequest(HttpServletRequest request) - { - String accept = request.getHeader("accept"); - if (accept != null && accept.indexOf("application/json") != -1) - { - return true; - } - - String xRequestedWith = request.getHeader("X-Requested-With"); - if (xRequestedWith != null && xRequestedWith.indexOf("XMLHttpRequest") != -1) - { - return true; - } - - String uri = request.getRequestURI(); - if (StringUtils.inStringIgnoreCase(uri, ".json", ".xml")) - { - return true; - } - - String ajax = request.getParameter("__ajax"); - if (StringUtils.inStringIgnoreCase(ajax, "json", "xml")) - { - return true; - } - return false; - } -} diff --git a/mate-support/mate-generator/src/main/java/vip/mate/generator/util/SqlUtil.java b/mate-support/mate-generator/src/main/java/vip/mate/generator/util/SqlUtil.java deleted file mode 100644 index 4c20700bed2c3d6a920e6921ad741d9a8b54ac29..0000000000000000000000000000000000000000 --- a/mate-support/mate-generator/src/main/java/vip/mate/generator/util/SqlUtil.java +++ /dev/null @@ -1,37 +0,0 @@ -package vip.mate.generator.util; - - -import vip.mate.core.common.exception.BaseException; - -/** - * sql操作工具类 - * - * @author ruoyi - */ -public class SqlUtil -{ - /** - * 仅支持字母、数字、下划线、空格、逗号、小数点(支持多个字段排序) - */ - public static String SQL_PATTERN = "[a-zA-Z0-9_\\ \\,\\.]+"; - - /** - * 检查字符,防止注入绕过 - */ - public static String escapeOrderBySql(String value) - { - if (StringUtils.isNotEmpty(value) && !isValidOrderBySql(value)) - { - throw new BaseException("参数不符合规范,不能进行查询"); - } - return value; - } - - /** - * 验证 order by 语法是否符合规范 - */ - public static boolean isValidOrderBySql(String value) - { - return value.matches(SQL_PATTERN); - } -} diff --git a/mate-support/mate-generator/src/main/java/vip/mate/generator/util/StrFormatter.java b/mate-support/mate-generator/src/main/java/vip/mate/generator/util/StrFormatter.java deleted file mode 100644 index 387e8419280f2cb7858f22fbd3b73786cb86ccb1..0000000000000000000000000000000000000000 --- a/mate-support/mate-generator/src/main/java/vip/mate/generator/util/StrFormatter.java +++ /dev/null @@ -1,120 +0,0 @@ -package vip.mate.generator.util; - -import java.nio.ByteBuffer; -import java.nio.charset.Charset; - -/** - * 字符串格式化 - * - * @author ruoyi - */ -public class StrFormatter -{ - public static final String EMPTY_JSON = "{}"; - public static final char C_BACKSLASH = '\\'; - public static final char C_DELIM_START = '{'; - public static final char C_DELIM_END = '}'; - - /** - * 格式化字符串
- * 此方法只是简单将占位符 {} 按照顺序替换为参数
- * 如果想输出 {} 使用 \\转义 { 即可,如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可
- * 例:
- * 通常使用:format("this is {} for {}", "a", "b") -> this is a for b
- * 转义{}: format("this is \\{} for {}", "a", "b") -> this is \{} for a
- * 转义\: format("this is \\\\{} for {}", "a", "b") -> this is \a for b
- * - * @param strPattern 字符串模板 - * @param argArray 参数列表 - * @return 结果 - */ - public static String format(final String strPattern, final Object... argArray) - { - if (StringUtils.isEmpty(strPattern) || StringUtils.isEmpty(argArray)) - { - return strPattern; - } - final int strPatternLength = strPattern.length(); - - // 初始化定义好的长度以获得更好的性能 - StringBuilder sbuf = new StringBuilder(strPatternLength + 50); - - int handledPosition = 0; - int delimIndex;// 占位符所在位置 - for (int argIndex = 0; argIndex < argArray.length; argIndex++) - { - delimIndex = strPattern.indexOf(EMPTY_JSON, handledPosition); - if (delimIndex == -1) - { - if (handledPosition == 0) - { - return strPattern; - } - else - { // 字符串模板剩余部分不再包含占位符,加入剩余部分后返回结果 - sbuf.append(strPattern, handledPosition, strPatternLength); - return sbuf.toString(); - } - } - else - { - if (delimIndex > 0 && strPattern.charAt(delimIndex - 1) == C_BACKSLASH) - { - if (delimIndex > 1 && strPattern.charAt(delimIndex - 2) == C_BACKSLASH) - { - // 转义符之前还有一个转义符,占位符依旧有效 - sbuf.append(strPattern, handledPosition, delimIndex - 1); - sbuf.append(utf8Str(argArray[argIndex])); - handledPosition = delimIndex + 2; - } - else - { - // 占位符被转义 - argIndex--; - sbuf.append(strPattern, handledPosition, delimIndex - 1); - sbuf.append(C_DELIM_START); - handledPosition = delimIndex + 1; - } - } - else - { - // 正常占位符 - sbuf.append(strPattern, handledPosition, delimIndex); - sbuf.append(utf8Str(argArray[argIndex])); - handledPosition = delimIndex + 2; - } - } - } - // 加入最后一个占位符后所有的字符 - sbuf.append(strPattern, handledPosition, strPattern.length()); - - return sbuf.toString(); - } - - private static String utf8Str(Object obj){ - return str(obj, Charset.forName("UTF-8")); - } - - - public static String str(Object obj, Charset charset) - { - if (null == obj) - { - return null; - } - - if (obj instanceof String) - { - return (String) obj; - } - else if (obj instanceof byte[] || obj instanceof Byte[]) - { - return str((Byte[]) obj, charset); - } - else if (obj instanceof ByteBuffer) - { - return str((ByteBuffer) obj, charset); - } - return obj.toString(); - } -} diff --git a/mate-support/mate-generator/src/main/java/vip/mate/generator/util/StringUtils.java b/mate-support/mate-generator/src/main/java/vip/mate/generator/util/StringUtils.java deleted file mode 100644 index ed33bf59bb1ff6875309498a4d8559b9b35d4aa5..0000000000000000000000000000000000000000 --- a/mate-support/mate-generator/src/main/java/vip/mate/generator/util/StringUtils.java +++ /dev/null @@ -1,454 +0,0 @@ -package vip.mate.generator.util; - - -import java.util.*; - -/** - * 字符串工具类 - * - * @author ruoyi - */ -public class StringUtils extends org.apache.commons.lang3.StringUtils -{ - /** 空字符串 */ - private static final String NULLSTR = ""; - - /** 下划线 */ - private static final char SEPARATOR = '_'; - - /** - * 获取参数不为空值 - * - * @param value defaultValue 要判断的value - * @return value 返回值 - */ - public static T nvl(T value, T defaultValue) - { - return value != null ? value : defaultValue; - } - - /** - * * 判断一个Collection是否为空, 包含List,Set,Queue - * - * @param coll 要判断的Collection - * @return true:为空 false:非空 - */ - public static boolean isEmpty(Collection coll) - { - return isNull(coll) || coll.isEmpty(); - } - - /** - * * 判断一个Collection是否非空,包含List,Set,Queue - * - * @param coll 要判断的Collection - * @return true:非空 false:空 - */ - public static boolean isNotEmpty(Collection coll) - { - return !isEmpty(coll); - } - - /** - * * 判断一个对象数组是否为空 - * - * @param objects 要判断的对象数组 - ** @return true:为空 false:非空 - */ - public static boolean isEmpty(Object[] objects) - { - return isNull(objects) || (objects.length == 0); - } - - /** - * * 判断一个对象数组是否非空 - * - * @param objects 要判断的对象数组 - * @return true:非空 false:空 - */ - public static boolean isNotEmpty(Object[] objects) - { - return !isEmpty(objects); - } - - /** - * * 判断一个Map是否为空 - * - * @param map 要判断的Map - * @return true:为空 false:非空 - */ - public static boolean isEmpty(Map map) - { - return isNull(map) || map.isEmpty(); - } - - /** - * * 判断一个Map是否为空 - * - * @param map 要判断的Map - * @return true:非空 false:空 - */ - public static boolean isNotEmpty(Map map) - { - return !isEmpty(map); - } - - /** - * * 判断一个字符串是否为空串 - * - * @param str String - * @return true:为空 false:非空 - */ - public static boolean isEmpty(String str) - { - return isNull(str) || NULLSTR.equals(str.trim()); - } - - /** - * * 判断一个字符串是否为非空串 - * - * @param str String - * @return true:非空串 false:空串 - */ - public static boolean isNotEmpty(String str) - { - return !isEmpty(str); - } - - /** - * * 判断一个对象是否为空 - * - * @param object Object - * @return true:为空 false:非空 - */ - public static boolean isNull(Object object) - { - return object == null; - } - - /** - * * 判断一个对象是否非空 - * - * @param object Object - * @return true:非空 false:空 - */ - public static boolean isNotNull(Object object) - { - return !isNull(object); - } - - /** - * * 判断一个对象是否是数组类型(Java基本型别的数组) - * - * @param object 对象 - * @return true:是数组 false:不是数组 - */ - public static boolean isArray(Object object) - { - return isNotNull(object) && object.getClass().isArray(); - } - - /** - * 去空格 - */ - public static String trim(String str) - { - return (str == null ? "" : str.trim()); - } - - /** - * 截取字符串 - * - * @param str 字符串 - * @param start 开始 - * @return 结果 - */ - public static String substring(final String str, int start) - { - if (str == null) - { - return NULLSTR; - } - - if (start < 0) - { - start = str.length() + start; - } - - if (start < 0) - { - start = 0; - } - if (start > str.length()) - { - return NULLSTR; - } - - return str.substring(start); - } - - /** - * 截取字符串 - * - * @param str 字符串 - * @param start 开始 - * @param end 结束 - * @return 结果 - */ - public static String substring(final String str, int start, int end) - { - if (str == null) - { - return NULLSTR; - } - - if (end < 0) - { - end = str.length() + end; - } - if (start < 0) - { - start = str.length() + start; - } - - if (end > str.length()) - { - end = str.length(); - } - - if (start > end) - { - return NULLSTR; - } - - if (start < 0) - { - start = 0; - } - if (end < 0) - { - end = 0; - } - - return str.substring(start, end); - } - - /** - * 格式化文本, {} 表示占位符
- * 此方法只是简单将占位符 {} 按照顺序替换为参数
- * 如果想输出 {} 使用 \\转义 { 即可,如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可
- * 例:
- * 通常使用:format("this is {} for {}", "a", "b") -> this is a for b
- * 转义{}: format("this is \\{} for {}", "a", "b") -> this is \{} for a
- * 转义\: format("this is \\\\{} for {}", "a", "b") -> this is \a for b
- * - * @param template 文本模板,被替换的部分用 {} 表示 - * @param params 参数值 - * @return 格式化后的文本 - */ - public static String format(String template, Object... params) - { - if (isEmpty(params) || isEmpty(template)) - { - return template; - } - return StrFormatter.format(template, params); - } - - /** - * 字符串转set - * - * @param str 字符串 - * @param sep 分隔符 - * @return set集合 - */ - public static final Set str2Set(String str, String sep) - { - return new HashSet(str2List(str, sep, true, false)); - } - - /** - * 字符串转list - * - * @param str 字符串 - * @param sep 分隔符 - * @param filterBlank 过滤纯空白 - * @param trim 去掉首尾空白 - * @return list集合 - */ - public static final List str2List(String str, String sep, boolean filterBlank, boolean trim) - { - List list = new ArrayList(); - if (StringUtils.isEmpty(str)) - { - return list; - } - - // 过滤空白字符串 - if (filterBlank && StringUtils.isBlank(str)) - { - return list; - } - String[] split = str.split(sep); - for (String string : split) - { - if (filterBlank && StringUtils.isBlank(string)) - { - continue; - } - if (trim) - { - string = string.trim(); - } - list.add(string); - } - - return list; - } - - /** - * 下划线转驼峰命名 - */ - public static String toUnderScoreCase(String str) - { - if (str == null) - { - return null; - } - StringBuilder sb = new StringBuilder(); - // 前置字符是否大写 - boolean preCharIsUpperCase = true; - // 当前字符是否大写 - boolean curreCharIsUpperCase = true; - // 下一字符是否大写 - boolean nexteCharIsUpperCase = true; - for (int i = 0; i < str.length(); i++) - { - char c = str.charAt(i); - if (i > 0) - { - preCharIsUpperCase = Character.isUpperCase(str.charAt(i - 1)); - } - else - { - preCharIsUpperCase = false; - } - - curreCharIsUpperCase = Character.isUpperCase(c); - - if (i < (str.length() - 1)) - { - nexteCharIsUpperCase = Character.isUpperCase(str.charAt(i + 1)); - } - - if (preCharIsUpperCase && curreCharIsUpperCase && !nexteCharIsUpperCase) - { - sb.append(SEPARATOR); - } - else if ((i != 0 && !preCharIsUpperCase) && curreCharIsUpperCase) - { - sb.append(SEPARATOR); - } - sb.append(Character.toLowerCase(c)); - } - - return sb.toString(); - } - - /** - * 是否包含字符串 - * - * @param str 验证字符串 - * @param strs 字符串组 - * @return 包含返回true - */ - public static boolean inStringIgnoreCase(String str, String... strs) - { - if (str != null && strs != null) - { - for (String s : strs) - { - if (str.equalsIgnoreCase(trim(s))) - { - return true; - } - } - } - return false; - } - - /** - * 将下划线大写方式命名的字符串转换为驼峰式。如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。 例如:HELLO_WORLD->HelloWorld - * - * @param name 转换前的下划线大写方式命名的字符串 - * @return 转换后的驼峰式命名的字符串 - */ - public static String convertToCamelCase(String name) - { - StringBuilder result = new StringBuilder(); - // 快速检查 - if (name == null || name.isEmpty()) - { - // 没必要转换 - return ""; - } - else if (!name.contains("_")) - { - // 不含下划线,仅将首字母大写 - return name.substring(0, 1).toUpperCase() + name.substring(1); - } - // 用下划线将原始字符串分割 - String[] camels = name.split("_"); - for (String camel : camels) - { - // 跳过原始字符串中开头、结尾的下换线或双重下划线 - if (camel.isEmpty()) - { - continue; - } - // 首字母大写 - result.append(camel.substring(0, 1).toUpperCase()); - result.append(camel.substring(1).toLowerCase()); - } - return result.toString(); - } - - /** - * 驼峰式命名法 例如:user_name->userName - */ - public static String toCamelCase(String s) - { - if (s == null) - { - return null; - } - s = s.toLowerCase(); - StringBuilder sb = new StringBuilder(s.length()); - boolean upperCase = false; - for (int i = 0; i < s.length(); i++) - { - char c = s.charAt(i); - - if (c == SEPARATOR) - { - upperCase = true; - } - else if (upperCase) - { - sb.append(Character.toUpperCase(c)); - upperCase = false; - } - else - { - sb.append(c); - } - } - return sb.toString(); - } - - @SuppressWarnings("unchecked") - public static T cast(Object obj) - { - return (T) obj; - } -} \ No newline at end of file diff --git a/mate-support/mate-generator/src/main/java/vip/mate/generator/util/VelocityInitializer.java b/mate-support/mate-generator/src/main/java/vip/mate/generator/util/VelocityInitializer.java deleted file mode 100644 index c40b18acacea8360204cf3187fb3512e57f9e0b5..0000000000000000000000000000000000000000 --- a/mate-support/mate-generator/src/main/java/vip/mate/generator/util/VelocityInitializer.java +++ /dev/null @@ -1,35 +0,0 @@ -package vip.mate.generator.util; - -import org.apache.velocity.app.Velocity; - -import java.util.Properties; - -/** - * VelocityEngine工厂 - * - * @author ruoyi - */ -public class VelocityInitializer -{ - /** - * 初始化vm方法 - */ - public static void initVelocity() - { - Properties p = new Properties(); - try - { - // 加载classpath目录下的vm文件 - p.setProperty("file.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); - // 定义字符集 - p.setProperty("ISO-8859-1", "UTF-8"); - p.setProperty("output.encoding", "UTF-8"); - // 初始化Velocity引擎,指定配置Properties - Velocity.init(p); - } - catch (Exception e) - { - throw new RuntimeException(e); - } - } -} diff --git a/mate-support/mate-generator/src/main/java/vip/mate/generator/util/VelocityUtils.java b/mate-support/mate-generator/src/main/java/vip/mate/generator/util/VelocityUtils.java deleted file mode 100644 index c9a0d0f8b40f9914593877ce270ab1287c379428..0000000000000000000000000000000000000000 --- a/mate-support/mate-generator/src/main/java/vip/mate/generator/util/VelocityUtils.java +++ /dev/null @@ -1,362 +0,0 @@ -package vip.mate.generator.util; - -import com.alibaba.fastjson.JSONObject; -import org.apache.velocity.VelocityContext; -import vip.mate.generator.entity.GenConstants; -import vip.mate.generator.entity.GenTable; -import vip.mate.generator.entity.GenTableColumn; - -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashSet; -import java.util.List; - -/** - * 模板处理工具类 - * - * @author ruoyi - */ -public class VelocityUtils -{ - /** 项目空间路径 */ - private static final String PROJECT_PATH = "main/java"; - - /** mybatis空间路径 */ - private static final String MYBATIS_PATH = "main/resources/mapper"; - - /** 默认上级菜单,系统工具 */ - private static final String DEFAULT_PARENT_MENU_ID = "3"; - - /** - * 设置模板变量信息 - * - * @return 模板列表 - */ - public static VelocityContext prepareContext(GenTable genTable) - { - String moduleName = genTable.getModuleName(); - String businessName = genTable.getBusinessName(); - String packageName = genTable.getPackageName(); - String tplCategory = genTable.getTplCategory(); - String functionName = genTable.getFunctionName(); - - VelocityContext velocityContext = new VelocityContext(); - velocityContext.put("tplCategory", genTable.getTplCategory()); - velocityContext.put("tableName", genTable.getTableName()); - velocityContext.put("functionName", StringUtils.isNotEmpty(functionName) ? functionName : "【请填写功能名称】"); - velocityContext.put("ClassName", genTable.getClassName()); - velocityContext.put("className", StringUtils.uncapitalize(genTable.getClassName())); - velocityContext.put("moduleName", genTable.getModuleName()); - velocityContext.put("BusinessName", StringUtils.capitalize(genTable.getBusinessName())); - velocityContext.put("businessName", genTable.getBusinessName()); - velocityContext.put("basePackage", getPackagePrefix(packageName)); - velocityContext.put("packageName", packageName); - velocityContext.put("author", genTable.getFunctionAuthor()); - velocityContext.put("datetime", new SimpleDateFormat("yyyy-MM-dd").format(new Date())); - velocityContext.put("pkColumn", genTable.getPkColumn()); - velocityContext.put("importList", getImportList(genTable)); - velocityContext.put("permissionPrefix", getPermissionPrefix(moduleName, businessName)); - velocityContext.put("columns", genTable.getColumns()); - velocityContext.put("table", genTable); - setMenuVelocityContext(velocityContext, genTable); - if (GenConstants.TPL_TREE.equals(tplCategory)) - { - setTreeVelocityContext(velocityContext, genTable); - } - if (GenConstants.TPL_SUB.equals(tplCategory)) - { - setSubVelocityContext(velocityContext, genTable); - } - return velocityContext; - } - - public static void setMenuVelocityContext(VelocityContext context, GenTable genTable) - { - String options = genTable.getOptions(); - JSONObject paramsObj = JSONObject.parseObject(options); - String parentMenuId = getParentMenuId(paramsObj); - context.put("parentMenuId", parentMenuId); - } - - public static void setTreeVelocityContext(VelocityContext context, GenTable genTable) - { - String options = genTable.getOptions(); - JSONObject paramsObj = JSONObject.parseObject(options); - String treeCode = getTreecode(paramsObj); - String treeParentCode = getTreeParentCode(paramsObj); - String treeName = getTreeName(paramsObj); - - context.put("treeCode", treeCode); - context.put("treeParentCode", treeParentCode); - context.put("treeName", treeName); - context.put("expandColumn", getExpandColumn(genTable)); - if (paramsObj.containsKey(GenConstants.TREE_PARENT_CODE)) - { - context.put("tree_parent_code", paramsObj.getString(GenConstants.TREE_PARENT_CODE)); - } - if (paramsObj.containsKey(GenConstants.TREE_NAME)) - { - context.put("tree_name", paramsObj.getString(GenConstants.TREE_NAME)); - } - } - - public static void setSubVelocityContext(VelocityContext context, GenTable genTable) - { - GenTable subTable = genTable.getSubTable(); - String subTableName = genTable.getSubTableName(); - String subTableFkName = genTable.getSubTableFkName(); - String subClassName = genTable.getSubTable().getClassName(); - String subTableFkClassName = StringUtils.convertToCamelCase(subTableFkName); - - context.put("subTable", subTable); - context.put("subTableName", subTableName); - context.put("subTableFkName", subTableFkName); - context.put("subTableFkClassName", subTableFkClassName); - context.put("subTableFkclassName", StringUtils.uncapitalize(subTableFkClassName)); - context.put("subClassName", subClassName); - context.put("subclassName", StringUtils.uncapitalize(subClassName)); - context.put("subImportList", getImportList(genTable.getSubTable())); - } - - /** - * 获取模板信息 - * - * @return 模板列表 - */ - public static List getTemplateList(String tplCategory) - { - List templates = new ArrayList(); - templates.add("vm/java/domain.java.vm"); - templates.add("vm/java/mapper.java.vm"); - templates.add("vm/java/service.java.vm"); - templates.add("vm/java/serviceImpl.java.vm"); - templates.add("vm/java/controller.java.vm"); - templates.add("vm/xml/mapper.xml.vm"); - templates.add("vm/sql/sql.vm"); - templates.add("vm/js/api.js.vm"); - if (GenConstants.TPL_CRUD.equals(tplCategory)) - { - templates.add("vm/vue/index.vue.vm"); - } - else if (GenConstants.TPL_TREE.equals(tplCategory)) - { - templates.add("vm/vue/index-tree.vue.vm"); - } - else if (GenConstants.TPL_SUB.equals(tplCategory)) - { - templates.add("vm/vue/index.vue.vm"); - templates.add("vm/java/sub-domain.java.vm"); - } - return templates; - } - - /** - * 获取文件名 - */ - public static String getFileName(String template, GenTable genTable) - { - // 文件名称 - String fileName = ""; - // 包路径 - String packageName = genTable.getPackageName(); - // 模块名 - String moduleName = genTable.getModuleName(); - // 大写类名 - String className = genTable.getClassName(); - // 业务名称 - String businessName = genTable.getBusinessName(); - - String javaPath = PROJECT_PATH + "/" + StringUtils.replace(packageName, ".", "/"); - String mybatisPath = MYBATIS_PATH + "/" + moduleName; - String vuePath = "vue"; - - if (template.contains("domain.java.vm")) - { - fileName = StringUtils.format("{}/domain/{}.java", javaPath, className); - } - if (template.contains("sub-domain.java.vm") && StringUtils.equals(GenConstants.TPL_SUB, genTable.getTplCategory())) - { - fileName = StringUtils.format("{}/domain/{}.java", javaPath, genTable.getSubTable().getClassName()); - } - else if (template.contains("mapper.java.vm")) - { - fileName = StringUtils.format("{}/mapper/{}Mapper.java", javaPath, className); - } - else if (template.contains("service.java.vm")) - { - fileName = StringUtils.format("{}/service/I{}Service.java", javaPath, className); - } - else if (template.contains("serviceImpl.java.vm")) - { - fileName = StringUtils.format("{}/service/impl/{}ServiceImpl.java", javaPath, className); - } - else if (template.contains("controller.java.vm")) - { - fileName = StringUtils.format("{}/controller/{}Controller.java", javaPath, className); - } - else if (template.contains("mapper.xml.vm")) - { - fileName = StringUtils.format("{}/{}Mapper.xml", mybatisPath, className); - } - else if (template.contains("sql.vm")) - { - fileName = businessName + "Menu.sql"; - } - else if (template.contains("api.js.vm")) - { - fileName = StringUtils.format("{}/api/{}/{}.js", vuePath, moduleName, businessName); - } - else if (template.contains("index.vue.vm")) - { - fileName = StringUtils.format("{}/views/{}/{}/index.vue", vuePath, moduleName, businessName); - } - else if (template.contains("index-tree.vue.vm")) - { - fileName = StringUtils.format("{}/views/{}/{}/index.vue", vuePath, moduleName, businessName); - } - return fileName; - } - - /** - * 获取包前缀 - * - * @param packageName 包名称 - * @return 包前缀名称 - */ - public static String getPackagePrefix(String packageName) - { - int lastIndex = packageName.lastIndexOf("."); - String basePackage = StringUtils.substring(packageName, 0, lastIndex); - return basePackage; - } - - /** - * 根据列类型获取导入包 - * - * @param genTable 业务表对象 - * @return 返回需要导入的包列表 - */ - public static HashSet getImportList(GenTable genTable) - { - List columns = genTable.getColumns(); - GenTable subGenTable = genTable.getSubTable(); - HashSet importList = new HashSet(); - if (StringUtils.isNotNull(subGenTable)) - { - importList.add("java.util.List"); - } - for (GenTableColumn column : columns) - { - if (!column.isSuperColumn() && GenConstants.TYPE_DATE.equals(column.getJavaType())) - { - importList.add("java.util.Date"); - importList.add("com.fasterxml.jackson.annotation.JsonFormat"); - } - else if (!column.isSuperColumn() && GenConstants.TYPE_BIGDECIMAL.equals(column.getJavaType())) - { - importList.add("java.math.BigDecimal"); - } - } - return importList; - } - - /** - * 获取权限前缀 - * - * @param moduleName 模块名称 - * @param businessName 业务名称 - * @return 返回权限前缀 - */ - public static String getPermissionPrefix(String moduleName, String businessName) - { - return StringUtils.format("{}:{}", moduleName, businessName); - } - - /** - * 获取上级菜单ID字段 - * - * @param paramsObj 生成其他选项 - * @return 上级菜单ID字段 - */ - public static String getParentMenuId(JSONObject paramsObj) - { - if (StringUtils.isNotEmpty(paramsObj) && paramsObj.containsKey(GenConstants.PARENT_MENU_ID)) - { - return paramsObj.getString(GenConstants.PARENT_MENU_ID); - } - return DEFAULT_PARENT_MENU_ID; - } - - /** - * 获取树编码 - * - * @param paramsObj 生成其他选项 - * @return 树编码 - */ - public static String getTreecode(JSONObject paramsObj) - { - if (paramsObj.containsKey(GenConstants.TREE_CODE)) - { - return StringUtils.toCamelCase(paramsObj.getString(GenConstants.TREE_CODE)); - } - return StringUtils.EMPTY; - } - - /** - * 获取树父编码 - * - * @param paramsObj 生成其他选项 - * @return 树父编码 - */ - public static String getTreeParentCode(JSONObject paramsObj) - { - if (paramsObj.containsKey(GenConstants.TREE_PARENT_CODE)) - { - return StringUtils.toCamelCase(paramsObj.getString(GenConstants.TREE_PARENT_CODE)); - } - return StringUtils.EMPTY; - } - - /** - * 获取树名称 - * - * @param paramsObj 生成其他选项 - * @return 树名称 - */ - public static String getTreeName(JSONObject paramsObj) - { - if (paramsObj.containsKey(GenConstants.TREE_NAME)) - { - return StringUtils.toCamelCase(paramsObj.getString(GenConstants.TREE_NAME)); - } - return StringUtils.EMPTY; - } - - /** - * 获取需要在哪一列上面显示展开按钮 - * - * @param genTable 业务表对象 - * @return 展开按钮列序号 - */ - public static int getExpandColumn(GenTable genTable) - { - String options = genTable.getOptions(); - JSONObject paramsObj = JSONObject.parseObject(options); - String treeName = paramsObj.getString(GenConstants.TREE_NAME); - int num = 0; - for (GenTableColumn column : genTable.getColumns()) - { - if (column.isList()) - { - num++; - String columnName = column.getColumnName(); - if (columnName.equals(treeName)) - { - break; - } - } - } - return num; - } -} diff --git a/mate-support/mate-generator/src/main/java/vip/mate/generator/util/package-info.java b/mate-support/mate-generator/src/main/java/vip/mate/generator/util/package-info.java deleted file mode 100644 index 735de23d7196f4093f4b1f20e115691eddba0764..0000000000000000000000000000000000000000 --- a/mate-support/mate-generator/src/main/java/vip/mate/generator/util/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package vip.mate.generator.util; \ No newline at end of file diff --git a/mate-support/mate-generator/src/main/resources/application-test.yml b/mate-support/mate-generator/src/main/resources/application-test.yml deleted file mode 100644 index 9f2edbe6992ea2b6129a2a29d44a13d6f9faa709..0000000000000000000000000000000000000000 --- a/mate-support/mate-generator/src/main/resources/application-test.yml +++ /dev/null @@ -1,10 +0,0 @@ -server: - port: 30002 -spring: - application: - name: @artifactId@ - #数据源配置 - datasource: - url: ${mate.datasource.url} - username: ${mate.datasource.username} - password: ${mate.datasource.password} diff --git a/mate-support/mate-generator/src/main/resources/generator.yml b/mate-support/mate-generator/src/main/resources/generator.yml deleted file mode 100644 index fe172f3f7a61e12134534bdcc13dfa6329e6c43a..0000000000000000000000000000000000000000 --- a/mate-support/mate-generator/src/main/resources/generator.yml +++ /dev/null @@ -1,17 +0,0 @@ -# 代码生成 -gen: - # 作者 - author: ruoyi - # 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool - packageName: generator.system - # 自动去除表前缀,默认是false - autoRemovePre: false - # 表前缀(生成类名不会包含表前缀,多个用逗号分隔) - tablePrefix: sys_ - - - - - - - diff --git a/mate-support/mate-generator/src/main/resources/vm/java/controller.java.vm b/mate-support/mate-generator/src/main/resources/vm/java/controller.java.vm deleted file mode 100644 index 44ea251eeaeeb37b185d5893f060231795a2f8ae..0000000000000000000000000000000000000000 --- a/mate-support/mate-generator/src/main/resources/vm/java/controller.java.vm +++ /dev/null @@ -1,109 +0,0 @@ -package ${packageName}.controller; - -import java.util.List; -import java.util.Map; -import vip.mate.core.common.api.Result; -import vip.mate.core.auth.annotation.PreAuth; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import lombok.AllArgsConstructor; -import vip.mate.core.web.controller.BaseController; -import ${packageName}.domain.${ClassName}; -import ${packageName}.service.I${ClassName}Service; -import vip.mate.core.file.util.ExcelUtil; - - -/** - * ${functionName}Controller - * - * @author ${author} - * @date ${datetime} - */ -@RestController -@AllArgsConstructor -@RequestMapping("/${moduleName}/${businessName}") -public class ${ClassName}Controller extends BaseController -{ - @Autowired - private I${ClassName}Service ${className}Service; - - /** - * 查询${functionName}列表 - */ - @PreAuth - @GetMapping("/list") -#if($table.crud || $table.sub) - public Result list(@RequestParam Map query) - { - return Result.data(${className}Service.listPage(query)); - } -#elseif($table.tree) - public Result list(@RequestParam Map query) - { - List<${ClassName}> list = ${className}Service.select${ClassName}List(query); - return Result.data(list); - } -#end - - /** - * 导出${functionName}列表 - */ - @PreAuth - @GetMapping("/export") - public Result export(@RequestParam Map query,HttpServletResponse response) - { - List<${ClassName}> list = ${className}Service.select${ClassName}List(query); - ExcelUtil.exportExcel(list,"result","sheet1",${ClassName}.class,"client",response); - return Result.success("导出成功"); - } - - /** - * 获取${functionName}详细信息 - */ - @PreAuth - @GetMapping(value = "/{${pkColumn.javaField}}") - public Result getInfo(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField}) - { - return Result.data(${className}Service.getById(${pkColumn.javaField})); - } - - /** - * 新增${functionName} - */ - @PreAuth - @PostMapping - public Result add(@RequestBody ${ClassName} ${className}) - { - ${className}Service.save(${className}); - return Result.success("新增成功"); - } - - /** - * 修改${functionName} - */ - @PreAuth - @PutMapping - public Result edit(@RequestBody ${ClassName} ${className}) - { - ${className}Service.updateById(${className}); - return Result.success("修改成功"); - } - - /** - * 删除${functionName} - */ - @PreAuth - @DeleteMapping("/{${pkColumn.javaField}s}") - public Result remove(@PathVariable ${pkColumn.javaType}[] ${pkColumn.javaField}s) - { - ${className}Service.removeByIds(Arrays.asList(${pkColumn.javaField}s)); - return Result.success("删除成功"); - } -} diff --git a/mate-support/mate-generator/src/main/resources/vm/java/domain.java.vm b/mate-support/mate-generator/src/main/resources/vm/java/domain.java.vm deleted file mode 100644 index 57efc72cd730f03e84f1bf349ccbdf4a92f3624a..0000000000000000000000000000000000000000 --- a/mate-support/mate-generator/src/main/resources/vm/java/domain.java.vm +++ /dev/null @@ -1,106 +0,0 @@ -package ${packageName}.domain; - -import cn.afterturn.easypoi.excel.annotation.Excel; -#foreach ($import in $importList) -import ${import}; -#end -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; - -#if($table.crud || $table.sub) -import vip.mate.core.database.entity.BaseEntity; -#elseif($table.tree) -import vip.mate.core.database.entity.BaseEntity; -#end - -/** - * ${functionName}对象 ${tableName} - * - * @author ${author} - * @date ${datetime} - */ -#if($table.crud || $table.sub) -#set($Entity="BaseEntity") -#elseif($table.tree) -#set($Entity="BaseEntity") -#end -public class ${ClassName} extends ${Entity} -{ - private static final long serialVersionUID = 1L; - -#foreach ($column in $columns) -#if(!$table.isSuperColumn($column.javaField)) - /** $column.columnComment */ -#if($column.list) -#set($parentheseIndex=$column.columnComment.indexOf("(")) -#if($parentheseIndex != -1) -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) -#else -#set($comment=$column.columnComment) -#end -#if($parentheseIndex != -1) - @Excel(name = "${comment}") -#elseif($column.javaType == 'Date') - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd") -#else - @Excel(name = "${comment}") -#end -#end - private $column.javaType $column.javaField; - -#end -#end -#if($table.sub) - /** $table.subTable.functionName信息 */ - private List<${subClassName}> ${subclassName}List; - -#end -#foreach ($column in $columns) -#if(!$table.isSuperColumn($column.javaField)) -#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) -#set($AttrName=$column.javaField) -#else -#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) -#end - public void set${AttrName}($column.javaType $column.javaField) - { - this.$column.javaField = $column.javaField; - } - - public $column.javaType get${AttrName}() - { - return $column.javaField; - } -#end -#end - -#if($table.sub) - public List<${subClassName}> get${subClassName}List() - { - return ${subclassName}List; - } - - public void set${subClassName}List(List<${subClassName}> ${subclassName}List) - { - this.${subclassName}List = ${subclassName}List; - } - -#end - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) -#foreach ($column in $columns) -#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) -#set($AttrName=$column.javaField) -#else -#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) -#end - .append("${column.javaField}", get${AttrName}()) -#end -#if($table.sub) - .append("${subclassName}List", get${subClassName}List()) -#end - .toString(); - } -} diff --git a/mate-support/mate-generator/src/main/resources/vm/java/mapper.java.vm b/mate-support/mate-generator/src/main/resources/vm/java/mapper.java.vm deleted file mode 100644 index 871ca9073465d98e0298aedb315467d9736521c9..0000000000000000000000000000000000000000 --- a/mate-support/mate-generator/src/main/resources/vm/java/mapper.java.vm +++ /dev/null @@ -1,37 +0,0 @@ -package ${packageName}.mapper; - -import java.util.List; -import java.util.Map; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import org.apache.ibatis.annotations.Param; -import ${packageName}.domain.${ClassName}; -#if($table.sub) -import ${packageName}.domain.${subClassName}; -#end - -/** - * ${functionName}Mapper接口 - * - * @author ${author} - * @date ${datetime} - */ -public interface ${ClassName}Mapper extends BaseMapper<${ClassName}> -{ - - /** - * 查询${functionName}列表 - * - * @param query - * @return ${functionName}集合 - */ - List<${ClassName}> select${ClassName}List(@Param("params") Map query); - - /** - * 查询${functionName}分页列表 - * - * @param query - * @return ${functionName}集合 - */ - IPage<${ClassName}> select${ClassName}List(Page<${ClassName}> page,@Param("params") Map query); -} diff --git a/mate-support/mate-generator/src/main/resources/vm/java/service.java.vm b/mate-support/mate-generator/src/main/resources/vm/java/service.java.vm deleted file mode 100644 index c03e6e71e1c5998e245a6521ea26ae704d456635..0000000000000000000000000000000000000000 --- a/mate-support/mate-generator/src/main/resources/vm/java/service.java.vm +++ /dev/null @@ -1,31 +0,0 @@ -package ${packageName}.service; - -import java.util.List; -import java.util.Map; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baomidou.mybatisplus.core.metadata.IPage; -import ${packageName}.domain.${ClassName}; - -/** - * ${functionName}Service接口 - * - * - * @author ${author} - * @date ${datetime} - */ -public interface I${ClassName}Service extends IService<${ClassName}> -{ - /** - * 查询${functionName}列表 - * - * @param query - * @return ${functionName}集合 - */ - public List<${ClassName}> select${ClassName}List(Map query); - - /** - * 分页业务方法 - * @return IPage - */ - IPage<${ClassName}> listPage(Map query); -} diff --git a/mate-support/mate-generator/src/main/resources/vm/java/serviceImpl.java.vm b/mate-support/mate-generator/src/main/resources/vm/java/serviceImpl.java.vm deleted file mode 100644 index 2f0b05cda56e44d0642a81ff2d9d24f2472b8931..0000000000000000000000000000000000000000 --- a/mate-support/mate-generator/src/main/resources/vm/java/serviceImpl.java.vm +++ /dev/null @@ -1,59 +0,0 @@ -package ${packageName}.service.impl; - -import java.util.List; -import java.util.Date; -import java.time.LocalDateTime; -import vip.mate.core.web.util.CollectionUtil; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -#foreach ($column in $columns) -#if($column.javaField == 'createTime' || $column.javaField == 'updateTime') -#break -#end -#end -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -#if($table.sub) -import java.util.ArrayList; -import org.springframework.transaction.annotation.Transactional; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import ${packageName}.domain.${subClassName}; -#end -import ${packageName}.mapper.${ClassName}Mapper; -import ${packageName}.domain.${ClassName}; -import ${packageName}.service.I${ClassName}Service; - -/** - * ${functionName}Service业务层处理 - * - * @author ${author} - * @date ${datetime} - */ -@Service -public class ${ClassName}ServiceImpl extends ServiceImpl<${ClassName}Mapper, ${ClassName}> implements I${ClassName}Service -{ - @Autowired - private ${ClassName}Mapper ${className}Mapper; - - /** - * 查询${functionName}列表 - * - * @param query - * @return ${functionName} - */ - @Override - public List<${ClassName}> select${ClassName}List(Map query) - { - return ${className}Mapper.select${ClassName}List(query); - } - - @Override - public IPage<${ClassName}> listPage(Map query) { - long current = CollectionUtil.strToLong(query.get("current"), 0L); - long size = CollectionUtil.strToLong(query.get("size"), 0L); - Page<${ClassName}> page = new Page<>(current, size); - return ${className}Mapper.select${ClassName}List(page,query); - } -} diff --git a/mate-support/mate-generator/src/main/resources/vm/java/sub-domain.java.vm b/mate-support/mate-generator/src/main/resources/vm/java/sub-domain.java.vm deleted file mode 100644 index a3f53ebab9896cd40de0fd40d80153c3d2ba812e..0000000000000000000000000000000000000000 --- a/mate-support/mate-generator/src/main/resources/vm/java/sub-domain.java.vm +++ /dev/null @@ -1,76 +0,0 @@ -package ${packageName}.domain; - -#foreach ($import in $subImportList) -import ${import}; -#end -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; - -/** - * ${subTable.functionName}对象 ${subTableName} - * - * @author ${author} - * @date ${datetime} - */ -public class ${subClassName} extends BaseEntity -{ - private static final long serialVersionUID = 1L; - -#foreach ($column in $subTable.columns) -#if(!$table.isSuperColumn($column.javaField)) - /** $column.columnComment */ -#if($column.list) -#set($parentheseIndex=$column.columnComment.indexOf("(")) -#if($parentheseIndex != -1) -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) -#else -#set($comment=$column.columnComment) -#end -#if($parentheseIndex != -1) - @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") -#elseif($column.javaType == 'Date') - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd") -#else - @Excel(name = "${comment}") -#end -#end - private $column.javaType $column.javaField; - -#end -#end -#foreach ($column in $subTable.columns) -#if(!$table.isSuperColumn($column.javaField)) -#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) -#set($AttrName=$column.javaField) -#else -#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) -#end - public void set${AttrName}($column.javaType $column.javaField) - { - this.$column.javaField = $column.javaField; - } - - public $column.javaType get${AttrName}() - { - return $column.javaField; - } -#end -#end - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) -#foreach ($column in $subTable.columns) -#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) -#set($AttrName=$column.javaField) -#else -#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) -#end - .append("${column.javaField}", get${AttrName}()) -#end - .toString(); - } -} diff --git a/mate-support/mate-generator/src/main/resources/vm/js/api.js.vm b/mate-support/mate-generator/src/main/resources/vm/js/api.js.vm deleted file mode 100644 index 23e900b536b9a20619b3837725ccad549b4d5c6d..0000000000000000000000000000000000000000 --- a/mate-support/mate-generator/src/main/resources/vm/js/api.js.vm +++ /dev/null @@ -1,54 +0,0 @@ -import request from '@/utils/request' - -// 查询${functionName}列表 -export function list${BusinessName}(query) { - return request({ - url: '/${moduleName}/${businessName}/list', - method: 'get', - params: query - }) -} - -// 查询${functionName}详细 -export function get${BusinessName}(${pkColumn.javaField}) { - return request({ - url: '/${moduleName}/${businessName}/' + ${pkColumn.javaField}, - method: 'get' - }) -} - -// 新增${functionName} -export function add${BusinessName}(data) { - return request({ - url: '/${moduleName}/${businessName}', - method: 'post', - data: data - }) -} - -// 修改${functionName} -export function update${BusinessName}(data) { - return request({ - url: '/${moduleName}/${businessName}', - method: 'put', - data: data - }) -} - -// 删除${functionName} -export function del${BusinessName}(${pkColumn.javaField}) { - return request({ - url: '/${moduleName}/${businessName}/' + ${pkColumn.javaField}, - method: 'delete' - }) -} - -// 导出${functionName} -export function export${BusinessName}(query) { - return request({ - url: '/${moduleName}/${businessName}/export', - method: 'get', - params: query, - responseType: 'blob', - }) -} \ No newline at end of file diff --git a/mate-support/mate-generator/src/main/resources/vm/sql/sql.vm b/mate-support/mate-generator/src/main/resources/vm/sql/sql.vm deleted file mode 100644 index 057558350ca33f70499732c336a93e0e2d14060d..0000000000000000000000000000000000000000 --- a/mate-support/mate-generator/src/main/resources/vm/sql/sql.vm +++ /dev/null @@ -1,22 +0,0 @@ --- 菜单 SQL -insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('${functionName}', '${parentMenuId}', '1', '${businessName}', '${moduleName}/${businessName}/index', 1, 0, 'C', '0', '0', '${permissionPrefix}:list', '#', 'admin', sysdate(), '', null, '${functionName}菜单'); - --- 按钮父菜单ID -SELECT @parentId := LAST_INSERT_ID(); - --- 按钮 SQL -insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('${functionName}查询', @parentId, '1', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:query', '#', 'admin', sysdate(), '', null, ''); - -insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('${functionName}新增', @parentId, '2', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:add', '#', 'admin', sysdate(), '', null, ''); - -insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('${functionName}修改', @parentId, '3', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:edit', '#', 'admin', sysdate(), '', null, ''); - -insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('${functionName}删除', @parentId, '4', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:remove', '#', 'admin', sysdate(), '', null, ''); - -insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('${functionName}导出', @parentId, '5', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:export', '#', 'admin', sysdate(), '', null, ''); \ No newline at end of file diff --git a/mate-support/mate-generator/src/main/resources/vm/vue/index-tree.vue.vm b/mate-support/mate-generator/src/main/resources/vm/vue/index-tree.vue.vm deleted file mode 100644 index cc3f449efb11f61b219d5fbd62feddc56c1adf1b..0000000000000000000000000000000000000000 --- a/mate-support/mate-generator/src/main/resources/vm/vue/index-tree.vue.vm +++ /dev/null @@ -1,529 +0,0 @@ - - - diff --git a/mate-support/mate-generator/src/main/resources/vm/vue/index.vue.vm b/mate-support/mate-generator/src/main/resources/vm/vue/index.vue.vm deleted file mode 100644 index cd18b2ee2b5457830388110fb9d7b1789b0aa0dc..0000000000000000000000000000000000000000 --- a/mate-support/mate-generator/src/main/resources/vm/vue/index.vue.vm +++ /dev/null @@ -1,662 +0,0 @@ - - - diff --git a/mate-support/mate-generator/src/main/resources/vm/xml/mapper.xml.vm b/mate-support/mate-generator/src/main/resources/vm/xml/mapper.xml.vm deleted file mode 100644 index 95db4d43e51049c1dba984f279d587fc5003ed04..0000000000000000000000000000000000000000 --- a/mate-support/mate-generator/src/main/resources/vm/xml/mapper.xml.vm +++ /dev/null @@ -1,62 +0,0 @@ - - - - - -#foreach ($column in $columns) - -#end - -#if($table.sub) - - - - - - -#foreach ($column in $subTable.columns) - -#end - -#end - - - select#foreach($column in $columns) $column.columnName#if($velocityCount != $columns.size()),#end#end from ${tableName} - - - - - - \ No newline at end of file diff --git a/mate-support/mate-job-admin/pom.xml b/mate-support/mate-job-admin/pom.xml index e82c8e9e516982475f48aedb344b1af903cbfed1..1067dc3eea373c6e44e3f87699da1aa0e3e7bf0d 100644 --- a/mate-support/mate-job-admin/pom.xml +++ b/mate-support/mate-job-admin/pom.xml @@ -5,7 +5,7 @@ mate-support vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-support/mate-job/pom.xml b/mate-support/mate-job/pom.xml index 175537da0f26175ac0acd66bdf78ad624b1cbded..189467388628c6c415865941eaf368ce535a45af 100644 --- a/mate-support/mate-job/pom.xml +++ b/mate-support/mate-job/pom.xml @@ -5,7 +5,7 @@ mate-support vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/mate-support/pom.xml b/mate-support/pom.xml index 837d0de50a6c5274e6f7fea6ab4db61d273b2f5a..98f36ae311d70b7f9d3a24124ddd3cc2b4e4664e 100644 --- a/mate-support/pom.xml +++ b/mate-support/pom.xml @@ -5,7 +5,7 @@ matecloud vip.mate - 3.1.8 + 3.2.8 4.0.0 @@ -16,12 +16,6 @@ mate-admin mate-job mate-job-admin - mate-generator - - - - - diff --git a/mate-uaa/pom.xml b/mate-uaa/pom.xml index d71891f10cf432e731d0b41f5b4ce104368c6197..791f00028e6c1e3c09979aec28734497d503d4d7 100644 --- a/mate-uaa/pom.xml +++ b/mate-uaa/pom.xml @@ -5,7 +5,7 @@ matecloud vip.mate - 3.1.8 + 3.2.8 4.0.0 diff --git a/pom.xml b/pom.xml index d74b578c2eac83d42912dc782e1336285f0fc496..a7cf5fb858c4eb559b669100f96d22a22dca428b 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ vip.mate matecloud pom - 3.1.8 + 3.2.8 matecloud Mate Cloud - 基于Spring Cloud Alibaba实现的微服务架构 @@ -20,10 +20,11 @@ mate-support mate-platform mate-mq + mate-examples - 3.1.8 + 3.2.8 1.8 3.8.1 UTF-8