first commit

This commit is contained in:
2023-07-03 22:16:16 +08:00
parent 4788b710e7
commit 065b60f851
10 changed files with 233 additions and 30 deletions

View File

@ -11,7 +11,7 @@
Target Server Version : 50742
File Encoding : 65001
Date: 03/07/2023 17:40:38
Date: 03/07/2023 22:15:33
*/
SET NAMES utf8mb4;
@ -38,7 +38,7 @@ CREATE TABLE `generator_table` (
-- ----------------------------
-- Records of generator_table
-- ----------------------------
INSERT INTO `generator_table` VALUES (1675792140603056129, 'test_user', '测试用户表', 'TestUser', 'com.qiaoba.module.generator', 'generator', 'user', '测试用户', 'Ailanyin', '/');
INSERT INTO `generator_table` VALUES (1675792140603056129, 'test_user', '测试用户表', 'TestUser', 'com.qiaoba.module.generator', 'generator', 'user', '测试用户123', 'Ailanyin乔巴', '/');
-- ----------------------------
-- Table structure for generator_table_column
@ -68,22 +68,22 @@ CREATE TABLE `generator_table_column` (
-- ----------------------------
-- Records of generator_table_column
-- ----------------------------
INSERT INTO `generator_table_column` VALUES (1675792140741468162, '1675792140603056129', 'user_id', '用户ID', 'bigint(20)', 'Long', 'userId', '1', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 1);
INSERT INTO `generator_table_column` VALUES (1675792140775022593, '1675792140603056129', 'dept_id', '部门ID', 'bigint(20)', 'Long', 'deptId', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 2);
INSERT INTO `generator_table_column` VALUES (1675792140741468162, '1675792140603056129', 'user_id', '用户ID', 'bigint(20)', 'Long', 'userId', '1', '1', '1', '1', '1', '1', 'EQ', 'input', '', 1);
INSERT INTO `generator_table_column` VALUES (1675792140775022593, '1675792140603056129', 'dept_id', '部门ID', 'bigint(20)', 'Long', 'deptId', '0', '1', '1', '1', '1', '1', 'EQ', 'input', '', 2);
INSERT INTO `generator_table_column` VALUES (1675792140795994114, '1675792140603056129', 'username', '用户账号', 'varchar(30)', 'String', 'username', '0', '1', '1', '1', '1', '1', 'LIKE', 'input', '', 3);
INSERT INTO `generator_table_column` VALUES (1675792140863102977, '1675792140603056129', 'nickname', '用户昵称', 'varchar(30)', 'String', 'nickname', '0', '1', '1', '1', '1', '1', 'LIKE', 'input', '', 4);
INSERT INTO `generator_table_column` VALUES (1675792140955377666, '1675792140603056129', 'email', '用户邮箱', 'varchar(50)', 'String', 'email', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 5);
INSERT INTO `generator_table_column` VALUES (1675792140997320705, '1675792140603056129', 'phone', '手机号码', 'varchar(11)', 'String', 'phone', '0', NULL, '1', '1', '1', '1', 'LIKE', 'input', '', 6);
INSERT INTO `generator_table_column` VALUES (1675792141026680834, '1675792140603056129', 'gender', '用户性别0男 1女 2未知', 'char(1)', 'String', 'gender', '0', NULL, '1', '1', '1', '1', 'EQ', 'select', '', 7);
INSERT INTO `generator_table_column` VALUES (1675792141047652354, '1675792140603056129', 'avatar', '头像地址', 'varchar(100)', 'String', 'avatar', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 8);
INSERT INTO `generator_table_column` VALUES (1675792141072818177, '1675792140603056129', 'password', '密码', 'varchar(100)', 'String', 'password', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 9);
INSERT INTO `generator_table_column` VALUES (1675792141102178306, '1675792140603056129', 'status', '帐号状态1正常 0停用', 'char(1)', 'String', 'status', '0', NULL, '1', '1', '1', '1', 'EQ', 'radio', '', 10);
INSERT INTO `generator_table_column` VALUES (1675792141131538434, '1675792140603056129', 'create_user', '创建者', 'varchar(64)', 'String', 'createUser', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 11);
INSERT INTO `generator_table_column` VALUES (1675792141173481473, '1675792140603056129', 'create_time', '创建时间', 'datetime', 'Date', 'createTime', '0', NULL, '1', NULL, NULL, NULL, 'EQ', 'datetime', '', 12);
INSERT INTO `generator_table_column` VALUES (1675792141198647297, '1675792140603056129', 'update_user', '更新者', 'varchar(64)', 'String', 'updateUser', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 13);
INSERT INTO `generator_table_column` VALUES (1675792141219618818, '1675792140603056129', 'update_time', '更新时间', 'datetime', 'Date', 'updateTime', '0', NULL, '1', '1', NULL, NULL, 'EQ', 'datetime', '', 14);
INSERT INTO `generator_table_column` VALUES (1675792141244784642, '1675792140603056129', 'remark', '备注', 'varchar(500)', 'String', 'remark', '0', NULL, '1', '1', '1', NULL, 'EQ', 'textarea', '', 15);
INSERT INTO `generator_table_column` VALUES (1675792141257367553, '1675792140603056129', 'tenant_id', '租户ID', 'bigint(20)', 'Long', 'tenantId', '0', NULL, '1', '1', '1', '1', 'EQ', 'input', '', 16);
INSERT INTO `generator_table_column` VALUES (1675792140955377666, '1675792140603056129', 'email', '用户邮箱', 'varchar(50)', 'String', 'email', '0', '1', '1', '1', '1', '1', 'EQ', 'input', '', 5);
INSERT INTO `generator_table_column` VALUES (1675792140997320705, '1675792140603056129', 'phone', '手机号码', 'varchar(11)', 'String', 'phone', '0', '1', '1', '1', '1', '1', 'LIKE', 'input', '', 6);
INSERT INTO `generator_table_column` VALUES (1675792141026680834, '1675792140603056129', 'gender', '用户性别0男 1女 2未知', 'char(1)', 'String', 'gender', '0', '1', '1', '1', '1', '1', 'EQ', 'select', '', 7);
INSERT INTO `generator_table_column` VALUES (1675792141047652354, '1675792140603056129', 'avatar', '头像地址', 'varchar(100)', 'String', 'avatar', '0', '1', '1', '1', '1', '1', 'EQ', 'input', '', 8);
INSERT INTO `generator_table_column` VALUES (1675792141072818177, '1675792140603056129', 'password', '密码', 'varchar(100)', 'String', 'password', '0', '1', '1', '1', '1', '1', 'EQ', 'input', '', 9);
INSERT INTO `generator_table_column` VALUES (1675792141102178306, '1675792140603056129', 'status', '帐号状态1正常 0停用', 'char(1)', 'String', 'status', '0', '1', '1', '1', '1', '1', 'EQ', 'radio', '', 10);
INSERT INTO `generator_table_column` VALUES (1675792141131538434, '1675792140603056129', 'create_user', '创建者', 'varchar(64)', 'String', 'createUser', '0', '1', '1', '1', '1', '1', 'EQ', 'input', '', 11);
INSERT INTO `generator_table_column` VALUES (1675792141173481473, '1675792140603056129', 'create_time', '创建时间', 'datetime', 'Date', 'createTime', '0', '1', '1', '1', '1', '1', 'EQ', 'datetime', '', 12);
INSERT INTO `generator_table_column` VALUES (1675792141198647297, '1675792140603056129', 'update_user', '更新者', 'varchar(64)', 'String', 'updateUser', '0', '1', '1', '1', '1', '1', 'EQ', 'input', '', 13);
INSERT INTO `generator_table_column` VALUES (1675792141219618818, '1675792140603056129', 'update_time', '更新时间', 'datetime', 'Date', 'updateTime', '0', '1', '1', '1', '1', '1', 'EQ', 'datetime', '', 14);
INSERT INTO `generator_table_column` VALUES (1675792141244784642, '1675792140603056129', 'remark', '备注', 'varchar(500)', 'String', 'remark', '0', '1', '1', '1', '1', '1', 'EQ', 'textarea', '', 15);
INSERT INTO `generator_table_column` VALUES (1675792141257367553, '1675792140603056129', 'tenant_id', '租户ID', 'bigint(20)', 'Long', 'tenantId', '0', '1', '1', '1', '1', '1', 'EQ', 'input', '', 16);
-- ----------------------------
-- Table structure for sys_config
@ -274,6 +274,11 @@ INSERT INTO `sys_login_log` VALUES (1674686672493084674, '1eb95893354f49028b3d12
INSERT INTO `sys_login_log` VALUES (1674687698633752578, '06458226410b4fd5b0c62434172ea079', 'admin', '小王', '192.168.0.201', '0|0|0|内网IP|内网IP', 'Chrome|114.0.0.0', 'Windows 10 or Windows Server 2016', '2023-06-30 15:53:56', '', NULL, '', NULL, NULL, 1);
INSERT INTO `sys_login_log` VALUES (1674694028866179074, 'bc678e6e160649f7b19fef95c1e848b9', 'admin', '小王', '192.168.0.201', '0|0|0|内网IP|内网IP', 'Chrome|114.0.0.0', 'Windows 10 or Windows Server 2016', '2023-06-30 16:19:05', '', NULL, '', NULL, NULL, 1);
INSERT INTO `sys_login_log` VALUES (1675673177286074370, '0ca8648ac05c4b8d8622ab7434b5c21e', 'admin', '小王', '192.168.0.201', '0|0|0|内网IP|内网IP', 'Chrome|114.0.0.0', 'Windows 10 or Windows Server 2016', '2023-07-03 09:09:52', '', NULL, '', NULL, NULL, 1);
INSERT INTO `sys_login_log` VALUES (1675844141158649858, 'c1c0e35ec6c54d489274dcaa46c4059a', 'admin', '小王', '127.0.0.1', '0|0|0|内网IP|内网IP', 'Chrome|108.0.0.0', 'Windows 10 or Windows Server 2016', '2023-07-03 20:29:14', '', NULL, '', NULL, NULL, 1);
INSERT INTO `sys_login_log` VALUES (1675846226075865090, '4efabe6e524048d797b6bb64c46be317', 'admin', '小王', '127.0.0.1', '0|0|0|内网IP|内网IP', 'Chrome|108.0.0.0', 'Windows 10 or Windows Server 2016', '2023-07-03 20:37:31', '', NULL, '', NULL, NULL, 1);
INSERT INTO `sys_login_log` VALUES (1675847691775397890, 'd7e5c05cfd4c482b81044c468e0a1977', 'admin', '小王', '127.0.0.1', '0|0|0|内网IP|内网IP', 'Chrome|108.0.0.0', 'Windows 10 or Windows Server 2016', '2023-07-03 20:43:20', '', NULL, '', NULL, NULL, 1);
INSERT INTO `sys_login_log` VALUES (1675865446528524289, 'e15b4168ec6c430788b8d30121247c35', 'admin', '小王', '127.0.0.1', '0|0|0|内网IP|内网IP', 'Chrome|108.0.0.0', 'Windows 10 or Windows Server 2016', '2023-07-03 21:53:53', '', NULL, '', NULL, NULL, 1);
INSERT INTO `sys_login_log` VALUES (1675866008431042562, 'c602923e58b24a72be492b78e689b117', 'admin', '小王', '127.0.0.1', '0|0|0|内网IP|内网IP', 'Chrome|108.0.0.0', 'Windows 10 or Windows Server 2016', '2023-07-03 21:56:07', '', NULL, '', NULL, NULL, 1);
-- ----------------------------
-- Table structure for sys_menu
@ -307,6 +312,7 @@ CREATE TABLE `sys_menu` (
-- ----------------------------
INSERT INTO `sys_menu` VALUES (1, '系统管理', 0, 1, 'system', NULL, '', 0, 0, 'M', '1', '', 'system', 'admin', '2023-04-23 14:35:29', '', NULL, '系统管理目录', 1);
INSERT INTO `sys_menu` VALUES (2, '系统监控', 0, 2, 'monitor', NULL, '', 0, 0, 'M', '1', '', 'monitor', 'admin', '2023-05-27 22:25:03', '', NULL, '系统监控目录', 1);
INSERT INTO `sys_menu` VALUES (3, '附加工具', 0, 4, 'tool', NULL, NULL, 0, 0, 'M', '1', NULL, 'tool', 'admin', '2023-07-03 21:53:02', '', NULL, '', 1);
INSERT INTO `sys_menu` VALUES (100, '用户管理', 1, 1, 'user', 'system/user/index', '', 0, 0, 'C', '1', 'system:user:list', 'user', 'admin', '2023-04-23 14:35:29', '', NULL, '用户管理菜单', 1);
INSERT INTO `sys_menu` VALUES (101, '角色管理', 1, 2, 'role', 'system/role/index', '', 0, 0, 'C', '1', 'system:role:list', 'peoples', 'admin', '2023-04-23 14:35:29', '', NULL, '角色管理菜单', 1);
INSERT INTO `sys_menu` VALUES (102, '菜单管理', 1, 3, 'menu', 'system/menu/index', '', 0, 0, 'C', '1', 'system:menu:list', 'tree-table', 'admin', '2023-04-23 14:35:29', '', NULL, '菜单管理菜单', 1);
@ -315,7 +321,7 @@ INSERT INTO `sys_menu` VALUES (104, '岗位管理', 1, 5, 'post', 'system/post/i
INSERT INTO `sys_menu` VALUES (105, '字典管理', 1, 6, 'dict', 'system/dict/index', '', 0, 0, 'C', '1', 'system:dict:list', 'documentation', 'admin', '2022-08-15 18:01:28', 'admin', '2023-05-31 11:15:14', '字典管理菜单', 1);
INSERT INTO `sys_menu` VALUES (106, '参数设置', 1, 7, 'config', 'system/config/index', '', 0, 0, 'C', '1', 'system:config:list', 'edit', 'admin', '2022-08-15 18:01:28', 'admin', '2023-05-24 21:13:11', '参数设置菜单', 1);
INSERT INTO `sys_menu` VALUES (109, '在线用户', 2, 1, 'online', 'monitor/online/index', '', 0, 0, 'C', '1', 'monitor:online:list', 'online', 'admin', '2023-05-27 22:22:18', 'admin', '2023-06-19 15:29:03', '在线用户菜单', 1);
INSERT INTO `sys_menu` VALUES (116, '代码生成', 3, 4, 'gen', 'tool/gen/index', '', 0, 1, 'C', '1', 'tool:gen:list', 'code', 'admin', '2023-07-03 09:05:56', 'admin', '2023-07-03 09:10:10', '代码生成菜单', 1);
INSERT INTO `sys_menu` VALUES (116, '代码生成', 3, 1, 'gen', 'tool/gen/index', '', 0, 0, 'C', '1', 'tool:gen:list', 'code', 'admin', '2023-07-03 09:05:56', 'admin', '2023-07-03 21:53:13', '代码生成菜单', 1);
INSERT INTO `sys_menu` VALUES (1000, '用户查询', 100, 1, '', '', '', 0, 0, 'F', '1', 'system:user:query', '#', 'admin', '2023-04-23 14:35:29', '', NULL, '', 1);
INSERT INTO `sys_menu` VALUES (1001, '用户新增', 100, 2, '', '', '', 0, 0, 'F', '1', 'system:user:add', '#', 'admin', '2023-04-23 14:35:29', '', NULL, '', 1);
INSERT INTO `sys_menu` VALUES (1002, '用户修改', 100, 3, '', '', '', 0, 0, 'F', '1', 'system:user:edit', '#', 'admin', '2023-04-23 14:35:29', '', NULL, '', 1);
@ -353,12 +359,12 @@ INSERT INTO `sys_menu` VALUES (1033, '参数删除', 106, 4, '#', '', '', 0, 0,
INSERT INTO `sys_menu` VALUES (1046, '在线查询', 109, 1, '#', '', '', 0, 0, 'F', '1', 'monitor:online:query', '#', 'admin', '2023-05-27 22:22:59', '', NULL, '', 1);
INSERT INTO `sys_menu` VALUES (1047, '批量强退', 109, 2, '#', '', '', 0, 0, 'F', '1', 'monitor:online:batchLogout', '#', 'admin', '2023-05-27 22:22:59', '', NULL, '', 1);
INSERT INTO `sys_menu` VALUES (1048, '单条强退', 109, 3, '#', '', '', 0, 0, 'F', '1', 'monitor:online:forceLogout', '#', 'admin', '2023-05-27 22:22:59', '', NULL, '', 1);
INSERT INTO `sys_menu` VALUES (1055, '生成查询', 116, 1, '#', '', '', 0, 1, 'F', '1', 'tool:gen:query', '#', 'admin', '2023-07-03 09:07:41', '', NULL, '', 1);
INSERT INTO `sys_menu` VALUES (1056, '生成修改', 116, 2, '#', '', '', 0, 1, 'F', '1', 'tool:gen:edit', '#', 'admin', '2023-07-03 09:07:41', '', NULL, '', 1);
INSERT INTO `sys_menu` VALUES (1057, '生成删除', 116, 3, '#', '', '', 0, 1, 'F', '1', 'tool:gen:remove', '#', 'admin', '2023-07-03 09:07:41', '', NULL, '', 1);
INSERT INTO `sys_menu` VALUES (1058, '导入代码', 116, 4, '#', '', '', 0, 1, 'F', '1', 'tool:gen:import', '#', 'admin', '2023-07-03 09:07:41', '', NULL, '', 1);
INSERT INTO `sys_menu` VALUES (1059, '预览代码', 116, 5, '#', '', '', 0, 1, 'F', '1', 'tool:gen:preview', '#', 'admin', '2023-07-03 09:07:41', '', NULL, '', 1);
INSERT INTO `sys_menu` VALUES (1060, '生成代码', 116, 6, '#', '', '', 0, 1, 'F', '1', 'tool:gen:code', '#', 'admin', '2023-07-03 09:07:41', '', NULL, '', 1);
INSERT INTO `sys_menu` VALUES (1055, '生成查询', 116, 1, '#', '', '', 0, 0, 'F', '1', 'tool:gen:query', '#', 'admin', '2023-07-03 09:07:41', '', NULL, '', 1);
INSERT INTO `sys_menu` VALUES (1056, '生成修改', 116, 2, '#', '', '', 0, 0, 'F', '1', 'tool:gen:edit', '#', 'admin', '2023-07-03 09:07:41', '', NULL, '', 1);
INSERT INTO `sys_menu` VALUES (1057, '生成删除', 116, 3, '#', '', '', 0, 0, 'F', '1', 'tool:gen:remove', '#', 'admin', '2023-07-03 09:07:41', '', NULL, '', 1);
INSERT INTO `sys_menu` VALUES (1058, '导入代码', 116, 4, '#', '', '', 0, 0, 'F', '1', 'tool:gen:import', '#', 'admin', '2023-07-03 09:07:41', '', NULL, '', 1);
INSERT INTO `sys_menu` VALUES (1059, '预览代码', 116, 5, '#', '', '', 0, 0, 'F', '1', 'tool:gen:preview', '#', 'admin', '2023-07-03 09:07:41', '', NULL, '', 1);
INSERT INTO `sys_menu` VALUES (1060, '生成代码', 116, 6, '#', '', '', 0, 0, 'F', '1', 'tool:gen:code', '#', 'admin', '2023-07-03 09:07:41', '', NULL, '', 1);
INSERT INTO `sys_menu` VALUES (1663431933531869184, '租户管理', 0, 3, 'tenant', NULL, NULL, 0, 0, 'M', '1', NULL, 'component', 'admin', '2023-06-13 16:58:53', 'admin', '2023-06-13 17:03:42', '', 1);
INSERT INTO `sys_menu` VALUES (1663431933531869185, '租户管理', 1663431933531869184, 1, 'tenant', 'tenant/index', NULL, 0, 0, 'C', '1', 'tenant:list', 'logininfor', 'admin', '2023-05-30 14:27:33', 'admin', '2023-06-13 17:03:52', '', 1);
INSERT INTO `sys_menu` VALUES (1663432090671468545, '新建租户', 1663431933531869185, 1, '', NULL, NULL, 0, 0, 'F', '1', 'tenant:add', '#', 'admin', '2023-05-30 14:28:10', '', NULL, '', 1);
@ -424,7 +430,7 @@ CREATE TABLE `sys_role` (
-- ----------------------------
-- Records of sys_role
-- ----------------------------
INSERT INTO `sys_role` VALUES (1, '超级管理员', 'admin', 1, '1', '1', 'admin', '2023-04-23 14:35:29', 'admin', '2023-06-21 15:32:48', '超级管理员', 1);
INSERT INTO `sys_role` VALUES (1, '超级管理员', 'admin', 1, '1', '1', 'admin', '2023-04-23 14:35:29', 'admin', '2023-07-03 20:37:26', '超级管理员', 1);
INSERT INTO `sys_role` VALUES (1660535591067213826, '测试', 'test', 1, '2', '1', 'admin', '2023-05-22 14:38:31', 'admin', '2023-06-21 15:31:52', NULL, 1);
-- ----------------------------
@ -461,6 +467,7 @@ CREATE TABLE `sys_role_menu` (
-- ----------------------------
INSERT INTO `sys_role_menu` VALUES (1, 1, 1);
INSERT INTO `sys_role_menu` VALUES (1, 2, 1);
INSERT INTO `sys_role_menu` VALUES (1, 3, 1);
INSERT INTO `sys_role_menu` VALUES (1, 100, 1);
INSERT INTO `sys_role_menu` VALUES (1, 101, 1);
INSERT INTO `sys_role_menu` VALUES (1, 102, 1);
@ -469,6 +476,7 @@ INSERT INTO `sys_role_menu` VALUES (1, 104, 1);
INSERT INTO `sys_role_menu` VALUES (1, 105, 1);
INSERT INTO `sys_role_menu` VALUES (1, 106, 1);
INSERT INTO `sys_role_menu` VALUES (1, 109, 1);
INSERT INTO `sys_role_menu` VALUES (1, 116, 1);
INSERT INTO `sys_role_menu` VALUES (1, 1000, 1);
INSERT INTO `sys_role_menu` VALUES (1, 1001, 1);
INSERT INTO `sys_role_menu` VALUES (1, 1002, 1);
@ -506,6 +514,12 @@ INSERT INTO `sys_role_menu` VALUES (1, 1033, 1);
INSERT INTO `sys_role_menu` VALUES (1, 1046, 1);
INSERT INTO `sys_role_menu` VALUES (1, 1047, 1);
INSERT INTO `sys_role_menu` VALUES (1, 1048, 1);
INSERT INTO `sys_role_menu` VALUES (1, 1055, 1);
INSERT INTO `sys_role_menu` VALUES (1, 1056, 1);
INSERT INTO `sys_role_menu` VALUES (1, 1057, 1);
INSERT INTO `sys_role_menu` VALUES (1, 1058, 1);
INSERT INTO `sys_role_menu` VALUES (1, 1059, 1);
INSERT INTO `sys_role_menu` VALUES (1, 1060, 1);
INSERT INTO `sys_role_menu` VALUES (1, 1663431933531869184, 1);
INSERT INTO `sys_role_menu` VALUES (1, 1663431933531869185, 1);
INSERT INTO `sys_role_menu` VALUES (1, 1663432090671468545, 1);
@ -515,7 +529,11 @@ INSERT INTO `sys_role_menu` VALUES (1, 1666365593968984065, 1);
INSERT INTO `sys_role_menu` VALUES (1, 1666365690861600770, 1);
INSERT INTO `sys_role_menu` VALUES (1, 1666365815403069442, 1);
INSERT INTO `sys_role_menu` VALUES (1, 1666365996601196545, 1);
INSERT INTO `sys_role_menu` VALUES (1, 1666366412382552066, 1);
INSERT INTO `sys_role_menu` VALUES (1, 1668544169384468481, 1);
INSERT INTO `sys_role_menu` VALUES (1, 1670708064303742978, 1);
INSERT INTO `sys_role_menu` VALUES (1, 1670719944372002817, 1);
INSERT INTO `sys_role_menu` VALUES (1, 1670720034851528706, 1);
INSERT INTO `sys_role_menu` VALUES (1660535591067213826, 1, 1);
INSERT INTO `sys_role_menu` VALUES (1660535591067213826, 2, 1);
INSERT INTO `sys_role_menu` VALUES (1660535591067213826, 100, 1);

View File

@ -1,16 +1,27 @@
package com.qiaoba.module.generator.controller;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.io.IoUtil;
import com.qiaoba.common.base.result.AjaxResult;
import com.qiaoba.common.database.entity.PageQuery;
import com.qiaoba.common.database.entity.TableDataInfo;
import com.qiaoba.module.generator.entity.GeneratorTable;
import com.qiaoba.module.generator.entity.GeneratorTableColumn;
import com.qiaoba.module.generator.entity.dto.GeneratorTableDto;
import com.qiaoba.module.generator.entity.dto.TableDto;
import com.qiaoba.module.generator.service.GeneratorTableColumnService;
import com.qiaoba.module.generator.service.GeneratorTableService;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import sun.nio.ch.IOUtil;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 代码生成 Web层
@ -26,6 +37,35 @@ import java.io.IOException;
public class GeneratorController {
private final GeneratorTableService generatorTableService;
private final GeneratorTableColumnService generatorTableColumnService;
/**
* 查询代码生成列表
*/
@GetMapping("/list")
@Operation(summary = "获取列表")
public TableDataInfo list(TableDto dto, PageQuery pageQuery) {
return generatorTableService.selectPageList(dto, pageQuery);
}
@GetMapping(value = "/{tableId}")
public AjaxResult getInfo(@PathVariable String tableId) {
GeneratorTable table = generatorTableService.selectById(tableId);
List<GeneratorTableColumn> list = generatorTableColumnService.selectListByTableId(tableId, false);
Map<String, Object> map = new HashMap<String, Object>(2);
map.put("info", table);
map.put("rows", list);
return AjaxResult.success(map);
}
@PutMapping
public AjaxResult edit(@RequestBody GeneratorTableDto dto) {
GeneratorTable generatorTable = BeanUtil.copyProperties(dto, GeneratorTable.class);
int result = generatorTableService.updateById(generatorTable);
generatorTableColumnService.updateBatchById(dto.getColumns());
return AjaxResult.toAjax(result);
}
/**
* 导入表结构(保存)
@ -36,8 +76,7 @@ public class GeneratorController {
}
@GetMapping("/download/{tableName}")
public void download(HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException
{
public void download(HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException {
byte[] data = generatorTableService.downloadCode(tableName);
genCode(response, data);
}

View File

@ -0,0 +1,79 @@
package com.qiaoba.module.generator.entity.dto;
import com.baomidou.mybatisplus.annotation.TableId;
import com.qiaoba.module.generator.entity.GeneratorTableColumn;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.util.List;
/**
* 表字段信息
*
* @author ailanyin
* @version 1.0
* @since 2023/6/26 10:12
*/
@Getter
@Setter
public class GeneratorTableDto implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 编号
*/
@TableId
private String tableId;
/**
* 表名称
*/
private String tableName;
/**
* 表描述
*/
private String tableComment;
/**
* 实体类名称(首字母大写)
*/
private String className;
/**
* 生成包路径
*/
private String packageName;
/**
* 生成模块名
*/
private String moduleName;
/**
* 生成业务名
*/
private String businessName;
/**
* 生成功能名
*/
private String functionName;
/**
* 生成作者
*/
private String author;
/**
* 生成路径(不填默认项目路径)
*/
private String genPath;
/**
* 字段信息
*/
private List<GeneratorTableColumn> columns;
}

View File

@ -39,4 +39,11 @@ public interface GeneratorTableColumnService {
* @return 结果
*/
Integer insert(GeneratorTableColumn generatorTableColumn);
/**
* 批量根据ID更新
*
* @param columns columns
*/
void updateBatchById(List<GeneratorTableColumn> columns);
}

View File

@ -15,6 +15,31 @@ import com.qiaoba.module.generator.entity.vo.DbTableVo;
*/
public interface GeneratorTableService {
/**
* 查询业务列表
*
* @param dto 查询条件
* @param pageQuery 分页
* @return list
*/
TableDataInfo<GeneratorTable> selectPageList(TableDto dto, PageQuery pageQuery);
/**
* 根据ID查询业务
*
* @param tableId tableId
* @return info
*/
GeneratorTable selectById(String tableId);
/**
* 根据ID更新
*
* @param generatorTable generatorTable
* @return 结果
*/
int updateById(GeneratorTable generatorTable);
/**
* 分页查询数据库表
*
@ -48,4 +73,5 @@ public interface GeneratorTableService {
* @return 文件字节
*/
byte[] downloadCode(String tableName);
}

View File

@ -3,6 +3,7 @@ package com.qiaoba.module.generator.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.qiaoba.common.base.exceptions.ServiceException;
import com.qiaoba.module.generator.entity.GeneratorTableColumn;
import com.qiaoba.module.generator.entity.vo.TableColumnVo;
@ -51,4 +52,9 @@ public class GeneratorTableColumnServiceImpl implements GeneratorTableColumnServ
public Integer insert(GeneratorTableColumn generatorTableColumn) {
return generatorTableColumnMapper.insert(generatorTableColumn);
}
@Override
public void updateBatchById(List<GeneratorTableColumn> columns) {
Db.updateBatchById(columns);
}
}

View File

@ -54,6 +54,25 @@ public class GeneratorTableServiceImpl implements GeneratorTableService {
private final GeneratorTableMapper generatorTableMapper;
private final GeneratorTableColumnService generatorTableColumnService;
@Override
public TableDataInfo<GeneratorTable> selectPageList(TableDto dto, PageQuery pageQuery) {
QueryWrapper<GeneratorTable> wrapper = new QueryWrapper<>();
wrapper.lambda()
.like(StrUtil.isNotBlank(dto.getTableName()), GeneratorTable::getTableName, dto.getTableName())
.like(StrUtil.isNotBlank(dto.getTableComment()), GeneratorTable::getTableComment, dto.getTableComment());
return TableDataInfo.build(generatorTableMapper.selectPage(pageQuery.build(), wrapper));
}
@Override
public GeneratorTable selectById(String tableId) {
return generatorTableMapper.selectById(tableId);
}
@Override
public int updateById(GeneratorTable generatorTable) {
return generatorTableMapper.updateById(generatorTable);
}
@Override
public TableDataInfo<DbTableVo> selectPageDbTableList(TableDto dto, PageQuery pageQuery) {
dto.setDbType(TenantDbTypeContext.getDefault());
@ -88,9 +107,6 @@ public class GeneratorTableServiceImpl implements GeneratorTableService {
@Override
public byte[] downloadCode(String tableName) {
for (int i = 0; i < 5; i++) {
System.out.println(new Snowflake().nextIdStr());
}
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
ZipOutputStream zip = new ZipOutputStream(outputStream);
generatorCode(tableName, zip);

View File

@ -74,4 +74,13 @@ public class SysDictTypeController {
sysDictDataService.resetDictCache();
return AjaxResult.success();
}
/**
* 获取字典选择框列表
*/
@GetMapping("/option-select")
public AjaxResult optionSelect() {
List<SysDictType> dictTypes = sysDictTypeService.selectList(new SysDictTypeParam());
return AjaxResult.success(dictTypes);
}
}

View File

@ -1,6 +1,7 @@
package com.qiaoba.module.system.service;
import com.qiaoba.api.system.entity.SysDictData;
import com.qiaoba.api.system.entity.SysDictType;
import com.qiaoba.api.system.entity.param.SysDictDataParam;
import com.qiaoba.api.system.service.SysDictApiService;
import com.qiaoba.common.database.entity.PageQuery;
@ -87,4 +88,5 @@ public interface SysDictDataService extends SysDictApiService {
* 重置字典缓存数据
*/
void resetDictCache();
}

View File

@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.qiaoba.api.system.entity.SysDictData;
import com.qiaoba.api.system.entity.SysDictType;
import com.qiaoba.api.system.entity.param.SysDictDataParam;
import com.qiaoba.auth.utils.SecurityUtil;
import com.qiaoba.common.base.constants.BaseConstant;