重大更新 前端更新为新版本,后端同步更新,现在开始使用云数据库

This commit is contained in:
萌狼蓝天 2024-10-17 10:02:12 +08:00
parent 55e387b99b
commit 76be7ca3e5
14 changed files with 670 additions and 42 deletions

View File

@ -0,0 +1,409 @@
/*
Navicat Premium Data Transfer
Source Server :
Source Server Type : MySQL
Source Server Version : 50743 (5.7.43-log)
Source Host : localhost:3306
Source Schema : harmonylife
Target Server Type : MySQL
Target Server Version : 50743 (5.7.43-log)
File Encoding : 65001
Date: 17/10/2024 09:18:11
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for agent_info
-- ----------------------------
DROP TABLE IF EXISTS `agent_info`;
CREATE TABLE `agent_info` (
`id` bigint(20) NOT NULL COMMENT 'id',
`merchant_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商户编号',
`userId` int(11) NULL DEFAULT NULL COMMENT '用户id负责人',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '商户表' ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of agent_info
-- ----------------------------
-- ----------------------------
-- Table structure for carbon_calc
-- ----------------------------
DROP TABLE IF EXISTS `carbon_calc`;
CREATE TABLE `carbon_calc` (
`id` bigint(20) NOT NULL COMMENT 'id',
`category` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '衣食住行其他',
`item_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '具体项目名称',
`unit_value` double(11, 2) NULL DEFAULT NULL COMMENT '每1单位的排碳值',
`unit_item` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '物品数量单位,比如件、只、支',
`about` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '关于',
`unit_result` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '计算结果的单位 一般是kg',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '碳足迹计算' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of carbon_calc
-- ----------------------------
INSERT INTO `carbon_calc` VALUES (1, '', '白酒', 1.76, 'kg', NULL, 'kg');
INSERT INTO `carbon_calc` VALUES (2, '', '啤酒', 0.22, '', '一瓶550ML', 'kg');
INSERT INTO `carbon_calc` VALUES (3, '', '', 0.02, '', NULL, 'kg');
INSERT INTO `carbon_calc` VALUES (4, '', '', 1970.00, '', NULL, 'kg');
INSERT INTO `carbon_calc` VALUES (5, '', '用电', 1.00, '', NULL, 'kg');
INSERT INTO `carbon_calc` VALUES (6, '', '用水', 0.91, '立方米', NULL, 'kg');
INSERT INTO `carbon_calc` VALUES (7, '', '煤气', 0.71, '立方米', NULL, 'kg');
INSERT INTO `carbon_calc` VALUES (8, '', '天然气', 2.19, '立方米', NULL, 'kg');
INSERT INTO `carbon_calc` VALUES (9, '', '集中供暖', 0.13, '平方米/天', NULL, 'kg');
INSERT INTO `carbon_calc` VALUES (10, '', '蜂窝煤', 3.30, '', NULL, 'kg');
INSERT INTO `carbon_calc` VALUES (11, '', '液化石油气', 5.48, '立方米', NULL, 'kg');
INSERT INTO `carbon_calc` VALUES (12, '', '羊肉', 39.20, '千克', NULL, 'kg');
INSERT INTO `carbon_calc` VALUES (13, '', '牛肉', 27.00, '千克', NULL, 'kg');
INSERT INTO `carbon_calc` VALUES (14, '', '猪肉', 12.10, '千克', NULL, 'kg');
INSERT INTO `carbon_calc` VALUES (15, '', '', 1.80, '千克', NULL, 'kg');
INSERT INTO `carbon_calc` VALUES (16, '', '鸡蛋', 4.80, '千克', NULL, 'kg');
INSERT INTO `carbon_calc` VALUES (17, '', '土豆', 2.90, '千克', NULL, 'kg');
INSERT INTO `carbon_calc` VALUES (18, '', '米饭', 2.70, '千克', NULL, 'kg');
INSERT INTO `carbon_calc` VALUES (19, '', '花生', 2.50, '千克', NULL, 'kg');
INSERT INTO `carbon_calc` VALUES (20, '', '酸奶', 2.20, '千克', NULL, 'kg');
INSERT INTO `carbon_calc` VALUES (21, '', '西兰花', 2.00, '千克', NULL, 'kg');
INSERT INTO `carbon_calc` VALUES (22, '', '豆腐', 2.00, '千克', NULL, 'kg');
INSERT INTO `carbon_calc` VALUES (23, '', '牛奶', 1.90, '千克', NULL, 'kg');
INSERT INTO `carbon_calc` VALUES (24, '', '西红柿', 1.10, '千克', NULL, 'kg');
INSERT INTO `carbon_calc` VALUES (25, '', '扁豆', 0.90, '千克', NULL, 'kg');
INSERT INTO `carbon_calc` VALUES (26, '', '飞机', 0.14, '公里', NULL, 'kg');
INSERT INTO `carbon_calc` VALUES (27, '', '火车', 0.01, '公里', NULL, 'kg');
INSERT INTO `carbon_calc` VALUES (28, '', '轮船', 0.01, '公里', NULL, 'kg');
INSERT INTO `carbon_calc` VALUES (29, '', '地铁', 0.10, '', NULL, 'kg');
INSERT INTO `carbon_calc` VALUES (30, '', '公共汽车', 0.01, '', NULL, 'kg');
INSERT INTO `carbon_calc` VALUES (31, '', '高耗油小汽车', 0.41, '公里', NULL, 'kg');
INSERT INTO `carbon_calc` VALUES (32, '', '中耗油小汽车', 0.30, '公里', NULL, 'kg');
INSERT INTO `carbon_calc` VALUES (33, '', '低耗油小汽车', 0.27, '公里', NULL, 'kg');
INSERT INTO `carbon_calc` VALUES (34, '其他', '纸制品', 3.50, '千克', NULL, 'kg');
INSERT INTO `carbon_calc` VALUES (35, '其他', '塑料袋', 0.00, '', NULL, 'kg');
INSERT INTO `carbon_calc` VALUES (36, '其他', '一次性筷子', 0.01, '', NULL, 'kg');
INSERT INTO `carbon_calc` VALUES (37, '其他', '洗发水', 0.02, '', NULL, 'kg');
INSERT INTO `carbon_calc` VALUES (38, '其他', '玫瑰', 0.18, '', NULL, 'kg');
INSERT INTO `carbon_calc` VALUES (39, '其他', '城市垃圾', 2.06, '千克', NULL, 'kg');
-- ----------------------------
-- Table structure for carbon_savingsranking
-- ----------------------------
DROP TABLE IF EXISTS `carbon_savingsranking`;
CREATE TABLE `carbon_savingsranking` (
`id` bigint(20) NOT NULL COMMENT 'id',
`rank` int(11) NOT NULL COMMENT '排名',
`entity_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '实体名称(用户名称)',
`entity_id` bigint(20) NOT NULL COMMENT '实体id雪花 勇闯天涯)',
`carbon_saved` decimal(15, 2) NOT NULL COMMENT '节约的碳量(千克)',
`period` char(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT ' 统计周期 \'\',\'\',\'\'',
`region` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '地区',
`method` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '减排方法',
`verification` tinyint(4) NOT NULL COMMENT '验证状态 1 已验证 0未验证',
`date_recorded` datetime NOT NULL COMMENT '记录日期',
`notes` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '备注',
`merchant_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '机构编码',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '节碳排行榜' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of carbon_savingsranking
-- ----------------------------
INSERT INTO `carbon_savingsranking` VALUES (1, 1, '萌狼蓝天', 1, 100.00, '年度', '重庆', NULL, 1, '2024-10-10 20:09:30', '测试数据', '1');
INSERT INTO `carbon_savingsranking` VALUES (2, 2, '明月新星', 599761118822469, 52.00, '年度', '重庆', NULL, 1, '2024-10-10 20:15:52', '测试数据', '1');
-- ----------------------------
-- Table structure for log_captcha
-- ----------------------------
DROP TABLE IF EXISTS `log_captcha`;
CREATE TABLE `log_captcha` (
`id` bigint(20) NOT NULL COMMENT '验证码id',
`username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户账号',
`code` char(8) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '验证码',
`status` tinyint(1) NOT NULL COMMENT ' 1:有效 0:无效 2:已被使用',
`valid_time` datetime NOT NULL COMMENT '有效时间',
`create_time` datetime NOT NULL COMMENT '创建时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of log_captcha
-- ----------------------------
-- ----------------------------
-- Table structure for menu_data_item
-- ----------------------------
DROP TABLE IF EXISTS `menu_data_item`;
CREATE TABLE `menu_data_item` (
`id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '唯一标识符',
`title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '菜单标题',
`icon` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '图标路径',
`path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '路由地址',
`component` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '绑定的组件名称',
`redirect` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '重定向地址',
`affix` tinyint(1) NULL DEFAULT NULL COMMENT '是否为固定标签页',
`parentId` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '父级菜单的id',
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '路由名称,主要用于保活',
`hideInMenu` tinyint(1) NULL DEFAULT NULL COMMENT '是否隐藏当前菜单',
`url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '如果是iframe模式需要的跳转URL',
`hideInBreadcrumb` tinyint(1) NULL DEFAULT NULL COMMENT '是否在面包屑导航中隐藏',
`hideChildrenInMenu` tinyint(1) NULL DEFAULT NULL COMMENT '是否隐藏所有子菜单',
`keepAlive` tinyint(1) NULL DEFAULT NULL COMMENT '是否保持激活状态',
`target` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '全连接跳转模式的目标窗口',
`locale` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '关系',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '菜单数据表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of menu_data_item
-- ----------------------------
INSERT INTO `menu_data_item` VALUES ('1', '仪表盘', 'DashboardOutlined', '/dashboard', 'RouteView', '/dashboard/analysis', NULL, NULL, 'Dashboard', NULL, NULL, NULL, NULL, NULL, NULL, 'menu.dashboard');
INSERT INTO `menu_data_item` VALUES ('10', '菜单1', NULL, '/menu/menu1', '/menu/menu1', NULL, NULL, '9', 'MenuMenu11', NULL, NULL, NULL, NULL, 1, NULL, 'menu.menu.menu1');
INSERT INTO `menu_data_item` VALUES ('11', '菜单2', NULL, '/menu/menu2', '/menu/menu2', NULL, NULL, '9', 'MenuMenu12', NULL, NULL, NULL, NULL, 1, NULL, 'menu.menu.menu2');
INSERT INTO `menu_data_item` VALUES ('12', '菜单1-1', NULL, '/menu/menu3', 'RouteView', '/menu/menu3/menu1', NULL, '9', 'MenuMenu13', NULL, NULL, NULL, NULL, NULL, NULL, 'menu.menu.menu3');
INSERT INTO `menu_data_item` VALUES ('13', '菜单1-1-1', NULL, '/menu/menu3/menu1', '/menu/menu-1-1/menu1', NULL, NULL, '12', 'MenuMenu31', NULL, NULL, NULL, NULL, 1, NULL, 'menu.menu3.menu1');
INSERT INTO `menu_data_item` VALUES ('14', '菜单1-1-2', NULL, '/menu/menu3/menu2', '/menu/menu-1-1/menu2', NULL, NULL, '12', 'MenuMenu32', NULL, NULL, NULL, NULL, 1, NULL, 'menu.menu3.menu2');
INSERT INTO `menu_data_item` VALUES ('15', '权限模块', 'ClusterOutlined', '/access', 'RouteView', '/access/common', NULL, NULL, 'Access', NULL, NULL, NULL, NULL, NULL, NULL, 'menu.access');
INSERT INTO `menu_data_item` VALUES ('16', '通用权限', NULL, '/access/common', '/access/common', NULL, NULL, '15', 'AccessCommon', NULL, NULL, NULL, NULL, NULL, NULL, 'menu.access.common');
INSERT INTO `menu_data_item` VALUES ('17', '普通用户', NULL, '/access/user', '/access/user', NULL, NULL, '15', 'AccessUser', NULL, NULL, NULL, NULL, NULL, NULL, 'menu.access.user');
INSERT INTO `menu_data_item` VALUES ('18', '管理员', NULL, '/access/admin', '/access/admin', NULL, NULL, '15', 'AccessAdmin', NULL, NULL, NULL, NULL, NULL, NULL, 'menu.access.admin');
INSERT INTO `menu_data_item` VALUES ('19', '异常页', 'WarningOutlined', '/exception', 'RouteView', '/exception/403', NULL, NULL, 'Exception', NULL, NULL, NULL, NULL, NULL, NULL, 'menu.exception');
INSERT INTO `menu_data_item` VALUES ('2', '分析页', 'DashboardOutlined', '/dashboard/analysis', '/dashboard/analysis', NULL, NULL, NULL, 'DashboardAnalysis', NULL, NULL, NULL, NULL, 1, NULL, 'menu.dashboard.analysis');
INSERT INTO `menu_data_item` VALUES ('20', '403', NULL, '/exception/403', '/exception/403', NULL, NULL, '19', '403', NULL, NULL, NULL, NULL, NULL, NULL, 'menu.exception.not-permission');
INSERT INTO `menu_data_item` VALUES ('21', '404', NULL, '/exception/404', '/exception/404', NULL, NULL, '19', '404', NULL, NULL, NULL, NULL, NULL, NULL, 'menu.exception.not-find');
INSERT INTO `menu_data_item` VALUES ('22', '500', NULL, '/exception/500', '/exception/500', NULL, NULL, '19', '500', NULL, NULL, NULL, NULL, NULL, NULL, 'menu.exception.server-error');
INSERT INTO `menu_data_item` VALUES ('23', '结果页', 'CheckCircleOutlined', '/result', 'RouteView', '/result/success', NULL, NULL, 'Result', NULL, NULL, NULL, NULL, NULL, NULL, 'menu.result');
INSERT INTO `menu_data_item` VALUES ('24', '成功页', NULL, '/result/success', '/result/success', NULL, NULL, '23', 'ResultSuccess', NULL, NULL, NULL, NULL, NULL, NULL, 'menu.result.success');
INSERT INTO `menu_data_item` VALUES ('25', '失败页', NULL, '/result/fail', '/result/fail', NULL, NULL, '23', 'ResultFail', NULL, NULL, NULL, NULL, NULL, NULL, 'menu.result.fail');
INSERT INTO `menu_data_item` VALUES ('26', '列表页', 'TableOutlined', '/list', 'RouteView', '/list/card-list', NULL, NULL, 'List', NULL, NULL, NULL, NULL, NULL, NULL, 'menu.list');
INSERT INTO `menu_data_item` VALUES ('27', '卡片列表', NULL, '/list/card-list', '/list/card-list', NULL, NULL, '26', 'ListCard', NULL, NULL, NULL, NULL, NULL, NULL, 'menu.list.card-list');
INSERT INTO `menu_data_item` VALUES ('28', '详情页', 'ProfileOutlined', '/profile', 'RouteView', '/profile/basic', NULL, NULL, 'Profile', NULL, NULL, NULL, NULL, NULL, NULL, 'menu.profile');
INSERT INTO `menu_data_item` VALUES ('29', '基础详情页', NULL, '/profile/basic', '/profile/basic/index', NULL, NULL, '28', 'ProfileBasic', NULL, NULL, NULL, NULL, NULL, NULL, 'menu.profile.basic');
INSERT INTO `menu_data_item` VALUES ('3', '表单页', 'FormOutlined', '/form', 'RouteView', '/form/basic', NULL, NULL, 'Form', NULL, NULL, NULL, NULL, NULL, NULL, 'menu.form');
INSERT INTO `menu_data_item` VALUES ('30', '搜索列表', NULL, '/list/search-list', '/list/search-list', NULL, NULL, '26', 'SearchList', NULL, NULL, NULL, NULL, NULL, NULL, 'menu.list.search-list');
INSERT INTO `menu_data_item` VALUES ('31', '搜索列表(文章)', NULL, '/list/search-list/articles', '/list/search-list/articles', NULL, NULL, '30', 'SearchListArticles', NULL, NULL, NULL, NULL, NULL, NULL, 'menu.list.search-list.articles');
INSERT INTO `menu_data_item` VALUES ('32', '搜索列表(项目)', NULL, '/list/search-list/projects', '/list/search-list/projects', NULL, NULL, '30', 'SearchListProjects', NULL, NULL, NULL, NULL, NULL, NULL, 'menu.list.search-list.projects');
INSERT INTO `menu_data_item` VALUES ('33', '搜索列表(应用)', NULL, '/list/search-list/applications', '/list/search-list/applications', NULL, NULL, '30', 'SearchListApplications', NULL, NULL, NULL, NULL, NULL, NULL, 'menu.list.search-list.applications');
INSERT INTO `menu_data_item` VALUES ('34', '标准列表', NULL, '/list/basic-list', '/list/basic-list', NULL, NULL, '26', 'BasicCard', NULL, NULL, NULL, NULL, NULL, NULL, 'menu.list.basic-list');
INSERT INTO `menu_data_item` VALUES ('35', '高级详细页', NULL, '/profile/advanced', '/profile/advanced/index', NULL, NULL, '28', 'ProfileAdvanced', NULL, NULL, NULL, NULL, NULL, NULL, 'menu.profile.advanced');
INSERT INTO `menu_data_item` VALUES ('36', '个人页', 'UserOutlined', '/account', 'RouteView', '/account/center', NULL, NULL, 'Account', NULL, NULL, NULL, NULL, NULL, NULL, 'menu.account');
INSERT INTO `menu_data_item` VALUES ('37', '个人中心', NULL, '/account/center', '/account/center', NULL, NULL, '36', 'AccountCenter', NULL, NULL, NULL, NULL, NULL, NULL, 'menu.account.center');
INSERT INTO `menu_data_item` VALUES ('38', '个人设置', NULL, '/account/settings', '/account/settings', NULL, NULL, '36', 'AccountSettings', NULL, NULL, NULL, NULL, NULL, NULL, 'menu.account.settings');
INSERT INTO `menu_data_item` VALUES ('39', '分步表单', NULL, '/form/step-form', '/form/step-form/index', NULL, NULL, '3', 'FormStep', NULL, NULL, NULL, NULL, 0, NULL, 'menu.form.step-form');
INSERT INTO `menu_data_item` VALUES ('4', '基础表单', NULL, '/form/basic-form', '/form/basic-form/index', NULL, NULL, '3', 'FormBasic', NULL, NULL, NULL, NULL, 0, NULL, 'menu.form.basic-form');
INSERT INTO `menu_data_item` VALUES ('40', '高级表单', NULL, '/form/advanced-form', '/form/advanced-form/index', NULL, NULL, '3', 'FormAdvanced', NULL, NULL, NULL, NULL, 0, NULL, 'menu.form.advanced-form');
INSERT INTO `menu_data_item` VALUES ('41', '查询表格', NULL, '/list/table-list', '/list/table-list', NULL, NULL, '26', 'ConsultTable', NULL, NULL, NULL, NULL, NULL, NULL, 'menu.list.consult-table');
INSERT INTO `menu_data_item` VALUES ('42', '监控页', NULL, '/dashboard/monitor', '/dashboard/monitor', NULL, NULL, '1', 'DashboardMonitor', NULL, NULL, NULL, NULL, 1, NULL, 'menu.dashboard.monitor');
INSERT INTO `menu_data_item` VALUES ('43', '工作台', NULL, '/dashboard/workplace', '/dashboard/workplace', NULL, NULL, '1', 'DashboardWorkplace', NULL, NULL, NULL, NULL, 1, NULL, 'menu.dashboard.workplace');
INSERT INTO `menu_data_item` VALUES ('44', '增删改查表格', NULL, '/list/crud-table', '/list/crud-table', NULL, NULL, '26', 'CrudTable', NULL, NULL, NULL, NULL, NULL, NULL, 'menu.list.crud-table');
INSERT INTO `menu_data_item` VALUES ('45', '菜单2-1', NULL, '/menu/menu4', 'RouteView', '/menu/menu4/menu1', NULL, '9', 'MenuMenu14', NULL, NULL, NULL, NULL, NULL, NULL, 'menu.menu.menu4');
INSERT INTO `menu_data_item` VALUES ('46', '菜单2-1-1', NULL, '/menu/menu4/menu1', '/menu/menu-2-1/menu1', NULL, NULL, '45', 'MenuMenu41', NULL, NULL, NULL, NULL, 1, NULL, 'menu.menu4.menu1');
INSERT INTO `menu_data_item` VALUES ('47', '菜单2-1-2', NULL, '/menu/menu4/menu2', '/menu/menu-2-1/menu2', NULL, NULL, '45', 'MenuMenu42', NULL, NULL, NULL, NULL, 1, NULL, 'menu.menu4.menu2');
INSERT INTO `menu_data_item` VALUES ('5', '链接', 'LinkOutlined', '/link', 'RouteView', '/link/iframe', NULL, NULL, 'Link', NULL, NULL, NULL, NULL, NULL, NULL, 'menu.link');
INSERT INTO `menu_data_item` VALUES ('6', 'AntDesign', NULL, '/link/iframe', 'Iframe', NULL, NULL, '5', 'LinkIframe', NULL, 'https://ant.design/', NULL, NULL, 1, NULL, 'menu.link.iframe');
INSERT INTO `menu_data_item` VALUES ('7', 'AntDesignVue', NULL, '/link/antdv', 'Iframe', NULL, NULL, '5', 'LinkAntdv', NULL, 'https://antdv.com/', NULL, NULL, 1, NULL, 'menu.link.antdv');
INSERT INTO `menu_data_item` VALUES ('8', '跳转百度', NULL, 'https://www.baidu.com', NULL, NULL, NULL, '5', 'LinkExternal', NULL, 'https://www.baidu.com', NULL, NULL, NULL, '_blank', 'menu.link.external');
INSERT INTO `menu_data_item` VALUES ('9', '菜单', 'BarsOutlined', '/menu', 'RouteView', '/menu/menu1', NULL, NULL, 'Menu', NULL, NULL, NULL, NULL, NULL, NULL, 'menu.menu');
-- ----------------------------
-- Table structure for system_action
-- ----------------------------
DROP TABLE IF EXISTS `system_action`;
CREATE TABLE `system_action` (
`id` bigint(20) NOT NULL COMMENT '动作id',
`tag` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '动作标签 例如 add',
`describe` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '动作标题 例如 增加',
`default_check` tinyint(4) NULL DEFAULT NULL COMMENT '0 false 1 true',
`status` tinyint(4) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '动作表' ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of system_action
-- ----------------------------
INSERT INTO `system_action` VALUES (1, 'add', '新增', 0, 1);
INSERT INTO `system_action` VALUES (2, 'import', '导入', 0, 1);
INSERT INTO `system_action` VALUES (3, 'get', '详情', 0, 1);
INSERT INTO `system_action` VALUES (4, 'update', '更新', 0, 1);
INSERT INTO `system_action` VALUES (5, 'delete', '删除', 0, 1);
INSERT INTO `system_action` VALUES (6, 'export', '导出', 0, 1);
-- ----------------------------
-- Table structure for system_menu_old
-- ----------------------------
DROP TABLE IF EXISTS `system_menu_old`;
CREATE TABLE `system_menu_old` (
`id` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'id',
`title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '显示的中文名称',
`key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'key',
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '路由名称',
`component` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '绑定的哪个组件默认自带的组件类型分别是Iframe、RouteView和ComponentError',
`redirect` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '重定向',
`icon` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '图标名称',
`status` tinyint(4) NULL DEFAULT NULL COMMENT '状态 0 未启用 -1 删除 1正常使用',
`parent_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '父级',
`order` int(11) NULL DEFAULT NULL COMMENT '排序,数字越小,越靠前',
`path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '地址',
`affix` tinyint(4) NULL DEFAULT NULL COMMENT '是否是固定页签 0否 1是',
`hideIn_menu` tinyint(4) NULL DEFAULT NULL COMMENT '是否隐藏当前菜单 0否 1是',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of system_menu_old
-- ----------------------------
INSERT INTO `system_menu_old` VALUES ('1', '首页', NULL, 'index', 'BasicLayout', '/dashboard/workplace', '', 1, NULL, 1, NULL, NULL, NULL);
INSERT INTO `system_menu_old` VALUES ('2', '仪表盘', 'dashboard', 'dashboard', 'RouteView', NULL, 'dashboard', 1, 'index', 1, NULL, NULL, NULL);
INSERT INTO `system_menu_old` VALUES ('3', '分析页', 'analysis', NULL, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL);
INSERT INTO `system_menu_old` VALUES ('4', '系统管理', 'system', 'system', 'PageView', NULL, 'setting', NULL, 'index', 1, NULL, NULL, NULL);
INSERT INTO `system_menu_old` VALUES ('5', '用户管理', 'userList', 'userList', NULL, NULL, NULL, NULL, 'system', 1, NULL, NULL, NULL);
INSERT INTO `system_menu_old` VALUES ('6', '菜单管理', 'menuList', 'menuList', NULL, NULL, NULL, NULL, 'system', 1, NULL, NULL, NULL);
-- ----------------------------
-- Table structure for system_permission
-- ----------------------------
DROP TABLE IF EXISTS `system_permission`;
CREATE TABLE `system_permission` (
`id` bigint(20) NOT NULL COMMENT '权限id',
`permission_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '权限id文本型',
`permission_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '权限名称(菜单名称)',
`status` tinyint(4) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '权限表' ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of system_permission
-- ----------------------------
INSERT INTO `system_permission` VALUES (1, 'dashboard', '数据中心', 1);
INSERT INTO `system_permission` VALUES (2, 'exception', '异常管理', 1);
INSERT INTO `system_permission` VALUES (3, 'result', '结果管理', 1);
INSERT INTO `system_permission` VALUES (4, 'profile', '个人信息管理', 1);
INSERT INTO `system_permission` VALUES (5, 'table', '表格管理', 1);
INSERT INTO `system_permission` VALUES (6, 'form', '表单管理', 1);
INSERT INTO `system_permission` VALUES (7, 'order', '订单管理', 1);
INSERT INTO `system_permission` VALUES (8, 'permission', '权限管理', 1);
INSERT INTO `system_permission` VALUES (9, 'role', '个人设置', 1);
INSERT INTO `system_permission` VALUES (10, 'user', '个人中心', 1);
INSERT INTO `system_permission` VALUES (11, 'system', '系统管理', 1);
INSERT INTO `system_permission` VALUES (12, 'otherPage', '其他页面', 1);
INSERT INTO `system_permission` VALUES (13, 'UserList', '用户列表', 1);
INSERT INTO `system_permission` VALUES (14, 'RoleList', '角色列表', 1);
INSERT INTO `system_permission` VALUES (15, 'support', '支持', 1);
INSERT INTO `system_permission` VALUES (16, 'userManage', '用户管理', 1);
INSERT INTO `system_permission` VALUES (17, 'menuManage', '菜单管理', 1);
-- ----------------------------
-- Table structure for system_permission_action
-- ----------------------------
DROP TABLE IF EXISTS `system_permission_action`;
CREATE TABLE `system_permission_action` (
`id` bigint(20) NOT NULL COMMENT 'id',
`action_tag` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '动作id 文本型',
`permission_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '权限id 文本型',
`status` tinyint(4) NULL DEFAULT NULL COMMENT '状态',
`uid` bigint(20) NULL DEFAULT NULL COMMENT '用户id Long',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of system_permission_action
-- ----------------------------
INSERT INTO `system_permission_action` VALUES (1, 'add', 'role', 1, 1);
INSERT INTO `system_permission_action` VALUES (2, 'import', 'role', 1, 1);
INSERT INTO `system_permission_action` VALUES (3, 'get', 'role', 1, 1);
INSERT INTO `system_permission_action` VALUES (4, 'update', 'role', 1, 1);
INSERT INTO `system_permission_action` VALUES (5, 'delete', 'role', 1, 1);
INSERT INTO `system_permission_action` VALUES (6, 'export', 'role', 1, 1);
INSERT INTO `system_permission_action` VALUES (7, 'add', 'permission', 1, 1);
INSERT INTO `system_permission_action` VALUES (8, 'import', 'permission', 1, 1);
INSERT INTO `system_permission_action` VALUES (9, 'get', 'permission', 1, 1);
INSERT INTO `system_permission_action` VALUES (10, 'update', 'permission', 1, 1);
INSERT INTO `system_permission_action` VALUES (11, 'delete', 'permission', 1, 1);
INSERT INTO `system_permission_action` VALUES (12, 'export', 'permission', 1, 1);
-- ----------------------------
-- Table structure for system_role
-- ----------------------------
DROP TABLE IF EXISTS `system_role`;
CREATE TABLE `system_role` (
`id` bigint(20) NOT NULL COMMENT '角色id role_id',
`role_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '角色名称',
`role_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '角色id文本型',
`status` tinyint(4) NULL DEFAULT NULL,
`description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述',
`level` int(11) NULL DEFAULT NULL COMMENT '数字越小 级别越高 顶级权限为1',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '角色表' ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of system_role
-- ----------------------------
INSERT INTO `system_role` VALUES (1, '超级管理员', 'root', 1, '最高权限', 1);
INSERT INTO `system_role` VALUES (2, '管理员', 'admin', 1, '管理权限', 2);
INSERT INTO `system_role` VALUES (3, '机构', 'agent', 1, '使用权限', 3);
-- ----------------------------
-- Table structure for system_role_permission
-- ----------------------------
DROP TABLE IF EXISTS `system_role_permission`;
CREATE TABLE `system_role_permission` (
`id` bigint(20) NOT NULL,
`role_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '注意是文本型',
`permission_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '注意是文本型',
`status` tinyint(4) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of system_role_permission
-- ----------------------------
INSERT INTO `system_role_permission` VALUES (1, 'root', 'dashboard', 1);
INSERT INTO `system_role_permission` VALUES (2, 'root', 'exception', 1);
INSERT INTO `system_role_permission` VALUES (3, 'root', 'result', 1);
INSERT INTO `system_role_permission` VALUES (4, 'root', 'profile', 1);
INSERT INTO `system_role_permission` VALUES (5, 'root', 'table', 1);
INSERT INTO `system_role_permission` VALUES (6, 'root', 'form', 1);
INSERT INTO `system_role_permission` VALUES (7, 'root', 'order', 1);
INSERT INTO `system_role_permission` VALUES (8, 'root', 'permission', 1);
INSERT INTO `system_role_permission` VALUES (9, 'root', 'role', 1);
INSERT INTO `system_role_permission` VALUES (10, 'root', 'user', 1);
INSERT INTO `system_role_permission` VALUES (11, 'root', 'system', 1);
INSERT INTO `system_role_permission` VALUES (12, 'root', 'otherPage', 1);
INSERT INTO `system_role_permission` VALUES (13, 'root', 'UserList', 1);
INSERT INTO `system_role_permission` VALUES (14, 'root', 'RoleList', 1);
INSERT INTO `system_role_permission` VALUES (15, 'root', 'support', 1);
INSERT INTO `system_role_permission` VALUES (16, 'root', 'userManage', 1);
-- ----------------------------
-- Table structure for user_info
-- ----------------------------
DROP TABLE IF EXISTS `user_info`;
CREATE TABLE `user_info` (
`id` bigint(20) NOT NULL COMMENT '用户uid',
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '昵称(用于显示,可以随意更改)',
`username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户名(登录使用的账号)',
`password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '密码',
`avatar` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '头像图片地址',
`status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '状态',
`telephone` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '手机号',
`email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '邮箱',
`create_time` datetime NULL DEFAULT NULL COMMENT '注册时间',
`merchant_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商户编号',
`deleted` tinyint(4) NULL DEFAULT NULL COMMENT '1 已删除 0未删除',
`role_id` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '权限id 文本类型',
`creator_id` int(11) NULL DEFAULT NULL COMMENT '创建者id 0 或者空为自己注册',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `user_info_username_uindex`(`username`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of user_info
-- ----------------------------
INSERT INTO `user_info` VALUES (1, '萌狼蓝天', 'xrilang', 'NQiAppLu14vjKntRdYqpljy2ZOHJPbph3ZLWTiNW79GbiEdaiUhx9GDJ8YJAWZoe', 'https://q1.qlogo.cn/g?b=qq&nk=3447902411&s=640', '1', NULL, NULL, '2024-09-21 22:31:02', '1', 0, 'root', NULL);
INSERT INTO `user_info` VALUES (599761118822469, '明月新星', 'moon', 'NQiAppLu14vjKntRdYqpljy2ZOHJPbph3ZLWTiNW79GbiEdaiUhx9GDJ8YJAWZoe', NULL, '1', NULL, NULL, '2024-10-10 20:14:16', '1', 0, 'admin', 1);
SET FOREIGN_KEY_CHECKS = 1;

View File

@ -0,0 +1,72 @@
package com.guaiguailang.harmony.config;
import cn.dev33.satoken.interceptor.SaInterceptor;
import cn.dev33.satoken.stp.StpUtil;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import java.io.BufferedReader;
import java.io.IOException;
import java.util.stream.Collectors;
@Component
@Slf4j
public class LoggingInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
// 记录请求路径
log.info("Request URL: {}", request.getRequestURL());
// 记录请求方法
log.info("HTTP Method: {}", request.getMethod());
// 记录请求参数
if (handler instanceof HandlerMethod) {
HandlerMethod handlerMethod = (HandlerMethod) handler;
String params = request.getParameterMap().entrySet().stream()
.map(entry -> entry.getKey() + "=" + String.join(",", entry.getValue()))
.collect(Collectors.joining("&"));
log.info("Request Parameters: {}", params);
}
// 记录请求头
request.getHeaderNames().asIterator().forEachRemaining(name -> {
String value = request.getHeader(name);
log.info("Header {}: {}", name, value);
});
// 记录请求体如果是POST请求
if ("POST".equalsIgnoreCase(request.getMethod())) {
try {
StringBuilder requestBody = new StringBuilder();
BufferedReader reader = request.getReader();
String line;
while ((line = reader.readLine()) != null) {
requestBody.append(line);
}
log.info("Request Body: {}", requestBody.toString());
} catch (IOException e) {
log.error("Error reading request body", e);
}
}
// 继续处理请求
return true;
}
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
// 可以在这里记录响应数据
}
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
// 可以在这里记录异常信息
}
}

View File

@ -2,6 +2,7 @@ package com.guaiguailang.harmony.config;
import cn.dev33.satoken.interceptor.SaInterceptor;
import cn.dev33.satoken.stp.StpUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@ -9,6 +10,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* sa-token 注解鉴权拦截 注册
*/
@Slf4j
@Configuration
public class SaTokenConfigure implements WebMvcConfigurer {
// 注册 Sa-Token 拦截器打开注解式鉴权功能

View File

@ -0,0 +1,23 @@
package com.guaiguailang.harmony.domain.entity;
import lombok.Data;
@Data
public class MenuDataItem {
private String id;
private String title;
private String icon;
private String path;
private String component;
private String redirect;
private long affix;
private String parentId;
private String name;
private long hideInMenu;
private String url;
private long hideInBreadcrumb;
private long hideChildrenInMenu;
private long keepAlive;
private String target;
private String locale;
}

View File

@ -0,0 +1,62 @@
package com.guaiguailang.harmony.domain.vo;
import lombok.Data;
import java.util.List;
@Data
public class MenuDataItemVO {
// 唯一id
private String id;
// 标题
private String title;
// 图标
private String icon;
// 地址
private String path;
// 绑定的哪个组件默认自带的组件类型分别是IframeRouteView和ComponentError
private String component;
// 子集菜单
private List<MenuDataItemVO> children;
// 重定向地址
private String redirect;
// 哪些是固定页签
private Boolean affix;
// 父级菜单的id
private String parentId;
// 同路由中的name主要是用于保活的作用
private String name;
// 是否隐藏当前菜单
private Boolean hideInMenu;
// 如果使用了隐藏那么点击当前菜单的时候可以使用父级的key
private List<String> parentKeys;
// 如果当前是iframe的模式需要有一个跳转的url支撑其不能和path重复path还是为路由
private String url;
// 是否存在面包屑
private Boolean hideInBreadcrumb;
// 是否需要显示所有的子菜单
private Boolean hideChildrenInMenu;
// 是否保活
private Boolean keepAlive;
// 这里包含所有的父级元素
private List<MenuDataItemVO> matched;
// 全连接跳转模式
private String target;
}

View File

@ -6,6 +6,7 @@ import java.util.List;
@Data
public class MenuVO {
//暂时作废
private Long id;
private String title;
private String key;

View File

@ -4,6 +4,7 @@ import lombok.Data;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
/**
* 用户登陆成功后返回的信息对象
@ -32,6 +33,7 @@ public class UserInfoLogin{
private String merchantCode;//商户编号
private String roleId;
private RoleInfo role;//角色 如果是一个人有多个角色此处应当是列表但是本系统设定一人一个角色就算多角色登录的时候就要选择角色登录
private List<String> roles;
// token 相关
private String token;
private LocalDateTime expireTime;

View File

@ -1,11 +1,15 @@
package com.guaiguailang.harmony.mapper;
import com.guaiguailang.harmony.domain.entity.MenuDataItem;
import com.guaiguailang.harmony.domain.entity.SystemMenu;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;
@Mapper
public interface SystemMapper {
List<SystemMenu> getAllMenus();
@Select("SELECT * from menu_data_item")
List<MenuDataItem> getMenus();
}

View File

@ -20,6 +20,9 @@ import org.springframework.transaction.annotation.Transactional;
import java.security.NoSuchAlgorithmException;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
@Slf4j
@Service
@Transactional
@ -64,8 +67,11 @@ public class AuthServiceImpl implements AuthService {
BeanUtils.copyProperties(userInfo, userInfoLogin);
userInfoLogin.setToken(token);
userInfoLogin.setExpireTime(expireTime);
userInfoLogin.setRoleId(userInfo.getRoleId());
return ResponseResult.success(userInfoLogin);
List<String> rs = new ArrayList<>();
rs.add(userInfo.getRoleId().toUpperCase());
// rs.add("admin".toUpperCase());
userInfoLogin.setRoles(rs);
return ResponseResult.info(1,"ok",userInfoLogin);
}
}

View File

@ -1,5 +1,6 @@
package com.guaiguailang.harmony.service.impl;
import com.guaiguailang.harmony.domain.entity.MenuDataItem;
import com.guaiguailang.harmony.domain.entity.SystemMenu;
import com.guaiguailang.harmony.domain.vo.MenuVO;
import com.guaiguailang.harmony.domain.vo.ResponseResult;
@ -22,45 +23,51 @@ public class SystemServiceImpl implements SystemService {
public SystemServiceImpl(SystemMapper systemMapper) {
this.systemMapper = systemMapper;
}
// // 备份旧的方法
// public ResponseResult getMenu() {
// // 获取所有激活的状态菜单
// List<SystemMenu> menus = systemMapper.getAllMenus();
// Map<String, MenuVO> menuMap = new HashMap<>();
// List<MenuVO> rootMenus = new ArrayList<>();
// // 第一步将SystemMenu转换为MenuVO并存储在map中
// for (SystemMenu menu : menus) {
// MenuVO menuVO = new MenuVO();
// menuVO.setId(menu.getId());
// menuVO.setTitle(menu.getTitle());
// menuVO.setKey(menu.getKey());
// menuVO.setName(menu.getName());
// menuVO.setComponent(menu.getComponent());
// menuVO.setRedirect(menu.getRedirect());
// menuVO.setIcon(menu.getIcon());
// menuVO.setStatus(menu.getStatus());
// menuVO.setOrder(menu.getOrder());
// menuVO.setParent(menu.getParent());
// menuMap.put(menu.getName(), menuVO);
// }
// // 第二步构建树形结构
// for (MenuVO menuVO : menuMap.values()) {
// String parentId = menuVO.getParent();
// if (parentId == null) {
// // 没有父菜单即为根菜单
// rootMenus.add(menuVO);
// } else {
// // 查找父菜单并添加到其子菜单列表中
// MenuVO parentMenuVO = menuMap.get(parentId);
// if (parentMenuVO != null) {
// if (parentMenuVO.getChildren() == null) {
// parentMenuVO.setChildren(new ArrayList<>());
// }
// parentMenuVO.getChildren().add(menuVO);
// }
// }
// }
// return ResponseResult.success(rootMenus);
// }
public ResponseResult getMenu() {
// 获取所有激活的状态菜单
List<SystemMenu> menus = systemMapper.getAllMenus();
Map<String, MenuVO> menuMap = new HashMap<>();
List<MenuVO> rootMenus = new ArrayList<>();
// 第一步将SystemMenu转换为MenuVO并存储在map中
for (SystemMenu menu : menus) {
MenuVO menuVO = new MenuVO();
menuVO.setId(menu.getId());
menuVO.setTitle(menu.getTitle());
menuVO.setKey(menu.getKey());
menuVO.setName(menu.getName());
menuVO.setComponent(menu.getComponent());
menuVO.setRedirect(menu.getRedirect());
menuVO.setIcon(menu.getIcon());
menuVO.setStatus(menu.getStatus());
menuVO.setOrder(menu.getOrder());
menuVO.setParent(menu.getParent());
menuMap.put(menu.getName(), menuVO);
}
// 第二步构建树形结构
for (MenuVO menuVO : menuMap.values()) {
String parentId = menuVO.getParent();
if (parentId == null) {
// 没有父菜单即为根菜单
rootMenus.add(menuVO);
} else {
// 查找父菜单并添加到其子菜单列表中
MenuVO parentMenuVO = menuMap.get(parentId);
if (parentMenuVO != null) {
if (parentMenuVO.getChildren() == null) {
parentMenuVO.setChildren(new ArrayList<>());
}
parentMenuVO.getChildren().add(menuVO);
}
}
}
return ResponseResult.success(rootMenus);
List<MenuDataItem> menus = systemMapper.getMenus();
return ResponseResult.success(menus);
}
}

View File

@ -84,6 +84,10 @@ public class UserServiceImpl implements UserService {
}
roleInfo.setPermissions(permissionInfos);
userInfoLogin.setRole(roleInfo);
List<String> rs = new ArrayList<>();
rs.add(userInfo.getRoleId().toUpperCase());
// rs.add("admin".toUpperCase());
userInfoLogin.setRoles(rs);
log.info(userInfoLogin.toString());
return ResponseResult.success(userInfoLogin);
}

View File

@ -68,7 +68,7 @@ public class PasswordEncryptor {
// 主函数用于测试
public static void main(String[] args) {
String password = "e10adc3949ba59abbe56e057f20f883e";
String password = "123456";
try {
// 对密码进行哈希处理并附带盐一起存储

View File

@ -12,9 +12,10 @@ spring.main.banner-mode=log
spring.banner.charset=utf-8
spring.banner.location=classpath:banner.txt
# MySQL Setting
spring.datasource.url=jdbc:mysql://localhost:3306/harmonylife?serverTimezone=UTC&useSSL=false
spring.datasource.username=root
spring.datasource.password=123456
#spring.datasource.url=jdbc:mysql://localhost:3306/harmonylife?serverTimezone=UTC&useSSL=false
spring.datasource.url=jdbc:mysql://212.64.14.96:3306/harmonylife?serverTimezone=UTC&useSSL=false
spring.datasource.username=harmonylife
spring.datasource.password=QcaDdtsYYR38CRNy
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
# MyBatis Setting
mybatis.type-aliases-package=com.guaiguailang.harmony.domain

View File

@ -3,6 +3,10 @@ import com.guaiguailang.harmony.utils.UtilEmailSent;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import java.math.BigDecimal;
import java.util.Scanner;
@SpringBootTest
class HarmonyLifeServerApplicationTests {
@Autowired
@ -11,5 +15,36 @@ class HarmonyLifeServerApplicationTests {
void testEmailSentUtil() {
utilEmailSent.sendCode("2952458479@qq.com");
}
@Test
void test(){
// 创建 BigDecimal 对象
BigDecimal a = new BigDecimal("3");
BigDecimal b = new BigDecimal("0.1");
// 执行乘法运算
BigDecimal result = a.multiply(b);
// 输出结果
System.out.println("Result: " + result);
// 比较结果是否等于 0.3
BigDecimal target = new BigDecimal("0.3");
boolean isEqual = result.compareTo(target) == 0;
System.out.println("Is the result equal to 0.3? " + isEqual);
}
@Test
void Test2(){
int a = 10;
Scanner input = new Scanner(System.in);
int num = input.nextInt(); //输入15
System.out.println(num + a); // 15+10
short s =1 +2;
char c =59;
// float f =1.0 +1;
}
}