2
0

feat: 用户平台模块独立数据库

This commit is contained in:
TsMask
2024-11-27 15:25:59 +08:00
parent 69e2b4505c
commit a075adea36
81 changed files with 10017 additions and 563 deletions

View File

@@ -276,6 +276,13 @@
<version>${wfc.version}</version>
</dependency>
<!-- 用户平台接口 -->
<dependency>
<groupId>org.wfc</groupId>
<artifactId>wfc-api-user</artifactId>
<version>${wfc.version}</version>
</dependency>
<!-- 邮箱模块 -->
<dependency>
<groupId>org.wfc</groupId>
@@ -289,7 +296,6 @@
<artifactId>javax.mail</artifactId>
<version>${mail.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

View File

@@ -0,0 +1,504 @@
/*
Navicat Premium Data Transfer
Source Server Type : MySQL
Source Server Version : 80039 (8.0.39)
Source Schema : wfc-user-platform
Date: 27/11/2024 10:17:56
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for u_config
-- ----------------------------
DROP TABLE IF EXISTS `u_config`;
CREATE TABLE `u_config` (
`config_id` int NOT NULL AUTO_INCREMENT COMMENT '参数主键',
`config_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '参数名称',
`config_key` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '参数键名',
`config_value` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '参数键值',
`config_type` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'N' COMMENT '系统内置Y是 N否',
`create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者',
`update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
`remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
PRIMARY KEY (`config_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 100 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户平台_参数配置表' ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of u_config
-- ----------------------------
INSERT INTO `u_config` VALUES (1, '主框架页-默认皮肤样式名称', 'sys.index.skinName', 'skin-blue', 'Y', 'admin', '2024-05-08 21:50:55', '', NULL, '蓝色 skin-blue、绿色 skin-green、紫色 skin-purple、红色 skin-red、黄色 skin-yellow');
INSERT INTO `u_config` VALUES (2, '用户管理-账号初始密码', 'sys.user.initPassword', '123456', 'Y', 'admin', '2024-05-08 21:50:55', '', NULL, '初始化密码 123456');
INSERT INTO `u_config` VALUES (3, '主框架页-侧边栏主题', 'sys.index.sideTheme', 'theme-dark', 'Y', 'admin', '2024-05-08 21:50:55', '', NULL, '深色主题theme-dark浅色主题theme-light');
INSERT INTO `u_config` VALUES (4, '账号自助-是否开启用户注册功能', 'sys.account.registerUser', 'false', 'Y', 'admin', '2024-05-08 21:50:55', '', NULL, '是否开启注册用户功能true开启false关闭');
INSERT INTO `u_config` VALUES (5, '用户登录-黑名单列表', 'sys.login.blackIPList', '', 'Y', 'admin', '2024-05-08 21:50:55', '', NULL, '设置登录IP黑名单限制多个匹配项以;分隔,支持匹配(*通配、网段)');
-- ----------------------------
-- Table structure for u_dept
-- ----------------------------
DROP TABLE IF EXISTS `u_dept`;
CREATE TABLE `u_dept` (
`dept_id` bigint NOT NULL AUTO_INCREMENT COMMENT '部门id',
`parent_id` bigint NULL DEFAULT 0 COMMENT '父部门id',
`ancestors` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '祖级列表',
`dept_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '部门名称',
`order_num` int NULL DEFAULT 0 COMMENT '显示顺序',
`leader` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '负责人',
`phone` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '联系电话',
`email` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '邮箱',
`status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '部门状态0正常 1停用',
`del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '删除标志0代表存在 2代表删除',
`create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者',
`update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
`remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
PRIMARY KEY (`dept_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 202 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户平台_部门表' ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of u_dept
-- ----------------------------
INSERT INTO `u_dept` VALUES (100, 0, '0', '若依科技', 0, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', '2024-05-08 21:50:54', '', NULL, NULL);
INSERT INTO `u_dept` VALUES (101, 100, '0,100', '深圳总公司', 1, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', '2024-05-08 21:50:54', '', NULL, NULL);
INSERT INTO `u_dept` VALUES (102, 100, '0,100', '长沙分公司', 2, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', '2024-05-08 21:50:54', '', NULL, NULL);
INSERT INTO `u_dept` VALUES (103, 101, '0,100,101', '研发部门', 1, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', '2024-05-08 21:50:54', '', NULL, NULL);
INSERT INTO `u_dept` VALUES (104, 101, '0,100,101', '市场部门', 2, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', '2024-05-08 21:50:54', '', NULL, NULL);
INSERT INTO `u_dept` VALUES (105, 101, '0,100,101', '测试部门', 3, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', '2024-05-08 21:50:54', '', NULL, NULL);
INSERT INTO `u_dept` VALUES (106, 101, '0,100,101', '财务部门', 4, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', '2024-05-08 21:50:54', '', NULL, NULL);
INSERT INTO `u_dept` VALUES (107, 101, '0,100,101', '运维部门', 5, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', '2024-05-08 21:50:54', '', NULL, NULL);
INSERT INTO `u_dept` VALUES (108, 102, '0,100,102', '市场部门', 1, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', '2024-05-08 21:50:54', '', NULL, NULL);
INSERT INTO `u_dept` VALUES (109, 102, '0,100,102', '财务部门', 2, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', '2024-05-08 21:50:54', '', NULL, NULL);
INSERT INTO `u_dept` VALUES (200, 100, '0,100', '嵌入式部门', 1, '小美', '19939926438', '19939926438@163.com', '1', '0', 'ryadmin', '2024-06-02 16:16:37', 'admin', '2024-06-02 17:24:11', 'ttt');
INSERT INTO `u_dept` VALUES (201, 100, '0,100', '后端部门', 3, '小黑', '19939926438', NULL, '0', '2', 'admin', '2024-06-02 16:52:12', '', NULL, '测试111');
-- ----------------------------
-- Table structure for u_dict_data
-- ----------------------------
DROP TABLE IF EXISTS `u_dict_data`;
CREATE TABLE `u_dict_data` (
`dict_code` bigint NOT NULL AUTO_INCREMENT COMMENT '字典编码',
`dict_sort` int NULL DEFAULT 0 COMMENT '字典排序',
`dict_label` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '字典标签',
`dict_value` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '字典键值',
`dict_type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '字典类型',
`css_class` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '样式属性(其他样式扩展)',
`list_class` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '表格回显样式',
`is_default` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'N' COMMENT '是否默认Y是 N否',
`status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '状态0正常 1停用',
`create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者',
`update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
`remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
PRIMARY KEY (`dict_code`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 100 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户平台_字典数据表' ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of u_dict_data
-- ----------------------------
INSERT INTO `u_dict_data` VALUES (1, 1, '', '0', 'u_user_sex', '', '', 'Y', '0', 'admin', '2024-05-08 21:50:55', '', NULL, '性别男');
INSERT INTO `u_dict_data` VALUES (2, 2, '', '1', 'u_user_sex', '', '', 'N', '0', 'admin', '2024-05-08 21:50:55', '', NULL, '性别女');
INSERT INTO `u_dict_data` VALUES (3, 3, '未知', '2', 'u_user_sex', '', '', 'N', '0', 'admin', '2024-05-08 21:50:55', '', NULL, '性别未知');
INSERT INTO `u_dict_data` VALUES (4, 1, '显示', '0', 'u_show_hide', '', 'primary', 'Y', '0', 'admin', '2024-05-08 21:50:55', '', NULL, '显示菜单');
INSERT INTO `u_dict_data` VALUES (5, 2, '隐藏', '1', 'u_show_hide', '', 'danger', 'N', '0', 'admin', '2024-05-08 21:50:55', '', NULL, '隐藏菜单');
INSERT INTO `u_dict_data` VALUES (6, 1, '正常', '0', 'u_normal_disable', '', 'primary', 'Y', '0', 'admin', '2024-05-08 21:50:55', '', NULL, '正常状态');
INSERT INTO `u_dict_data` VALUES (7, 2, '停用', '1', 'u_normal_disable', '', 'danger', 'N', '0', 'admin', '2024-05-08 21:50:55', '', NULL, '停用状态');
INSERT INTO `u_dict_data` VALUES (8, 1, '正常', '0', 'u_job_status', '', 'primary', 'Y', '0', 'admin', '2024-05-08 21:50:55', '', NULL, '正常状态');
INSERT INTO `u_dict_data` VALUES (9, 2, '暂停', '1', 'u_job_status', '', 'danger', 'N', '0', 'admin', '2024-05-08 21:50:55', '', NULL, '停用状态');
INSERT INTO `u_dict_data` VALUES (10, 1, '默认', 'DEFAULT', 'u_job_group', '', '', 'Y', '0', 'admin', '2024-05-08 21:50:55', '', NULL, '默认分组');
INSERT INTO `u_dict_data` VALUES (11, 2, '系统', 'SYSTEM', 'u_job_group', '', '', 'N', '0', 'admin', '2024-05-08 21:50:55', '', NULL, '系统分组');
INSERT INTO `u_dict_data` VALUES (12, 1, '', 'Y', 'u_yes_no', '', 'primary', 'Y', '0', 'admin', '2024-05-08 21:50:55', '', NULL, '系统默认是');
INSERT INTO `u_dict_data` VALUES (13, 2, '', 'N', 'u_yes_no', '', 'danger', 'N', '0', 'admin', '2024-05-08 21:50:55', '', NULL, '系统默认否');
INSERT INTO `u_dict_data` VALUES (14, 1, '通知', '1', 'u_notice_type', '', 'warning', 'Y', '0', 'admin', '2024-05-08 21:50:55', '', NULL, '通知');
INSERT INTO `u_dict_data` VALUES (15, 2, '公告', '2', 'u_notice_type', '', 'success', 'N', '0', 'admin', '2024-05-08 21:50:55', '', NULL, '公告');
INSERT INTO `u_dict_data` VALUES (16, 1, '正常', '0', 'u_notice_status', '', 'primary', 'Y', '0', 'admin', '2024-05-08 21:50:55', '', NULL, '正常状态');
INSERT INTO `u_dict_data` VALUES (17, 2, '关闭', '1', 'u_notice_status', '', 'danger', 'N', '0', 'admin', '2024-05-08 21:50:55', '', NULL, '关闭状态');
INSERT INTO `u_dict_data` VALUES (18, 99, '其他', '0', 'u_oper_type', '', 'info', 'N', '0', 'admin', '2024-05-08 21:50:55', '', NULL, '其他操作');
INSERT INTO `u_dict_data` VALUES (19, 1, '新增', '1', 'u_oper_type', '', 'info', 'N', '0', 'admin', '2024-05-08 21:50:55', '', NULL, '新增操作');
INSERT INTO `u_dict_data` VALUES (20, 2, '修改', '2', 'u_oper_type', '', 'info', 'N', '0', 'admin', '2024-05-08 21:50:55', '', NULL, '修改操作');
INSERT INTO `u_dict_data` VALUES (21, 3, '删除', '3', 'u_oper_type', '', 'danger', 'N', '0', 'admin', '2024-05-08 21:50:55', '', NULL, '删除操作');
INSERT INTO `u_dict_data` VALUES (22, 4, '授权', '4', 'u_oper_type', '', 'primary', 'N', '0', 'admin', '2024-05-08 21:50:55', '', NULL, '授权操作');
INSERT INTO `u_dict_data` VALUES (23, 5, '导出', '5', 'u_oper_type', '', 'warning', 'N', '0', 'admin', '2024-05-08 21:50:55', '', NULL, '导出操作');
INSERT INTO `u_dict_data` VALUES (24, 6, '导入', '6', 'u_oper_type', '', 'warning', 'N', '0', 'admin', '2024-05-08 21:50:55', '', NULL, '导入操作');
INSERT INTO `u_dict_data` VALUES (25, 7, '强退', '7', 'u_oper_type', '', 'danger', 'N', '0', 'admin', '2024-05-08 21:50:55', '', NULL, '强退操作');
INSERT INTO `u_dict_data` VALUES (26, 8, '生成代码', '8', 'u_oper_type', '', 'warning', 'N', '0', 'admin', '2024-05-08 21:50:55', '', NULL, '生成操作');
INSERT INTO `u_dict_data` VALUES (27, 9, '清空数据', '9', 'u_oper_type', '', 'danger', 'N', '0', 'admin', '2024-05-08 21:50:55', '', NULL, '清空操作');
INSERT INTO `u_dict_data` VALUES (28, 1, '成功', '0', 'u_common_status', '', 'primary', 'N', '0', 'admin', '2024-05-08 21:50:55', '', NULL, '正常状态');
INSERT INTO `u_dict_data` VALUES (29, 2, '失败', '1', 'u_common_status', '', 'danger', 'N', '0', 'admin', '2024-05-08 21:50:55', '', NULL, '停用状态');
-- ----------------------------
-- Table structure for u_dict_type
-- ----------------------------
DROP TABLE IF EXISTS `u_dict_type`;
CREATE TABLE `u_dict_type` (
`dict_id` bigint NOT NULL AUTO_INCREMENT COMMENT '字典主键',
`dict_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '字典名称',
`dict_type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '字典类型',
`status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '状态0正常 1停用',
`create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者',
`update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
`remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
PRIMARY KEY (`dict_id`) USING BTREE,
UNIQUE INDEX `dict_type`(`dict_type` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 101 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户平台_字典类型表' ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of u_dict_type
-- ----------------------------
INSERT INTO `u_dict_type` VALUES (1, '用户性别', 'u_user_sex', '0', 'admin', '2024-05-08 21:50:55', '', NULL, '用户性别列表');
INSERT INTO `u_dict_type` VALUES (2, '菜单状态', 'u_show_hide', '0', 'admin', '2024-05-08 21:50:55', '', NULL, '菜单状态列表');
INSERT INTO `u_dict_type` VALUES (3, '系统开关', 'u_normal_disable', '0', 'admin', '2024-05-08 21:50:55', '', NULL, '系统开关列表');
INSERT INTO `u_dict_type` VALUES (4, '任务状态', 'u_job_status', '0', 'admin', '2024-05-08 21:50:55', '', NULL, '任务状态列表');
INSERT INTO `u_dict_type` VALUES (5, '任务分组', 'u_job_group', '0', 'admin', '2024-05-08 21:50:55', '', NULL, '任务分组列表');
INSERT INTO `u_dict_type` VALUES (6, '系统是否', 'u_yes_no', '0', 'admin', '2024-05-08 21:50:55', '', NULL, '系统是否列表');
INSERT INTO `u_dict_type` VALUES (7, '通知类型', 'u_notice_type', '0', 'admin', '2024-05-08 21:50:55', '', NULL, '通知类型列表');
INSERT INTO `u_dict_type` VALUES (8, '通知状态', 'u_notice_status', '0', 'admin', '2024-05-08 21:50:55', '', NULL, '通知状态列表');
INSERT INTO `u_dict_type` VALUES (9, '操作类型', 'u_oper_type', '0', 'admin', '2024-05-08 21:50:55', '', NULL, '操作类型列表');
INSERT INTO `u_dict_type` VALUES (10, '系统状态', 'u_common_status', '0', 'admin', '2024-05-08 21:50:55', '', NULL, '登录状态列表');
INSERT INTO `u_dict_type` VALUES (100, '测试字典', 'u_test_type', '0', 'admin', '2024-06-09 22:46:22', '', NULL, 'dsadasd');
-- ----------------------------
-- Table structure for u_logininfor
-- ----------------------------
DROP TABLE IF EXISTS `u_logininfor`;
CREATE TABLE `u_logininfor` (
`info_id` bigint NOT NULL AUTO_INCREMENT COMMENT '访问ID',
`user_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '用户账号',
`ipaddr` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '登录IP地址',
`status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '登录状态0成功 1失败',
`msg` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '提示信息',
`access_time` datetime NULL DEFAULT NULL COMMENT '访问时间',
PRIMARY KEY (`info_id`) USING BTREE,
INDEX `idx_u_logininfor_s`(`status` ASC) USING BTREE,
INDEX `idx_u_logininfor_lt`(`access_time` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 209 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户平台_系统访问记录' ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of u_logininfor
-- ----------------------------
INSERT INTO `u_logininfor` VALUES (100, 'admin', '127.0.0.1', '0', '登录成功', '2024-05-09 22:23:21');
INSERT INTO `u_logininfor` VALUES (101, 'admin', '127.0.0.1', '0', '登录成功', '2024-05-10 20:06:29');
-- ----------------------------
-- Table structure for u_menu
-- ----------------------------
DROP TABLE IF EXISTS `u_menu`;
CREATE TABLE `u_menu` (
`menu_id` bigint NOT NULL AUTO_INCREMENT COMMENT '菜单ID',
`menu_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '菜单名称',
`parent_id` bigint NULL DEFAULT 0 COMMENT '父菜单ID',
`order_num` int NULL DEFAULT 0 COMMENT '显示顺序',
`path` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '路由地址',
`component` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '组件路径',
`query` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '路由参数',
`is_frame` int NULL DEFAULT 1 COMMENT '是否为外链0是 1否',
`is_cache` int NULL DEFAULT 0 COMMENT '是否缓存0缓存 1不缓存',
`menu_type` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '菜单类型M目录 C菜单 F按钮',
`visible` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '菜单状态0显示 1隐藏',
`status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '菜单状态0正常 1停用',
`perms` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '权限标识',
`icon` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '#' COMMENT '菜单图标',
`create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者',
`update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
`remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '备注',
`name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '菜单key',
PRIMARY KEY (`menu_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2010 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户平台_菜单权限表' ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of u_menu
-- ----------------------------
INSERT INTO `u_menu` VALUES (1, '系统管理', 0, 1, '/manage', 'layout.base', '', 1, 0, 'M', '0', '0', '', 'carbon:cloud-service-management', 'admin', '2024-05-08 21:50:55', 'admin', '2024-05-12 23:46:57', '系统管理目录', 'manage');
INSERT INTO `u_menu` VALUES (100, '用户管理', 1, 1, '/manage/user', 'view.manage_user', '', 1, 0, 'C', '0', '0', 'system:user:list', 'ic:round-manage-accounts', 'admin', '2024-05-08 21:50:55', 'admin', '2024-05-12 23:50:31', '用户管理菜单', 'manage_user');
INSERT INTO `u_menu` VALUES (101, '角色管理', 1, 2, '/manage/role', 'view.manage_role', '', 1, 0, 'C', '0', '0', 'system:role:list', 'carbon:user-role', 'admin', '2024-05-08 21:50:55', '', NULL, '角色管理菜单', 'manage_role');
INSERT INTO `u_menu` VALUES (102, '菜单管理', 1, 3, '/manage/menu', 'view.manage_menu', '', 1, 0, 'C', '0', '0', 'system:menu:list', 'material-symbols:route', 'admin', '2024-05-08 21:50:55', 'admin', '2024-05-12 23:46:12', '菜单管理菜单', 'manage_menu');
INSERT INTO `u_menu` VALUES (103, '部门管理', 1, 4, '/manage/dept', 'view.manage_dept', '', 1, 0, 'C', '0', '0', 'system:dept:list', 'carbon:box', 'admin', '2024-05-08 21:50:55', 'ryadmin', '2024-05-30 23:17:41', '部门管理菜单', 'manage_dept');
INSERT INTO `u_menu` VALUES (104, '岗位管理', 1, 5, '/manage/post', 'view.manage_post', NULL, 1, 0, 'C', '0', '0', 'system:post:list', 'carbon:group', 'admin', '2024-06-02 22:18:48', '', NULL, '', 'manage_post');
INSERT INTO `u_menu` VALUES (105, '字典管理', 1, 6, '/manage/dict', 'view.manage_dict', NULL, 1, 0, 'C', '0', '0', 'system:dict:list', 'carbon:volume-block-storage', 'admin', '2024-06-02 23:13:40', '', NULL, '', 'manage_dict');
INSERT INTO `u_menu` VALUES (1000, '用户查询', 100, 1, '', '', '', 1, 0, 'F', '0', '0', 'system:user:query', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1001, '用户新增', 100, 2, '', '', '', 1, 0, 'F', '0', '0', 'system:user:add', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1002, '用户修改', 100, 3, '', '', '', 1, 0, 'F', '0', '0', 'system:user:edit', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1003, '用户删除', 100, 4, '', '', '', 1, 0, 'F', '0', '0', 'system:user:remove', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1004, '用户导出', 100, 5, '', '', '', 1, 0, 'F', '0', '0', 'system:user:export', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1005, '用户导入', 100, 6, '', '', '', 1, 0, 'F', '0', '0', 'system:user:import', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1006, '重置密码', 100, 7, '', '', '', 1, 0, 'F', '0', '0', 'system:user:resetPwd', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1007, '角色查询', 101, 1, '', '', '', 1, 0, 'F', '0', '0', 'system:role:query', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1008, '角色新增', 101, 2, '', '', '', 1, 0, 'F', '0', '0', 'system:role:add', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1009, '角色修改', 101, 3, '', '', '', 1, 0, 'F', '0', '0', 'system:role:edit', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1010, '角色删除', 101, 4, '', '', '', 1, 0, 'F', '0', '0', 'system:role:remove', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1011, '角色导出', 101, 5, '', '', '', 1, 0, 'F', '0', '0', 'system:role:export', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1012, '菜单查询', 102, 1, '', '', '', 1, 0, 'F', '0', '0', 'system:menu:query', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1013, '菜单新增', 102, 2, '', '', '', 1, 0, 'F', '0', '0', 'system:menu:add', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1014, '菜单修改', 102, 3, '', '', '', 1, 0, 'F', '0', '0', 'system:menu:edit', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1015, '菜单删除', 102, 4, '', '', '', 1, 0, 'F', '0', '0', 'system:menu:remove', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1016, '部门查询', 103, 1, '', '', '', 1, 0, 'F', '0', '0', 'system:dept:query', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1017, '部门新增', 103, 2, '', '', '', 1, 0, 'F', '0', '0', 'system:dept:add', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1018, '部门修改', 103, 3, '', '', '', 1, 0, 'F', '0', '0', 'system:dept:edit', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1019, '部门删除', 103, 4, '', '', '', 1, 0, 'F', '0', '0', 'system:dept:remove', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1020, '岗位查询', 104, 1, '', '', '', 1, 0, 'F', '0', '0', 'system:post:query', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1021, '岗位新增', 104, 2, '', '', '', 1, 0, 'F', '0', '0', 'system:post:add', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1022, '岗位修改', 104, 3, '', '', '', 1, 0, 'F', '0', '0', 'system:post:edit', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1023, '岗位删除', 104, 4, '', '', '', 1, 0, 'F', '0', '0', 'system:post:remove', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1024, '岗位导出', 104, 5, '', '', '', 1, 0, 'F', '0', '0', 'system:post:export', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1025, '字典查询', 105, 1, '#', '', '', 1, 0, 'F', '0', '0', 'system:dict:query', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1026, '字典新增', 105, 2, '#', '', '', 1, 0, 'F', '0', '0', 'system:dict:add', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1027, '字典修改', 105, 3, '#', '', '', 1, 0, 'F', '0', '0', 'system:dict:edit', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1028, '字典删除', 105, 4, '#', '', '', 1, 0, 'F', '0', '0', 'system:dict:remove', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1029, '字典导出', 105, 5, '#', '', '', 1, 0, 'F', '0', '0', 'system:dict:export', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1030, '参数查询', 106, 1, '#', '', '', 1, 0, 'F', '0', '0', 'system:config:query', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1031, '参数新增', 106, 2, '#', '', '', 1, 0, 'F', '0', '0', 'system:config:add', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1032, '参数修改', 106, 3, '#', '', '', 1, 0, 'F', '0', '0', 'system:config:edit', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1033, '参数删除', 106, 4, '#', '', '', 1, 0, 'F', '0', '0', 'system:config:remove', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1034, '参数导出', 106, 5, '#', '', '', 1, 0, 'F', '0', '0', 'system:config:export', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1035, '公告查询', 107, 1, '#', '', '', 1, 0, 'F', '0', '0', 'system:notice:query', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1036, '公告新增', 107, 2, '#', '', '', 1, 0, 'F', '0', '0', 'system:notice:add', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1037, '公告修改', 107, 3, '#', '', '', 1, 0, 'F', '0', '0', 'system:notice:edit', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1038, '公告删除', 107, 4, '#', '', '', 1, 0, 'F', '0', '0', 'system:notice:remove', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1039, '操作查询', 500, 1, '#', '', '', 1, 0, 'F', '0', '0', 'system:operlog:query', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1040, '操作删除', 500, 2, '#', '', '', 1, 0, 'F', '0', '0', 'system:operlog:remove', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1041, '日志导出', 500, 3, '#', '', '', 1, 0, 'F', '0', '0', 'system:operlog:export', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1042, '登录查询', 501, 1, '#', '', '', 1, 0, 'F', '0', '0', 'system:logininfor:query', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1043, '登录删除', 501, 2, '#', '', '', 1, 0, 'F', '0', '0', 'system:logininfor:remove', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1044, '日志导出', 501, 3, '#', '', '', 1, 0, 'F', '0', '0', 'system:logininfor:export', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1045, '账户解锁', 501, 4, '#', '', '', 1, 0, 'F', '0', '0', 'system:logininfor:unlock', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1046, '在线查询', 109, 1, '#', '', '', 1, 0, 'F', '0', '0', 'monitor:online:query', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1047, '批量强退', 109, 2, '#', '', '', 1, 0, 'F', '0', '0', 'monitor:online:batchLogout', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1048, '单条强退', 109, 3, '#', '', '', 1, 0, 'F', '0', '0', 'monitor:online:forceLogout', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1049, '任务查询', 110, 1, '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:query', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1050, '任务新增', 110, 2, '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:add', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1051, '任务修改', 110, 3, '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:edit', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1052, '任务删除', 110, 4, '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:remove', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1053, '状态修改', 110, 5, '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:changeStatus', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1054, '任务导出', 110, 6, '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:export', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1055, '生成查询', 115, 1, '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:query', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1056, '生成修改', 115, 2, '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:edit', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1057, '生成删除', 115, 3, '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:remove', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1058, '导入代码', 115, 2, '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:import', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1059, '预览代码', 115, 4, '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:preview', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
INSERT INTO `u_menu` VALUES (1060, '生成代码', 115, 5, '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:code', '#', 'admin', '2024-05-08 21:50:55', '', NULL, '', NULL);
-- ----------------------------
-- Table structure for u_oper_log
-- ----------------------------
DROP TABLE IF EXISTS `u_oper_log`;
CREATE TABLE `u_oper_log` (
`oper_id` bigint NOT NULL AUTO_INCREMENT COMMENT '日志主键',
`title` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '模块标题',
`business_type` int NULL DEFAULT 0 COMMENT '业务类型0其它 1新增 2修改 3删除',
`method` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '方法名称',
`request_method` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '请求方式',
`operator_type` int NULL DEFAULT 0 COMMENT '操作类别0其它 1后台用户 2手机端用户',
`oper_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '操作人员',
`dept_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '部门名称',
`oper_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '请求URL',
`oper_ip` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '主机地址',
`oper_location` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '操作地点',
`oper_param` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '请求参数',
`json_result` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '返回参数',
`status` int NULL DEFAULT 0 COMMENT '操作状态0正常 1异常',
`error_msg` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '错误消息',
`oper_time` datetime NULL DEFAULT NULL COMMENT '操作时间',
`cost_time` bigint NULL DEFAULT 0 COMMENT '消耗时间',
PRIMARY KEY (`oper_id`) USING BTREE,
INDEX `idx_u_oper_log_bt`(`business_type` ASC) USING BTREE,
INDEX `idx_u_oper_log_s`(`status` ASC) USING BTREE,
INDEX `idx_u_oper_log_ot`(`oper_time` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户平台_操作日志记录' ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Table structure for u_post
-- ----------------------------
DROP TABLE IF EXISTS `u_post`;
CREATE TABLE `u_post` (
`post_id` bigint NOT NULL AUTO_INCREMENT COMMENT '岗位ID',
`post_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '岗位编码',
`post_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '岗位名称',
`post_sort` int NOT NULL COMMENT '显示顺序',
`status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '状态0正常 1停用',
`create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者',
`update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
`remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
PRIMARY KEY (`post_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户平台_岗位信息表' ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of u_post
-- ----------------------------
INSERT INTO `u_post` VALUES (1, 'ceo', '董事长', 1, '0', 'admin', '2024-05-08 21:50:54', '', NULL, '');
INSERT INTO `u_post` VALUES (2, 'se', '项目经理', 2, '0', 'admin', '2024-05-08 21:50:54', '', NULL, '');
INSERT INTO `u_post` VALUES (3, 'hr', '人力资源', 3, '0', 'admin', '2024-05-08 21:50:54', '', NULL, '');
INSERT INTO `u_post` VALUES (4, 'user', '普通员工', 4, '0', 'admin', '2024-05-08 21:50:54', 'ryadmin', '2024-06-10 11:45:33', '反反复复');
-- ----------------------------
-- Table structure for u_role
-- ----------------------------
DROP TABLE IF EXISTS `u_role`;
CREATE TABLE `u_role` (
`role_id` bigint NOT NULL AUTO_INCREMENT COMMENT '角色ID',
`role_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '角色名称',
`role_key` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '角色权限字符串',
`role_sort` int(4) not null comment '显示顺序',
`data_scope` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '1' COMMENT '数据范围1全部数据权限 2自定数据权限 3本部门数据权限 4本部门及以下数据权限',
`menu_check_strictly` tinyint(1) NULL DEFAULT 1 COMMENT '菜单树选择项是否关联显示',
`dept_check_strictly` tinyint(1) NULL DEFAULT 1 COMMENT '部门树选择项是否关联显示',
`status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '角色状态0正常 1停用',
`del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '删除标志0代表存在 2代表删除',
`create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者',
`update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
`remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
PRIMARY KEY (`role_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 106 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户平台_角色信息表' ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of u_role
-- ----------------------------
INSERT INTO `u_role` VALUES (1, '超级管理员', 'admin', '1', 1, 1, '0', '0', 'admin', '2024-05-08 21:50:54', '', NULL, '超级管理员');
INSERT INTO `u_role` VALUES (2, '普通刺客', 'common', '2', 1, 1, '0', '0', 'admin', '2024-05-08 21:50:54', 'admin', '2024-06-02 23:14:56', '普通角色');
-- ----------------------------
-- Table structure for u_role_dept
-- ----------------------------
DROP TABLE IF EXISTS `u_role_dept`;
CREATE TABLE `u_role_dept` (
`role_id` bigint NOT NULL COMMENT '角色ID',
`dept_id` bigint NOT NULL COMMENT '部门ID',
PRIMARY KEY (`role_id`, `dept_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户平台_角色和部门关联表' ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of u_role_dept
-- ----------------------------
INSERT INTO `u_role_dept` VALUES (2, 100);
INSERT INTO `u_role_dept` VALUES (2, 101);
INSERT INTO `u_role_dept` VALUES (2, 105);
-- ----------------------------
-- Table structure for u_role_menu
-- ----------------------------
DROP TABLE IF EXISTS `u_role_menu`;
CREATE TABLE `u_role_menu` (
`role_id` bigint NOT NULL COMMENT '角色ID',
`menu_id` bigint NOT NULL COMMENT '菜单ID',
PRIMARY KEY (`role_id`, `menu_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户平台_角色和菜单关联表' ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of u_role_menu
-- ----------------------------
INSERT INTO `u_role_menu` VALUES (2, 1);
INSERT INTO `u_role_menu` VALUES (2, 100);
INSERT INTO `u_role_menu` VALUES (2, 101);
INSERT INTO `u_role_menu` VALUES (2, 102);
INSERT INTO `u_role_menu` VALUES (2, 103);
INSERT INTO `u_role_menu` VALUES (2, 104);
INSERT INTO `u_role_menu` VALUES (2, 105);
INSERT INTO `u_role_menu` VALUES (2, 1000);
INSERT INTO `u_role_menu` VALUES (2, 1001);
INSERT INTO `u_role_menu` VALUES (2, 1002);
INSERT INTO `u_role_menu` VALUES (2, 1003);
INSERT INTO `u_role_menu` VALUES (2, 1004);
INSERT INTO `u_role_menu` VALUES (2, 1005);
INSERT INTO `u_role_menu` VALUES (2, 1006);
INSERT INTO `u_role_menu` VALUES (2, 1007);
INSERT INTO `u_role_menu` VALUES (2, 1008);
INSERT INTO `u_role_menu` VALUES (2, 1009);
INSERT INTO `u_role_menu` VALUES (2, 1010);
INSERT INTO `u_role_menu` VALUES (2, 1012);
INSERT INTO `u_role_menu` VALUES (2, 1013);
INSERT INTO `u_role_menu` VALUES (2, 1014);
INSERT INTO `u_role_menu` VALUES (2, 1015);
INSERT INTO `u_role_menu` VALUES (2, 1016);
INSERT INTO `u_role_menu` VALUES (2, 1017);
INSERT INTO `u_role_menu` VALUES (2, 1018);
INSERT INTO `u_role_menu` VALUES (2, 1019);
INSERT INTO `u_role_menu` VALUES (2, 1020);
INSERT INTO `u_role_menu` VALUES (2, 1021);
INSERT INTO `u_role_menu` VALUES (2, 1022);
INSERT INTO `u_role_menu` VALUES (2, 1023);
INSERT INTO `u_role_menu` VALUES (2, 1024);
INSERT INTO `u_role_menu` VALUES (2, 1025);
INSERT INTO `u_role_menu` VALUES (2, 1026);
INSERT INTO `u_role_menu` VALUES (2, 1027);
INSERT INTO `u_role_menu` VALUES (2, 1028);
INSERT INTO `u_role_menu` VALUES (2, 1029);
-- ----------------------------
-- Table structure for u_user
-- ----------------------------
DROP TABLE IF EXISTS `u_user`;
CREATE TABLE `u_user` (
`user_id` bigint NOT NULL AUTO_INCREMENT COMMENT '用户ID',
`dept_id` bigint NULL DEFAULT NULL COMMENT '部门ID',
`user_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户账号',
`nick_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户昵称',
`user_type` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '00' COMMENT '用户类型00系统用户',
`email` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '用户邮箱',
`phonenumber` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '手机号码',
`sex` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '用户性别0男 1女 2未知',
`avatar` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '头像地址',
`password` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '密码',
`status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '帐号状态0正常 1停用',
`del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '删除标志0代表存在 2代表删除',
`login_ip` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '最后登录IP',
`login_date` datetime NULL DEFAULT NULL COMMENT '最后登录时间',
`create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者',
`update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
`remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
PRIMARY KEY (`user_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 102 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户平台_用户信息表' ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of u_user
-- ----------------------------
INSERT INTO `u_user` VALUES (1, 103, 'admin', '若依', '00', 'ry@163.com', '15888888888', '1', '', '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '127.0.0.1', '2024-05-08 21:50:54', 'admin', '2024-05-08 21:50:54', '', NULL, '管理员');
INSERT INTO `u_user` VALUES (2, 105, 'ryadmin', '若依', '00', 'ry@qq.com', '15666666666', '1', '', '$2a$10$1o.S9fySem5/jcIfpUosNOb.WiDgWu2sAZQRR3JVyL/Yj.FWveMt2', '0', '2', '127.0.0.1', '2024-05-08 21:50:54', 'admin', '2024-05-08 21:50:54', 'admin', '2024-05-12 23:50:57', '测试员');
-- ----------------------------
-- Table structure for u_user_post
-- ----------------------------
DROP TABLE IF EXISTS `u_user_post`;
CREATE TABLE `u_user_post` (
`user_id` bigint NOT NULL COMMENT '用户ID',
`post_id` bigint NOT NULL COMMENT '岗位ID',
PRIMARY KEY (`user_id`, `post_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户平台_用户与岗位关联表' ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of u_user_post
-- ----------------------------
INSERT INTO `u_user_post` VALUES (1, 1);
INSERT INTO `u_user_post` VALUES (101, 2);
INSERT INTO `u_user_post` VALUES (101, 3);
-- ----------------------------
-- Table structure for u_user_role
-- ----------------------------
DROP TABLE IF EXISTS `u_user_role`;
CREATE TABLE `u_user_role` (
`user_id` bigint NOT NULL COMMENT '用户ID',
`role_id` bigint NOT NULL COMMENT '角色ID',
PRIMARY KEY (`user_id`, `role_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户平台_用户和角色关联表' ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of u_user_role
-- ----------------------------
INSERT INTO `u_user_role` VALUES (1, 1);
INSERT INTO `u_user_role` VALUES (101, 2);
INSERT INTO `u_user_role` VALUES (101, 105);
SET FOREIGN_KEY_CHECKS = 1;

View File

@@ -15,25 +15,25 @@
</description>
<dependencies>
<!-- SpringCloud Alibaba Nacos -->
<!-- SpringCloud Alibaba Nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<!-- SpringCloud Alibaba Nacos Config -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<!-- SpringCloud Alibaba Sentinel -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
<!-- SpringBoot Actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
@@ -45,19 +45,31 @@
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
</dependency>
<!-- Common Log -->
<!-- WFC Common DataSource -->
<dependency>
<groupId>org.wfc</groupId>
<artifactId>wfc-common-datasource</artifactId>
</dependency>
<!-- WFC Common Log -->
<dependency>
<groupId>org.wfc</groupId>
<artifactId>wfc-common-log</artifactId>
</dependency>
<!-- Common Swagger -->
<!-- WFC Common Swagger -->
<dependency>
<groupId>org.wfc</groupId>
<artifactId>wfc-common-swagger</artifactId>
</dependency>
<!-- WFC Api User -->
<dependency>
<groupId>org.wfc</groupId>
<artifactId>wfc-api-user</artifactId>
</dependency>
</dependencies>
<build>

View File

@@ -0,0 +1,127 @@
package org.wfc.user.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.wfc.common.core.utils.poi.ExcelUtil;
import org.wfc.common.core.web.controller.BaseController;
import org.wfc.common.core.web.domain.AjaxResult;
import org.wfc.common.core.web.page.TableDataInfo;
import org.wfc.common.log.annotation.Log;
import org.wfc.common.log.enums.BusinessType;
import org.wfc.common.security.annotation.RequiresPermissions;
import org.wfc.common.security.utils.SecurityUtils;
import org.wfc.user.domain.UConfig;
import org.wfc.user.service.IUConfigService;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 参数配置 信息操作处理
*
* @author wfc
*/
@RestController
@RequestMapping("/config")
public class UConfigController extends BaseController
{
@Autowired
private IUConfigService configService;
/**
* 获取参数配置列表
*/
@RequiresPermissions("Utem:config:list")
@GetMapping("/list")
public TableDataInfo list(UConfig config)
{
startPage();
List<UConfig> list = configService.selectConfigList(config);
return getDataTable(list);
}
@Log(title = "参数管理", businessType = BusinessType.EXPORT)
@RequiresPermissions("Utem:config:export")
@PostMapping("/export")
public void export(HttpServletResponse response, UConfig config)
{
List<UConfig> list = configService.selectConfigList(config);
ExcelUtil<UConfig> util = new ExcelUtil<UConfig>(UConfig.class);
util.exportExcel(response, list, "参数数据");
}
/**
* 根据参数编号获取详细信息
*/
@GetMapping(value = "/{configId}")
public AjaxResult getInfo(@PathVariable Long configId)
{
return success(configService.selectConfigById(configId));
}
/**
* 根据参数键名查询参数值
*/
@GetMapping(value = "/configKey/{configKey}")
public AjaxResult getConfigKey(@PathVariable String configKey)
{
return success(configService.selectConfigByKey(configKey));
}
/**
* 新增参数配置
*/
@RequiresPermissions("Utem:config:add")
@Log(title = "参数管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody UConfig config)
{
if (!configService.checkConfigKeyUnique(config))
{
return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
}
config.setCreateBy(SecurityUtils.getUsername());
return toAjax(configService.insertConfig(config));
}
/**
* 修改参数配置
*/
@RequiresPermissions("Utem:config:edit")
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody UConfig config)
{
if (!configService.checkConfigKeyUnique(config))
{
return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
}
config.setUpdateBy(SecurityUtils.getUsername());
return toAjax(configService.updateConfig(config));
}
/**
* 删除参数配置
*/
@RequiresPermissions("Utem:config:remove")
@Log(title = "参数管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{configIds}")
public AjaxResult remove(@PathVariable Long[] configIds)
{
configService.deleteConfigByIds(configIds);
return success();
}
/**
* 刷新参数缓存
*/
@RequiresPermissions("Utem:config:remove")
@Log(title = "参数管理", businessType = BusinessType.CLEAN)
@DeleteMapping("/refreshCache")
public AjaxResult refreshCache()
{
configService.resetConfigCache();
return success();
}
}

View File

@@ -0,0 +1,128 @@
package org.wfc.user.controller;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.wfc.common.core.constant.UserConstants;
import org.wfc.common.core.utils.StringUtils;
import org.wfc.common.core.web.controller.BaseController;
import org.wfc.common.core.web.domain.AjaxResult;
import org.wfc.common.core.web.page.TableDataInfo;
import org.wfc.common.log.annotation.Log;
import org.wfc.common.log.enums.BusinessType;
import org.wfc.common.security.annotation.RequiresPermissions;
import org.wfc.common.security.utils.SecurityUtils;
import org.wfc.user.api.domain.UDept;
import org.wfc.user.service.IUDeptService;
import java.util.List;
/**
* 部门信息
*
* @author wfc
*/
@RestController
@RequestMapping("/dept")
public class UDeptController extends BaseController
{
@Autowired
private IUDeptService deptService;
/**
* 获取部门列表
*/
@RequiresPermissions("Utem:dept:list")
@GetMapping("/list")
public TableDataInfo list(UDept dept)
{
List<UDept> depts = deptService.selectDeptList(dept);
return getDataTable(depts);
}
/**
* 查询部门列表(排除节点)
*/
@RequiresPermissions("Utem:dept:list")
@GetMapping("/list/exclude/{deptId}")
public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId)
{
List<UDept> depts = deptService.selectDeptList(new UDept());
depts.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""));
return success(depts);
}
/**
* 根据部门编号获取详细信息
*/
@RequiresPermissions("Utem:dept:query")
@GetMapping(value = "/{deptId}")
public AjaxResult getInfo(@PathVariable Long deptId)
{
deptService.checkDeptDataScope(deptId);
return success(deptService.selectDeptById(deptId));
}
/**
* 新增部门
*/
@RequiresPermissions("Utem:dept:add")
@Log(title = "部门管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody UDept dept)
{
if (!deptService.checkDeptNameUnique(dept))
{
return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
}
dept.setCreateBy(SecurityUtils.getUsername());
return toAjax(deptService.insertDept(dept));
}
/**
* 修改部门
*/
@RequiresPermissions("Utem:dept:edit")
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody UDept dept)
{
Long deptId = dept.getDeptId();
deptService.checkDeptDataScope(deptId);
if (!deptService.checkDeptNameUnique(dept))
{
return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
}
else if (dept.getParentId().equals(deptId))
{
return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
}
else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0)
{
return error("该部门包含未停用的子部门!");
}
dept.setUpdateBy(SecurityUtils.getUsername());
return toAjax(deptService.updateDept(dept));
}
/**
* 删除部门
*/
@RequiresPermissions("Utem:dept:remove")
@Log(title = "部门管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{deptId}")
public AjaxResult remove(@PathVariable Long deptId)
{
if (deptService.hasChildByDeptId(deptId))
{
return warn("存在下级部门,不允许删除");
}
if (deptService.checkDeptExistUser(deptId))
{
return warn("部门存在用户,不允许删除");
}
deptService.checkDeptDataScope(deptId);
return toAjax(deptService.deleteDeptById(deptId));
}
}

View File

@@ -0,0 +1,116 @@
package org.wfc.user.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.wfc.common.core.utils.StringUtils;
import org.wfc.common.core.utils.poi.ExcelUtil;
import org.wfc.common.core.web.controller.BaseController;
import org.wfc.common.core.web.domain.AjaxResult;
import org.wfc.common.core.web.page.TableDataInfo;
import org.wfc.common.log.annotation.Log;
import org.wfc.common.log.enums.BusinessType;
import org.wfc.common.security.annotation.RequiresPermissions;
import org.wfc.common.security.utils.SecurityUtils;
import org.wfc.user.api.domain.UDictData;
import org.wfc.user.service.IUDictDataService;
import org.wfc.user.service.IUDictTypeService;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
/**
* 数据字典信息
*
* @author wfc
*/
@RestController
@RequestMapping("/dict/data")
public class UDictDataController extends BaseController
{
@Autowired
private IUDictDataService dictDataService;
@Autowired
private IUDictTypeService dictTypeService;
@RequiresPermissions("Utem:dict:list")
@GetMapping("/list")
public TableDataInfo list(UDictData dictData)
{
startPage();
List<UDictData> list = dictDataService.selectDictDataList(dictData);
return getDataTable(list);
}
@Log(title = "字典数据", businessType = BusinessType.EXPORT)
@RequiresPermissions("Utem:dict:export")
@PostMapping("/export")
public void export(HttpServletResponse response, UDictData dictData)
{
List<UDictData> list = dictDataService.selectDictDataList(dictData);
ExcelUtil<UDictData> util = new ExcelUtil<UDictData>(UDictData.class);
util.exportExcel(response, list, "字典数据");
}
/**
* 查询字典数据详细
*/
@RequiresPermissions("Utem:dict:query")
@GetMapping(value = "/{dictCode}")
public AjaxResult getInfo(@PathVariable Long dictCode)
{
return success(dictDataService.selectDictDataById(dictCode));
}
/**
* 根据字典类型查询字典数据信息
*/
@GetMapping(value = "/type/{dictType}")
public AjaxResult dictType(@PathVariable String dictType)
{
List<UDictData> data = dictTypeService.selectDictDataByType(dictType);
if (StringUtils.isNull(data))
{
data = new ArrayList<UDictData>();
}
return success(data);
}
/**
* 新增字典类型
*/
@RequiresPermissions("Utem:dict:add")
@Log(title = "字典数据", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody UDictData dict)
{
dict.setCreateBy(SecurityUtils.getUsername());
return toAjax(dictDataService.insertDictData(dict));
}
/**
* 修改保存字典类型
*/
@RequiresPermissions("Utem:dict:edit")
@Log(title = "字典数据", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody UDictData dict)
{
dict.setUpdateBy(SecurityUtils.getUsername());
return toAjax(dictDataService.updateDictData(dict));
}
/**
* 删除字典类型
*/
@RequiresPermissions("Utem:dict:remove")
@Log(title = "字典类型", businessType = BusinessType.DELETE)
@DeleteMapping("/{dictCodes}")
public AjaxResult remove(@PathVariable Long[] dictCodes)
{
dictDataService.deleteDictDataByIds(dictCodes);
return success();
}
}

View File

@@ -0,0 +1,126 @@
package org.wfc.user.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.wfc.common.core.utils.poi.ExcelUtil;
import org.wfc.common.core.web.controller.BaseController;
import org.wfc.common.core.web.domain.AjaxResult;
import org.wfc.common.core.web.page.TableDataInfo;
import org.wfc.common.log.annotation.Log;
import org.wfc.common.log.enums.BusinessType;
import org.wfc.common.security.annotation.RequiresPermissions;
import org.wfc.common.security.utils.SecurityUtils;
import org.wfc.user.api.domain.UDictType;
import org.wfc.user.service.IUDictTypeService;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 数据字典信息
*
* @author wfc
*/
@RestController
@RequestMapping("/dict/type")
public class UDictTypeController extends BaseController
{
@Autowired
private IUDictTypeService dictTypeService;
@RequiresPermissions("Utem:dict:list")
@GetMapping("/list")
public TableDataInfo list(UDictType dictType)
{
startPage();
List<UDictType> list = dictTypeService.selectDictTypeList(dictType);
return getDataTable(list);
}
@Log(title = "字典类型", businessType = BusinessType.EXPORT)
@RequiresPermissions("Utem:dict:export")
@PostMapping("/export")
public void export(HttpServletResponse response, UDictType dictType)
{
List<UDictType> list = dictTypeService.selectDictTypeList(dictType);
ExcelUtil<UDictType> util = new ExcelUtil<UDictType>(UDictType.class);
util.exportExcel(response, list, "字典类型");
}
/**
* 查询字典类型详细
*/
@RequiresPermissions("Utem:dict:query")
@GetMapping(value = "/{dictId}")
public AjaxResult getInfo(@PathVariable Long dictId)
{
return success(dictTypeService.selectDictTypeById(dictId));
}
/**
* 新增字典类型
*/
@RequiresPermissions("Utem:dict:add")
@Log(title = "字典类型", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody UDictType dict)
{
if (!dictTypeService.checkDictTypeUnique(dict))
{
return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
}
dict.setCreateBy(SecurityUtils.getUsername());
return toAjax(dictTypeService.insertDictType(dict));
}
/**
* 修改字典类型
*/
@RequiresPermissions("Utem:dict:edit")
@Log(title = "字典类型", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody UDictType dict)
{
if (!dictTypeService.checkDictTypeUnique(dict))
{
return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
}
dict.setUpdateBy(SecurityUtils.getUsername());
return toAjax(dictTypeService.updateDictType(dict));
}
/**
* 删除字典类型
*/
@RequiresPermissions("Utem:dict:remove")
@Log(title = "字典类型", businessType = BusinessType.DELETE)
@DeleteMapping("/{dictIds}")
public AjaxResult remove(@PathVariable Long[] dictIds)
{
dictTypeService.deleteDictTypeByIds(dictIds);
return success();
}
/**
* 刷新字典缓存
*/
@RequiresPermissions("Utem:dict:remove")
@Log(title = "字典类型", businessType = BusinessType.CLEAN)
@DeleteMapping("/refreshCache")
public AjaxResult refreshCache()
{
dictTypeService.resetDictCache();
return success();
}
/**
* 获取字典选择框列表
*/
@GetMapping("/optionselect")
public AjaxResult optionselect()
{
List<UDictType> dictTypes = dictTypeService.selectDictTypeAll();
return success(dictTypes);
}
}

View File

@@ -0,0 +1,87 @@
package org.wfc.user.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.wfc.common.core.constant.CacheConstants;
import org.wfc.common.core.utils.poi.ExcelUtil;
import org.wfc.common.core.web.controller.BaseController;
import org.wfc.common.core.web.domain.AjaxResult;
import org.wfc.common.core.web.page.TableDataInfo;
import org.wfc.common.log.annotation.Log;
import org.wfc.common.log.enums.BusinessType;
import org.wfc.common.redis.service.RedisService;
import org.wfc.common.security.annotation.InnerAuth;
import org.wfc.common.security.annotation.RequiresPermissions;
import org.wfc.user.api.domain.ULogininfor;
import org.wfc.user.service.IULogininforService;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 系统访问记录
*
* @author wfc
*/
@RestController
@RequestMapping("/logininfor")
public class ULogininforController extends BaseController
{
@Autowired
private IULogininforService logininforService;
@Autowired
private RedisService redisService;
@RequiresPermissions("Utem:logininfor:list")
@GetMapping("/list")
public TableDataInfo list(ULogininfor logininfor)
{
startPage();
List<ULogininfor> list = logininforService.selectLogininforList(logininfor);
return getDataTable(list);
}
@Log(title = "登录日志", businessType = BusinessType.EXPORT)
@RequiresPermissions("Utem:logininfor:export")
@PostMapping("/export")
public void export(HttpServletResponse response, ULogininfor logininfor)
{
List<ULogininfor> list = logininforService.selectLogininforList(logininfor);
ExcelUtil<ULogininfor> util = new ExcelUtil<ULogininfor>(ULogininfor.class);
util.exportExcel(response, list, "登录日志");
}
@RequiresPermissions("Utem:logininfor:remove")
@Log(title = "登录日志", businessType = BusinessType.DELETE)
@DeleteMapping("/{infoIds}")
public AjaxResult remove(@PathVariable Long[] infoIds)
{
return toAjax(logininforService.deleteLogininforByIds(infoIds));
}
@RequiresPermissions("Utem:logininfor:remove")
@Log(title = "登录日志", businessType = BusinessType.DELETE)
@DeleteMapping("/clean")
public AjaxResult clean()
{
logininforService.cleanLogininfor();
return success();
}
@RequiresPermissions("Utem:logininfor:unlock")
@Log(title = "账户解锁", businessType = BusinessType.OTHER)
@GetMapping("/unlock/{userName}")
public AjaxResult unlock(@PathVariable("userName") String userName)
{
redisService.deleteObject(CacheConstants.PWD_ERR_CNT_KEY + userName);
return success();
}
@InnerAuth
@PostMapping
public AjaxResult add(@RequestBody ULogininfor logininfor)
{
return toAjax(logininforService.insertLogininfor(logininfor));
}
}

View File

@@ -0,0 +1,153 @@
package org.wfc.user.controller;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.wfc.common.core.constant.UserConstants;
import org.wfc.common.core.utils.StringUtils;
import org.wfc.common.core.web.controller.BaseController;
import org.wfc.common.core.web.domain.AjaxResult;
import org.wfc.common.core.web.page.TableDataInfo;
import org.wfc.common.log.annotation.Log;
import org.wfc.common.log.enums.BusinessType;
import org.wfc.common.security.annotation.RequiresPermissions;
import org.wfc.common.security.utils.SecurityUtils;
import org.wfc.user.domain.UMenu;
import org.wfc.user.service.IUMenuService;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 菜单信息
*
* @author wfc
*/
@RestController
@RequestMapping("/menu")
public class UMenuController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(UMenuController.class);
@Autowired
private IUMenuService menuService;
public enum RoutersType {
/**
* 菜单
*/
MENU,
/**
* 按钮
*/
MENU_CONSTANT
}
/**
* 获取菜单列表
*/
@RequiresPermissions("Utem:menu:list")
@GetMapping("/list")
public TableDataInfo list(UMenu menu) {
Long userId = SecurityUtils.getUserId();
List<UMenu> menus = menuService.selectMenuList(menu, userId);
return getDataTable(menus);
}
/**
* 根据菜单编号获取详细信息
*/
@RequiresPermissions("Utem:menu:query")
@GetMapping(value = "/{menuId}")
public AjaxResult getInfo(@PathVariable Long menuId) {
return success(menuService.selectMenuById(menuId));
}
/**
* 获取菜单下拉树列表
*/
@GetMapping("/treeselect")
public AjaxResult treeselect(UMenu menu) {
Long userId = SecurityUtils.getUserId();
List<UMenu> menus = menuService.selectMenuList(menu, userId);
return success(menuService.buildMenuTreeSelect(menus));
}
/**
* 加载对应角色菜单列表树
*/
@GetMapping(value = "/roleMenuTreeselect/{roleId}")
public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId) {
Long userId = SecurityUtils.getUserId();
List<UMenu> menus = menuService.selectMenuList(userId);
Map<String, Object> ajax = new HashMap<>();
ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId));
ajax.put("menus", menuService.buildMenuTreeSelect(menus));
return AjaxResult.success(ajax);
}
/**
* 新增菜单
*/
@RequiresPermissions("Utem:menu:add")
@Log(title = "菜单管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody UMenu menu) {
if (!menuService.checkMenuNameUnique(menu)) {
return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
} else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) {
return error("新增菜单'" + menu.getMenuName() + "'失败地址必须以http(s)://开头");
}
menu.setCreateBy(SecurityUtils.getUsername());
return toAjax(menuService.insertMenu(menu));
}
/**
* 修改菜单
*/
@RequiresPermissions("Utem:menu:edit")
@Log(title = "菜单管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody UMenu menu) {
if (!menuService.checkMenuNameUnique(menu)) {
return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
} else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) {
return error("修改菜单'" + menu.getMenuName() + "'失败地址必须以http(s)://开头");
} else if (menu.getMenuId().equals(menu.getParentId())) {
return error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己");
}
menu.setUpdateBy(SecurityUtils.getUsername());
return toAjax(menuService.updateMenu(menu));
}
/**
* 删除菜单
*/
@RequiresPermissions("Utem:menu:remove")
@Log(title = "菜单管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{menuId}")
public AjaxResult remove(@PathVariable("menuId") Long menuId) {
if (menuService.hasChildByMenuId(menuId)) {
return warn("存在子菜单,不允许删除");
}
if (menuService.checkMenuExistRole(menuId)) {
return warn("菜单已分配,不允许删除");
}
return toAjax(menuService.deleteMenuById(menuId));
}
/**
* 获取路由信息
*
* @return 路由信息
*/
@GetMapping("getRouters")
public AjaxResult getRouters() {
// @PathVariable("type") RoutersType type
Long userId = SecurityUtils.getUserId();
List<UMenu> menus = menuService.selectMenuTreeByUserId(userId);
return success(menuService.buildMenus(menus));
}
}

View File

@@ -0,0 +1,73 @@
package org.wfc.user.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.wfc.common.core.utils.poi.ExcelUtil;
import org.wfc.common.core.web.controller.BaseController;
import org.wfc.common.core.web.domain.AjaxResult;
import org.wfc.common.core.web.page.TableDataInfo;
import org.wfc.common.log.annotation.Log;
import org.wfc.common.log.enums.BusinessType;
import org.wfc.common.security.annotation.InnerAuth;
import org.wfc.common.security.annotation.RequiresPermissions;
import org.wfc.user.api.domain.UOperLog;
import org.wfc.user.service.IUOperLogService;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 操作日志记录
*
* @author wfc
*/
@RestController
@RequestMapping("/operlog")
public class UOperlogController extends BaseController
{
@Autowired
private IUOperLogService operLogService;
@RequiresPermissions("Utem:operlog:list")
@GetMapping("/list")
public TableDataInfo list(UOperLog operLog)
{
startPage();
List<UOperLog> list = operLogService.selectOperLogList(operLog);
return getDataTable(list);
}
@Log(title = "操作日志", businessType = BusinessType.EXPORT)
@RequiresPermissions("Utem:operlog:export")
@PostMapping("/export")
public void export(HttpServletResponse response, UOperLog operLog)
{
List<UOperLog> list = operLogService.selectOperLogList(operLog);
ExcelUtil<UOperLog> util = new ExcelUtil<UOperLog>(UOperLog.class);
util.exportExcel(response, list, "操作日志");
}
@Log(title = "操作日志", businessType = BusinessType.DELETE)
@RequiresPermissions("Utem:operlog:remove")
@DeleteMapping("/{operIds}")
public AjaxResult remove(@PathVariable Long[] operIds)
{
return toAjax(operLogService.deleteOperLogByIds(operIds));
}
@RequiresPermissions("Utem:operlog:remove")
@Log(title = "操作日志", businessType = BusinessType.CLEAN)
@DeleteMapping("/clean")
public AjaxResult clean()
{
operLogService.cleanOperLog();
return success();
}
@InnerAuth
@PostMapping
public AjaxResult add(@RequestBody UOperLog operLog)
{
return toAjax(operLogService.insertOperlog(operLog));
}
}

View File

@@ -0,0 +1,124 @@
package org.wfc.user.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.wfc.common.core.utils.poi.ExcelUtil;
import org.wfc.common.core.web.controller.BaseController;
import org.wfc.common.core.web.domain.AjaxResult;
import org.wfc.common.core.web.page.TableDataInfo;
import org.wfc.common.log.annotation.Log;
import org.wfc.common.log.enums.BusinessType;
import org.wfc.common.security.annotation.RequiresPermissions;
import org.wfc.common.security.utils.SecurityUtils;
import org.wfc.user.domain.UPost;
import org.wfc.user.service.IUPostService;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 岗位信息操作处理
*
* @author wfc
*/
@RestController
@RequestMapping("/post")
public class UPostController extends BaseController
{
@Autowired
private IUPostService postService;
/**
* 获取岗位列表
*/
@RequiresPermissions("Utem:post:list")
@GetMapping("/list")
public TableDataInfo list(UPost post)
{
startPage();
List<UPost> list = postService.selectPostList(post);
return getDataTable(list);
}
@Log(title = "岗位管理", businessType = BusinessType.EXPORT)
@RequiresPermissions("Utem:post:export")
@PostMapping("/export")
public void export(HttpServletResponse response, UPost post)
{
List<UPost> list = postService.selectPostList(post);
ExcelUtil<UPost> util = new ExcelUtil<UPost>(UPost.class);
util.exportExcel(response, list, "岗位数据");
}
/**
* 根据岗位编号获取详细信息
*/
@RequiresPermissions("Utem:post:query")
@GetMapping(value = "/{postId}")
public AjaxResult getInfo(@PathVariable Long postId)
{
return success(postService.selectPostById(postId));
}
/**
* 新增岗位
*/
@RequiresPermissions("Utem:post:add")
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody UPost post)
{
if (!postService.checkPostNameUnique(post))
{
return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
}
else if (!postService.checkPostCodeUnique(post))
{
return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
}
post.setCreateBy(SecurityUtils.getUsername());
return toAjax(postService.insertPost(post));
}
/**
* 修改岗位
*/
@RequiresPermissions("Utem:post:edit")
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody UPost post)
{
if (!postService.checkPostNameUnique(post))
{
return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
}
else if (!postService.checkPostCodeUnique(post))
{
return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
}
post.setUpdateBy(SecurityUtils.getUsername());
return toAjax(postService.updatePost(post));
}
/**
* 删除岗位
*/
@RequiresPermissions("Utem:post:remove")
@Log(title = "岗位管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{postIds}")
public AjaxResult remove(@PathVariable Long[] postIds)
{
return toAjax(postService.deletePostByIds(postIds));
}
/**
* 获取岗位选择框列表
*/
@GetMapping("/optionselect")
public AjaxResult optionselect()
{
List<UPost> posts = postService.selectPostAll();
return success(posts);
}
}

View File

@@ -0,0 +1,153 @@
package org.wfc.user.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.wfc.common.core.domain.LoginUser;
import org.wfc.common.core.domain.R;
import org.wfc.common.core.utils.StringUtils;
import org.wfc.common.core.utils.file.FileTypeUtils;
import org.wfc.common.core.utils.file.MimeTypeUtils;
import org.wfc.common.core.web.controller.BaseController;
import org.wfc.common.core.web.domain.AjaxResult;
import org.wfc.common.log.annotation.Log;
import org.wfc.common.log.enums.BusinessType;
import org.wfc.common.security.service.TokenService;
import org.wfc.common.security.utils.SecurityUtils;
import org.wfc.user.api.RemoteUFileService;
import org.wfc.user.api.domain.UFile;
import org.wfc.user.api.domain.UUser;
import org.wfc.user.service.IUUserService;
import java.util.Arrays;
/**
* 个人信息 业务处理
*
* @author wfc
*/
@RestController
@RequestMapping("/user/profile")
public class UProfileController extends BaseController
{
@Autowired
private IUUserService userService;
@Autowired
private TokenService tokenService;
@Autowired
private RemoteUFileService remoteUFileService;
/**
* 个人信息
*/
@GetMapping
public AjaxResult profile()
{
String username = SecurityUtils.getUsername();
UUser user = userService.selectUserByUserName(username);
AjaxResult ajax = AjaxResult.success(user);
ajax.put("roleGroup", userService.selectUserRoleGroup(username));
ajax.put("postGroup", userService.selectUserPostGroup(username));
return ajax;
}
/**
* 修改用户
*/
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult updateProfile(@RequestBody UUser user)
{
LoginUser<UUser> loginUser = SecurityUtils.getLoginUser();
UUser currentUser = loginUser.getUser();
currentUser.setNickName(user.getNickName());
currentUser.setEmail(user.getEmail());
currentUser.setPhonenumber(user.getPhonenumber());
currentUser.setSex(user.getSex());
if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(currentUser))
{
return error("修改用户'" + loginUser.getUsername() + "'失败,手机号码已存在");
}
if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(currentUser))
{
return error("修改用户'" + loginUser.getUsername() + "'失败,邮箱账号已存在");
}
if (userService.updateUserProfile(currentUser))
{
// 更新缓存用户信息
tokenService.setLoginUser(loginUser);
return success();
}
return error("修改个人信息异常,请联系管理员");
}
/**
* 重置密码
*/
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
@PutMapping("/updatePwd")
public AjaxResult updatePwd(String oldPassword, String newPassword)
{
String username = SecurityUtils.getUsername();
UUser user = userService.selectUserByUserName(username);
String password = user.getPassword();
if (!SecurityUtils.matchesPassword(oldPassword, password))
{
return error("修改密码失败,旧密码错误");
}
if (SecurityUtils.matchesPassword(newPassword, password))
{
return error("新密码不能与旧密码相同");
}
newPassword = SecurityUtils.encryptPassword(newPassword);
if (userService.resetUserPwd(username, newPassword) > 0)
{
// 更新缓存用户密码
LoginUser<UUser> loginUser = SecurityUtils.getLoginUser();
UUser uuser = loginUser.getUser();
uuser.setPassword(newPassword);
loginUser.setUser(uuser);
tokenService.setLoginUser(loginUser);
return success();
}
return error("修改密码异常,请联系管理员");
}
/**
* 头像上传
*/
@Log(title = "用户头像", businessType = BusinessType.UPDATE)
@PostMapping("/avatar")
public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file)
{
if (!file.isEmpty())
{
LoginUser<UUser> loginUser = SecurityUtils.getLoginUser();
String extension = FileTypeUtils.getExtension(file);
if (!StringUtils.equalsAnyIgnoreCase(extension, MimeTypeUtils.IMAGE_EXTENSION))
{
return error("文件格式不正确,请上传" + Arrays.toString(MimeTypeUtils.IMAGE_EXTENSION) + "格式");
}
R<UFile> fileResult = remoteUFileService.upload(file);
if (StringUtils.isNull(fileResult) || StringUtils.isNull(fileResult.getData()))
{
return error("文件服务异常,请联系管理员");
}
String url = fileResult.getData().getUrl();
if (userService.updateUserAvatar(loginUser.getUsername(), url))
{
AjaxResult ajax = AjaxResult.success();
ajax.put("imgUrl", url);
// 更新缓存用户头像
UUser uuser = loginUser.getUser();
uuser.setAvatar(url);
loginUser.setUser(uuser);
tokenService.setLoginUser(loginUser);
return ajax;
}
}
return error("上传图片异常,请联系管理员");
}
}

View File

@@ -0,0 +1,233 @@
package org.wfc.user.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.wfc.common.core.utils.poi.ExcelUtil;
import org.wfc.common.core.web.controller.BaseController;
import org.wfc.common.core.web.domain.AjaxResult;
import org.wfc.common.core.web.page.TableDataInfo;
import org.wfc.common.log.annotation.Log;
import org.wfc.common.log.enums.BusinessType;
import org.wfc.common.security.annotation.RequiresPermissions;
import org.wfc.common.security.utils.SecurityUtils;
import org.wfc.user.api.domain.UDept;
import org.wfc.user.api.domain.URole;
import org.wfc.user.api.domain.UUser;
import org.wfc.user.domain.UUserRole;
import org.wfc.user.service.IUDeptService;
import org.wfc.user.service.IURoleService;
import org.wfc.user.service.IUUserService;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 角色信息
*
* @author wfc
*/
@RestController
@RequestMapping("/role")
public class URoleController extends BaseController
{
@Autowired
private IURoleService roleService;
@Autowired
private IUUserService userService;
@Autowired
private IUDeptService deptService;
@RequiresPermissions("Utem:role:list")
@GetMapping("/list")
public TableDataInfo list(URole role)
{
startPage();
List<URole> list = roleService.selectRoleList(role);
return getDataTable(list);
}
@Log(title = "角色管理", businessType = BusinessType.EXPORT)
@RequiresPermissions("Utem:role:export")
@PostMapping("/export")
public void export(HttpServletResponse response, URole role)
{
List<URole> list = roleService.selectRoleList(role);
ExcelUtil<URole> util = new ExcelUtil<URole>(URole.class);
util.exportExcel(response, list, "角色数据");
}
/**
* 根据角色编号获取详细信息
*/
@RequiresPermissions("Utem:role:query")
@GetMapping(value = "/{roleId}")
public AjaxResult getInfo(@PathVariable Long roleId)
{
roleService.checkRoleDataScope(roleId);
return success(roleService.selectRoleById(roleId));
}
/**
* 新增角色
*/
@RequiresPermissions("Utem:role:add")
@Log(title = "角色管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody URole role)
{
if (!roleService.checkRoleNameUnique(role))
{
return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
}
else if (!roleService.checkRoleKeyUnique(role))
{
return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
}
role.setCreateBy(SecurityUtils.getUsername());
return toAjax(roleService.insertRole(role));
}
/**
* 修改保存角色
*/
@RequiresPermissions("Utem:role:edit")
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody URole role)
{
roleService.checkRoleAllowed(role);
roleService.checkRoleDataScope(role.getRoleId());
if (!roleService.checkRoleNameUnique(role))
{
return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
}
else if (!roleService.checkRoleKeyUnique(role))
{
return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
}
role.setUpdateBy(SecurityUtils.getUsername());
return toAjax(roleService.updateRole(role));
}
/**
* 修改保存数据权限
*/
@RequiresPermissions("Utem:role:edit")
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
@PutMapping("/dataScope")
public AjaxResult dataScope(@RequestBody URole role)
{
roleService.checkRoleAllowed(role);
roleService.checkRoleDataScope(role.getRoleId());
return toAjax(roleService.authDataScope(role));
}
/**
* 状态修改
*/
@RequiresPermissions("Utem:role:edit")
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody URole role)
{
roleService.checkRoleAllowed(role);
roleService.checkRoleDataScope(role.getRoleId());
role.setUpdateBy(SecurityUtils.getUsername());
return toAjax(roleService.updateRoleStatus(role));
}
/**
* 删除角色
*/
@RequiresPermissions("Utem:role:remove")
@Log(title = "角色管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{roleIds}")
public AjaxResult remove(@PathVariable Long[] roleIds)
{
return toAjax(roleService.deleteRoleByIds(roleIds));
}
/**
* 获取角色选择框列表
*/
@RequiresPermissions("Utem:role:query")
@GetMapping("/optionselect")
public AjaxResult optionselect()
{
return success(roleService.selectRoleAll());
}
/**
* 查询已分配用户角色列表
*/
@RequiresPermissions("Utem:role:list")
@GetMapping("/authUser/allocatedList")
public TableDataInfo allocatedList(UUser user)
{
startPage();
List<UUser> list = userService.selectAllocatedList(user);
return getDataTable(list);
}
/**
* 查询未分配用户角色列表
*/
@RequiresPermissions("Utem:role:list")
@GetMapping("/authUser/unallocatedList")
public TableDataInfo unallocatedList(UUser user)
{
startPage();
List<UUser> list = userService.selectUnallocatedList(user);
return getDataTable(list);
}
/**
* 取消授权用户
*/
@RequiresPermissions("Utem:role:edit")
@Log(title = "角色管理", businessType = BusinessType.GRANT)
@PutMapping("/authUser/cancel")
public AjaxResult cancelAuthUser(@RequestBody UUserRole userRole)
{
return toAjax(roleService.deleteAuthUser(userRole));
}
/**
* 批量取消授权用户
*/
@RequiresPermissions("Utem:role:edit")
@Log(title = "角色管理", businessType = BusinessType.GRANT)
@PutMapping("/authUser/cancelAll")
public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds)
{
return toAjax(roleService.deleteAuthUsers(roleId, userIds));
}
/**
* 批量选择用户授权
*/
@RequiresPermissions("Utem:role:edit")
@Log(title = "角色管理", businessType = BusinessType.GRANT)
@PutMapping("/authUser/selectAll")
public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds)
{
roleService.checkRoleDataScope(roleId);
return toAjax(roleService.insertAuthUsers(roleId, userIds));
}
/**
* 获取对应角色部门树列表
*/
@RequiresPermissions("Utem:role:query")
@GetMapping(value = "/deptTree/{roleId}")
public AjaxResult deptTree(@PathVariable("roleId") Long roleId)
{
AjaxResult ajax = AjaxResult.success();
ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
ajax.put("depts", deptService.selectDeptTreeList(new UDept()));
return ajax;
}
}

View File

@@ -1,104 +1,358 @@
package org.wfc.user.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.ArrayUtils;
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 org.wfc.common.log.annotation.Log;
import org.wfc.common.log.enums.BusinessType;
import org.wfc.common.security.annotation.RequiresPermissions;
import org.wfc.user.domain.UUser;
import org.wfc.user.service.IUUserService;
import org.springframework.context.MessageSource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.wfc.common.core.domain.LoginUser;
import org.wfc.common.core.domain.R;
import org.wfc.common.core.utils.MessageUtils;
import org.wfc.common.core.utils.StringUtils;
import org.wfc.common.core.utils.poi.ExcelUtil;
import org.wfc.common.core.web.controller.BaseController;
import org.wfc.common.core.web.domain.AjaxResult;
import org.wfc.common.core.utils.poi.ExcelUtil;
import org.wfc.common.core.web.page.TableDataInfo;
import org.wfc.common.log.annotation.Log;
import org.wfc.common.log.enums.BusinessType;
import org.wfc.common.security.annotation.InnerAuth;
import org.wfc.common.security.annotation.RequiresPermissions;
import org.wfc.common.security.service.TokenService;
import org.wfc.common.security.utils.SecurityUtils;
import org.wfc.user.api.domain.UDept;
import org.wfc.user.api.domain.URole;
import org.wfc.user.api.domain.UUser;
import org.wfc.user.service.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
/**
* 用户平台_用户信息Controller
*
* 用户信息
*
* @author wfc
* @date 2024-11-25
*/
@RestController
@RequestMapping("/user")
public class UUserController extends BaseController
{
@Autowired
private IUUserService uUserService;
private IUUserService userService;
@Autowired
private IURoleService roleService;
@Autowired
private IUDeptService deptService;
@Autowired
private IUPostService postService;
@Autowired
private IUPermissionService permissionService;
@Autowired
private IUConfigService configService;
@Autowired
private TokenService tokenService;
@Autowired
private MessageSource messageSource;
/**
* 查询用户平台_用户信息列表
* 获取用户列表
*/
@RequiresPermissions("user:user:list")
@GetMapping("/test")
public String test()
{
return MessageUtils.message("user.jcaptcha.error");
}
/**
* 获取用户列表
*/
@RequiresPermissions("Utem:user:list")
@GetMapping("/list")
public TableDataInfo list(UUser uUser)
public TableDataInfo list(UUser user)
{
startPage();
List<UUser> list = uUserService.selectUUserList(uUser);
List<UUser> list = userService.selectUserList(user);
return getDataTable(list);
}
/**
* 导出用户平台_用户信息列表
*/
@RequiresPermissions("user:user:export")
@Log(title = "用户平台_用户信息", businessType = BusinessType.EXPORT)
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
@RequiresPermissions("Utem:user:export")
@PostMapping("/export")
public void export(HttpServletResponse response, UUser uUser)
public void export(HttpServletResponse response, UUser user)
{
List<UUser> list = uUserService.selectUUserList(uUser);
List<UUser> list = userService.selectUserList(user);
ExcelUtil<UUser> util = new ExcelUtil<UUser>(UUser.class);
util.exportExcel(response, list, "用户平台_用户信息数据");
util.exportExcel(response, list, "用户数据");
}
/**
* 获取用户平台_用户信息详细信息
*/
@RequiresPermissions("user:user:query")
@GetMapping(value = "/{userId}")
public AjaxResult getInfo(@PathVariable("userId") Long userId)
@Log(title = "用户管理", businessType = BusinessType.IMPORT)
@RequiresPermissions("Utem:user:import")
@PostMapping("/importData")
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
{
return success(uUserService.selectUUserByUserId(userId));
ExcelUtil<UUser> util = new ExcelUtil<UUser>(UUser.class);
List<UUser> userList = util.importExcel(file.getInputStream());
String operName = SecurityUtils.getUsername();
String message = userService.importUser(userList, updateSupport, operName);
return success(message);
}
@PostMapping("/importTemplate")
public void importTemplate(HttpServletResponse response) throws IOException
{
ExcelUtil<UUser> util = new ExcelUtil<UUser>(UUser.class);
util.importTemplateExcel(response, "用户数据");
}
/**
* 新增用户平台_用户信息
* 获取当前用户信息
*/
@RequiresPermissions("user:user:add")
@Log(title = "用户平台_用户信息", businessType = BusinessType.INSERT)
@InnerAuth
@GetMapping("/info/{username}")
public R<LoginUser<UUser>> info(@PathVariable("username") String username)
{
UUser user = userService.selectUserByUserName(username);
if (StringUtils.isNull(user))
{
return R.fail("用户名或密码错误");
}
// 角色集合
Set<String> roles = permissionService.getRolePermission(user);
// 权限集合
Set<String> permissions = permissionService.getMenuPermission(user);
LoginUser<UUser> UUserVo = new LoginUser<UUser>();
UUserVo.setUser(user);
UUserVo.setRoles(roles);
UUserVo.setPermissions(permissions);
return R.ok(UUserVo);
}
/**
* 注册用户信息
*/
@InnerAuth
@PostMapping("/register")
public R<Boolean> register(@RequestBody UUser UUser)
{
String username = UUser.getUserName();
if (!("true".equals(configService.selectConfigByKey("U.account.registerUser"))))
{
return R.fail("当前系统没有开启注册功能!");
}
if (!userService.checkUserNameUnique(UUser))
{
return R.fail("保存用户'" + username + "'失败,注册账号已存在");
}
return R.ok(userService.registerUser(UUser));
}
/**
*记录用户登录IP地址和登录时间
*/
@InnerAuth
@PutMapping("/recordlogin")
public R<Boolean> recordlogin(@RequestBody UUser UUser)
{
return R.ok(userService.updateUserProfile(UUser));
}
/**
* 获取用户信息
*
* @return 用户信息
*/
@GetMapping("getInfo")
public AjaxResult getInfo()
{
LoginUser<UUser> loginUser = SecurityUtils.getLoginUser();
UUser user = loginUser.getUser();
// 角色集合
Set<String> roles = permissionService.getRolePermission(user);
// 权限集合
Set<String> permissions = permissionService.getMenuPermission(user);
if (!loginUser.getPermissions().equals(permissions))
{
loginUser.setPermissions(permissions);
tokenService.refreshToken(loginUser);
}
Map<String, Object> data = new HashMap<>();
data.put("user", user);
data.put("roles", roles);
data.put("permissions", permissions);
return AjaxResult.success(data);
}
/**
* 根据用户编号获取详细信息
*/
@RequiresPermissions("Utem:user:query")
@GetMapping(value = { "/", "/{userId}" })
public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId)
{
Map<String, Object> data = new HashMap<>();
List<URole> roles = roleService.selectRoleAll();
data.put("roles", UUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
data.put("posts", postService.selectPostAll());
if (StringUtils.isNotNull(userId))
{
userService.checkUserDataScope(userId);
UUser UUser = userService.selectUserById(userId);
data.put(AjaxResult.DATA_TAG, UUser);
data.put("postIds", postService.selectPostListByUserId(userId));
data.put("roleIds", UUser.getRoles().stream().map(URole::getRoleId).collect(Collectors.toList()));
}
return AjaxResult.success(data);
}
/**
* 新增用户
*/
@RequiresPermissions("Utem:user:add")
@Log(title = "用户管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody UUser uUser)
public AjaxResult add(@Validated @RequestBody UUser user)
{
return toAjax(uUserService.insertUUser(uUser));
deptService.checkDeptDataScope(user.getDeptId());
roleService.checkRoleDataScope(user.getRoleIds());
if (!userService.checkUserNameUnique(user))
{
return error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
}
else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
{
return error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
}
else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
{
return error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
}
user.setCreateBy(SecurityUtils.getUsername());
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
return toAjax(userService.insertUser(user));
}
/**
* 修改用户平台_用户信息
* 修改用户
*/
@RequiresPermissions("user:user:edit")
@Log(title = "用户平台_用户信息", businessType = BusinessType.UPDATE)
@RequiresPermissions("Utem:user:edit")
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody UUser uUser)
public AjaxResult edit(@Validated @RequestBody UUser user)
{
return toAjax(uUserService.updateUUser(uUser));
userService.checkUserAllowed(user);
userService.checkUserDataScope(user.getUserId());
deptService.checkDeptDataScope(user.getDeptId());
roleService.checkRoleDataScope(user.getRoleIds());
if (!userService.checkUserNameUnique(user))
{
return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在");
}
else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
{
return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
}
else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
{
return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
}
user.setUpdateBy(SecurityUtils.getUsername());
return toAjax(userService.updateUser(user));
}
/**
* 删除用户平台_用户信息
* 删除用户
*/
@RequiresPermissions("user:user:remove")
@Log(title = "用户平台_用户信息", businessType = BusinessType.DELETE)
@RequiresPermissions("Utem:user:remove")
@Log(title = "用户管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{userIds}")
public AjaxResult remove(@PathVariable Long[] userIds)
{
return toAjax(uUserService.deleteUUserByUserIds(userIds));
if (ArrayUtils.contains(userIds, SecurityUtils.getUserId()))
{
return error("当前用户不能删除");
}
return toAjax(userService.deleteUserByIds(userIds));
}
/**
* 重置密码
*/
@RequiresPermissions("Utem:user:edit")
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
@PutMapping("/resetPwd")
public AjaxResult resetPwd(@RequestBody UUser user)
{
userService.checkUserAllowed(user);
userService.checkUserDataScope(user.getUserId());
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
user.setUpdateBy(SecurityUtils.getUsername());
return toAjax(userService.resetPwd(user));
}
/**
* 状态修改
*/
@RequiresPermissions("Utem:user:edit")
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody UUser user)
{
userService.checkUserAllowed(user);
userService.checkUserDataScope(user.getUserId());
user.setUpdateBy(SecurityUtils.getUsername());
return toAjax(userService.updateUserStatus(user));
}
/**
* 根据用户编号获取授权角色
*/
@RequiresPermissions("Utem:user:query")
@GetMapping("/authRole/{userId}")
public AjaxResult authRole(@PathVariable("userId") Long userId)
{
AjaxResult ajax = AjaxResult.success();
UUser user = userService.selectUserById(userId);
List<URole> roles = roleService.selectRolesByUserId(userId);
ajax.put("user", user);
ajax.put("roles", UUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
return ajax;
}
/**
* 用户授权角色
*/
@RequiresPermissions("Utem:user:edit")
@Log(title = "用户管理", businessType = BusinessType.GRANT)
@PutMapping("/authRole")
public AjaxResult insertAuthRole(Long userId, Long[] roleIds)
{
userService.checkUserDataScope(userId);
roleService.checkRoleDataScope(roleIds);
userService.insertUserAuth(userId, roleIds);
return success();
}
/**
* 获取部门树列表
*/
@RequiresPermissions("Utem:user:list")
@GetMapping("/deptTree")
public AjaxResult deptTree(UDept dept)
{
return success(deptService.selectDeptTreeList(dept));
}
}

View File

@@ -0,0 +1,80 @@
package org.wfc.user.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.wfc.common.core.constant.CacheConstants;
import org.wfc.common.core.domain.LoginUser;
import org.wfc.common.core.utils.StringUtils;
import org.wfc.common.core.web.controller.BaseController;
import org.wfc.common.core.web.domain.AjaxResult;
import org.wfc.common.core.web.page.TableDataInfo;
import org.wfc.common.log.annotation.Log;
import org.wfc.common.log.enums.BusinessType;
import org.wfc.common.redis.service.RedisService;
import org.wfc.common.security.annotation.RequiresPermissions;
import org.wfc.user.domain.UUserOnline;
import org.wfc.user.service.IUUserOnlineService;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
/**
* 在线用户监控
*
* @author wfc
*/
@RestController
@RequestMapping("/online")
public class UUserOnlineController extends BaseController
{
@Autowired
private IUUserOnlineService userOnlineService;
@Autowired
private RedisService redisService;
@RequiresPermissions("monitor:online:list")
@GetMapping("/list")
public TableDataInfo list(String ipaddr, String userName)
{
Collection<String> keys = redisService.keys(CacheConstants.LOGIN_TOKEN_KEY + "*");
List<UUserOnline> userOnlineList = new ArrayList<UUserOnline>();
for (String key : keys)
{
LoginUser user = redisService.getCacheObject(key);
if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName))
{
userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user));
}
else if (StringUtils.isNotEmpty(ipaddr))
{
userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user));
}
else if (StringUtils.isNotEmpty(userName))
{
userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user));
}
else
{
userOnlineList.add(userOnlineService.loginUserToUserOnline(user));
}
}
Collections.reverse(userOnlineList);
userOnlineList.removeAll(Collections.singleton(null));
return getDataTable(userOnlineList);
}
/**
* 强退用户
*/
@RequiresPermissions("monitor:online:forceLogout")
@Log(title = "在线用户", businessType = BusinessType.FORCE)
@DeleteMapping("/{tokenId}")
public AjaxResult forceLogout(@PathVariable String tokenId)
{
redisService.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + tokenId);
return success();
}
}

View File

@@ -0,0 +1,112 @@
package org.wfc.user.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.wfc.common.core.annotation.Excel;
import org.wfc.common.core.annotation.Excel.ColumnType;
import org.wfc.common.core.web.domain.BaseEntity;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
/**
* 参数配置表 u_config
*
* @author wfc
*/
public class UConfig extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 参数主键 */
@Excel(name = "参数主键", cellType = ColumnType.NUMERIC)
private Long configId;
/** 参数名称 */
@Excel(name = "参数名称")
private String configName;
/** 参数键名 */
@Excel(name = "参数键名")
private String configKey;
/** 参数键值 */
@Excel(name = "参数键值")
private String configValue;
/** 系统内置Y是 N否 */
@Excel(name = "系统内置", readConverterExp = "Y=是,N=否")
private String configType;
public Long getConfigId()
{
return configId;
}
public void setConfigId(Long configId)
{
this.configId = configId;
}
@NotBlank(message = "参数名称不能为空")
@Size(min = 0, max = 100, message = "参数名称不能超过100个字符")
public String getConfigName()
{
return configName;
}
public void setConfigName(String configName)
{
this.configName = configName;
}
@NotBlank(message = "参数键名长度不能为空")
@Size(min = 0, max = 100, message = "参数键名长度不能超过100个字符")
public String getConfigKey()
{
return configKey;
}
public void setConfigKey(String configKey)
{
this.configKey = configKey;
}
@NotBlank(message = "参数键值不能为空")
@Size(min = 0, max = 500, message = "参数键值长度不能超过500个字符")
public String getConfigValue()
{
return configValue;
}
public void setConfigValue(String configValue)
{
this.configValue = configValue;
}
public String getConfigType()
{
return configType;
}
public void setConfigType(String configType)
{
this.configType = configType;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("configId", getConfigId())
.append("configName", getConfigName())
.append("configKey", getConfigKey())
.append("configValue", getConfigValue())
.append("configType", getConfigType())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

View File

@@ -0,0 +1,287 @@
package org.wfc.user.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.wfc.common.core.web.domain.BaseEntity;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.ArrayList;
import java.util.List;
/**
* 菜单权限表 u_menu
*
* @author wfc
*/
public class UMenu extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 菜单ID */
private Long menuId;
/** 菜单名称 */
private String menuName;
/** 父菜单名称 */
private String parentName;
/** 父菜单ID */
private Long parentId;
/** 显示顺序 */
private Integer orderNum;
/** 路由地址 */
private String path;
/** 组件路径 */
private String component;
/** 路由参数 */
private String query;
/** 路由名称默认和路由地址相同的驼峰格式注意因为vue3版本的router会删除名称相同路由为避免名字的冲突特殊情况可以自定义 */
private String routeName;
/** 是否为外链0是 1否 */
private String isFrame;
/** 是否缓存0缓存 1不缓存 */
private String isCache;
/** 类型M目录 C菜单 F按钮 */
private String menuType;
/** 显示状态0显示 1隐藏 */
private String visible;
/** 菜单状态0正常 1停用 */
private String status;
/** 权限字符串 */
private String perms;
/** 菜单图标 */
private String icon;
/** 菜单key */
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
/** 子菜单 */
private List<UMenu> children = new ArrayList<UMenu>();
public Long getMenuId()
{
return menuId;
}
public void setMenuId(Long menuId)
{
this.menuId = menuId;
}
@NotBlank(message = "菜单名称不能为空")
@Size(min = 0, max = 50, message = "菜单名称长度不能超过50个字符")
public String getMenuName()
{
return menuName;
}
public void setMenuName(String menuName)
{
this.menuName = menuName;
}
public String getParentName()
{
return parentName;
}
public void setParentName(String parentName)
{
this.parentName = parentName;
}
public Long getParentId()
{
return parentId;
}
public void setParentId(Long parentId)
{
this.parentId = parentId;
}
@NotNull(message = "显示顺序不能为空")
public Integer getOrderNum()
{
return orderNum;
}
public void setOrderNum(Integer orderNum)
{
this.orderNum = orderNum;
}
@Size(min = 0, max = 200, message = "路由地址不能超过200个字符")
public String getPath()
{
return path;
}
public void setPath(String path)
{
this.path = path;
}
@Size(min = 0, max = 200, message = "组件路径不能超过255个字符")
public String getComponent()
{
return component;
}
public void setComponent(String component)
{
this.component = component;
}
public String getQuery()
{
return query;
}
public void setQuery(String query)
{
this.query = query;
}
public String getRouteName()
{
return routeName;
}
public void setRouteName(String routeName)
{
this.routeName = routeName;
}
public String getIsFrame()
{
return isFrame;
}
public void setIsFrame(String isFrame)
{
this.isFrame = isFrame;
}
public String getIsCache()
{
return isCache;
}
public void setIsCache(String isCache)
{
this.isCache = isCache;
}
@NotBlank(message = "菜单类型不能为空")
public String getMenuType()
{
return menuType;
}
public void setMenuType(String menuType)
{
this.menuType = menuType;
}
public String getVisible()
{
return visible;
}
public void setVisible(String visible)
{
this.visible = visible;
}
public String getStatus()
{
return status;
}
public void setStatus(String status)
{
this.status = status;
}
@Size(min = 0, max = 100, message = "权限标识长度不能超过100个字符")
public String getPerms()
{
return perms;
}
public void setPerms(String perms)
{
this.perms = perms;
}
public String getIcon()
{
return icon;
}
public void setIcon(String icon)
{
this.icon = icon;
}
public List<UMenu> getChildren()
{
return children;
}
public void setChildren(List<UMenu> children)
{
this.children = children;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("menuId", getMenuId())
.append("menuName", getMenuName())
.append("parentId", getParentId())
.append("orderNum", getOrderNum())
.append("path", getPath())
.append("component", getComponent())
.append("query", getQuery())
.append("routeName", getRouteName())
.append("isFrame", getIsFrame())
.append("IsCache", getIsCache())
.append("menuType", getMenuType())
.append("visible", getVisible())
.append("status ", getStatus())
.append("perms", getPerms())
.append("icon", getIcon())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("name", getName())
.toString();
}
}

View File

@@ -0,0 +1,125 @@
package org.wfc.user.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.wfc.common.core.annotation.Excel;
import org.wfc.common.core.annotation.Excel.ColumnType;
import org.wfc.common.core.web.domain.BaseEntity;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
/**
* 岗位表 u_post
*
* @author wfc
*/
public class UPost extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 岗位序号 */
@Excel(name = "岗位序号", cellType = ColumnType.NUMERIC)
private Long postId;
/** 岗位编码 */
@Excel(name = "岗位编码")
private String postCode;
/** 岗位名称 */
@Excel(name = "岗位名称")
private String postName;
/** 岗位排序 */
@Excel(name = "岗位排序")
private Integer postSort;
/** 状态0正常 1停用 */
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
private String status;
/** 用户是否存在此岗位标识 默认不存在 */
private boolean flag = false;
public Long getPostId()
{
return postId;
}
public void setPostId(Long postId)
{
this.postId = postId;
}
@NotBlank(message = "岗位编码不能为空")
@Size(min = 0, max = 64, message = "岗位编码长度不能超过64个字符")
public String getPostCode()
{
return postCode;
}
public void setPostCode(String postCode)
{
this.postCode = postCode;
}
@NotBlank(message = "岗位名称不能为空")
@Size(min = 0, max = 50, message = "岗位名称长度不能超过50个字符")
public String getPostName()
{
return postName;
}
public void setPostName(String postName)
{
this.postName = postName;
}
@NotNull(message = "显示顺序不能为空")
public Integer getPostSort()
{
return postSort;
}
public void setPostSort(Integer postSort)
{
this.postSort = postSort;
}
public String getStatus()
{
return status;
}
public void setStatus(String status)
{
this.status = status;
}
public boolean isFlag()
{
return flag;
}
public void setFlag(boolean flag)
{
this.flag = flag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("postId", getPostId())
.append("postCode", getPostCode())
.append("postName", getPostName())
.append("postSort", getPostSort())
.append("status", getStatus())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

View File

@@ -0,0 +1,46 @@
package org.wfc.user.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 角色和部门关联 u_role_dept
*
* @author wfc
*/
public class URoleDept
{
/** 角色ID */
private Long roleId;
/** 部门ID */
private Long deptId;
public Long getRoleId()
{
return roleId;
}
public void setRoleId(Long roleId)
{
this.roleId = roleId;
}
public Long getDeptId()
{
return deptId;
}
public void setDeptId(Long deptId)
{
this.deptId = deptId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("roleId", getRoleId())
.append("deptId", getDeptId())
.toString();
}
}

View File

@@ -0,0 +1,46 @@
package org.wfc.user.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 角色和菜单关联 u_role_menu
*
* @author wfc
*/
public class URoleMenu
{
/** 角色ID */
private Long roleId;
/** 菜单ID */
private Long menuId;
public Long getRoleId()
{
return roleId;
}
public void setRoleId(Long roleId)
{
this.roleId = roleId;
}
public Long getMenuId()
{
return menuId;
}
public void setMenuId(Long menuId)
{
this.menuId = menuId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("roleId", getRoleId())
.append("menuId", getMenuId())
.toString();
}
}

View File

@@ -1,212 +0,0 @@
package org.wfc.user.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.wfc.common.core.annotation.Excel;
import org.wfc.common.core.web.domain.BaseEntity;
/**
* 用户平台_用户信息对象 u_user
*
* @author wfc
* @date 2024-11-25
*/
public class UUser extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 用户ID */
private Long userId;
/** 用户账号 */
@Excel(name = "用户账号")
private String userName;
/** 用户昵称 */
@Excel(name = "用户昵称")
private String nickName;
/** 年龄 */
@Excel(name = "年龄")
private String age;
/** 用户性别0男 1女 2未知 */
@Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
private String sex;
/** 用户邮箱 */
@Excel(name = "用户邮箱")
private String email;
/** 手机号码 */
@Excel(name = "手机号码")
private String phone;
/** 地址 */
@Excel(name = "地址")
private String address;
/** 密码 */
@Excel(name = "密码")
private String password;
/** 帐号状态0正常 1停用 */
@Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用")
private String status;
/** 删除标志0代表存在 2代表删除 */
private String delFlag;
/** 最后登录IP */
@Excel(name = "最后登录IP")
private String loginIp;
/** 最后登录时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date loginDate;
public void setUserId(Long userId)
{
this.userId = userId;
}
public Long getUserId()
{
return userId;
}
public void setUserName(String userName)
{
this.userName = userName;
}
public String getUserName()
{
return userName;
}
public void setNickName(String nickName)
{
this.nickName = nickName;
}
public String getNickName()
{
return nickName;
}
public void setAge(String age)
{
this.age = age;
}
public String getAge()
{
return age;
}
public void setSex(String sex)
{
this.sex = sex;
}
public String getSex()
{
return sex;
}
public void setEmail(String email)
{
this.email = email;
}
public String getEmail()
{
return email;
}
public void setPhone(String phone)
{
this.phone = phone;
}
public String getPhone()
{
return phone;
}
public void setAddress(String address)
{
this.address = address;
}
public String getAddress()
{
return address;
}
public void setPassword(String password)
{
this.password = password;
}
public String getPassword()
{
return password;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public String getDelFlag()
{
return delFlag;
}
public void setLoginIp(String loginIp)
{
this.loginIp = loginIp;
}
public String getLoginIp()
{
return loginIp;
}
public void setLoginDate(Date loginDate)
{
this.loginDate = loginDate;
}
public Date getLoginDate()
{
return loginDate;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("userId", getUserId())
.append("userName", getUserName())
.append("nickName", getNickName())
.append("age", getAge())
.append("sex", getSex())
.append("email", getEmail())
.append("phone", getPhone())
.append("address", getAddress())
.append("password", getPassword())
.append("status", getStatus())
.append("delFlag", getDelFlag())
.append("loginIp", getLoginIp())
.append("loginDate", getLoginDate())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

View File

@@ -0,0 +1,100 @@
package org.wfc.user.domain;
/**
* 当前在线会话
*
* @author wfc
*/
public class UUserOnline
{
/** 会话编号 */
private String tokenId;
/** 用户名称 */
private String userName;
/** 登录IP地址 */
private String ipaddr;
/** 登录地址 */
private String loginLocation;
/** 浏览器类型 */
private String browser;
/** 操作系统 */
private String os;
/** 登录时间 */
private Long loginTime;
public String getTokenId()
{
return tokenId;
}
public void setTokenId(String tokenId)
{
this.tokenId = tokenId;
}
public String getUserName()
{
return userName;
}
public void setUserName(String userName)
{
this.userName = userName;
}
public String getIpaddr()
{
return ipaddr;
}
public void setIpaddr(String ipaddr)
{
this.ipaddr = ipaddr;
}
public String getLoginLocation()
{
return loginLocation;
}
public void setLoginLocation(String loginLocation)
{
this.loginLocation = loginLocation;
}
public String getBrowser()
{
return browser;
}
public void setBrowser(String browser)
{
this.browser = browser;
}
public String getOs()
{
return os;
}
public void setOs(String os)
{
this.os = os;
}
public Long getLoginTime()
{
return loginTime;
}
public void setLoginTime(Long loginTime)
{
this.loginTime = loginTime;
}
}

View File

@@ -0,0 +1,46 @@
package org.wfc.user.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 用户和岗位关联 u_user_post
*
* @author wfc
*/
public class UUserPost
{
/** 用户ID */
private Long userId;
/** 岗位ID */
private Long postId;
public Long getUserId()
{
return userId;
}
public void setUserId(Long userId)
{
this.userId = userId;
}
public Long getPostId()
{
return postId;
}
public void setPostId(Long postId)
{
this.postId = postId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("userId", getUserId())
.append("postId", getPostId())
.toString();
}
}

View File

@@ -0,0 +1,46 @@
package org.wfc.user.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 用户和角色关联 u_user_role
*
* @author wfc
*/
public class UUserRole
{
/** 用户ID */
private Long userId;
/** 角色ID */
private Long roleId;
public Long getUserId()
{
return userId;
}
public void setUserId(Long userId)
{
this.userId = userId;
}
public Long getRoleId()
{
return roleId;
}
public void setRoleId(Long roleId)
{
this.roleId = roleId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("userId", getUserId())
.append("roleId", getRoleId())
.toString();
}
}

View File

@@ -0,0 +1,106 @@
package org.wfc.user.domain.vo;
import org.wfc.common.core.utils.StringUtils;
/**
* 路由显示信息
*
* @author wfc
*/
public class MetaVo
{
/**
* 设置该路由在侧边栏和面包屑中展示的名字
*/
private String title;
/**
* 设置该路由的图标对应路径src/assets/icons/svg
*/
private String icon;
/**
* 设置为true则不会被 <keep-alive>缓存
*/
private boolean noCache;
/**
* 内链地址http(s)://开头)
*/
private String link;
public MetaVo()
{
}
public MetaVo(String title, String icon)
{
this.title = title;
this.icon = icon;
}
public MetaVo(String title, String icon, boolean noCache)
{
this.title = title;
this.icon = icon;
this.noCache = noCache;
}
public MetaVo(String title, String icon, String link)
{
this.title = title;
this.icon = icon;
this.link = link;
}
public MetaVo(String title, String icon, boolean noCache, String link)
{
this.title = title;
this.icon = icon;
this.noCache = noCache;
if (StringUtils.ishttp(link))
{
this.link = link;
}
}
public boolean isNoCache()
{
return noCache;
}
public void setNoCache(boolean noCache)
{
this.noCache = noCache;
}
public String getTitle()
{
return title;
}
public void setTitle(String title)
{
this.title = title;
}
public String getIcon()
{
return icon;
}
public void setIcon(String icon)
{
this.icon = icon;
}
public String getLink()
{
return link;
}
public void setLink(String link)
{
this.link = link;
}
}

View File

@@ -0,0 +1,150 @@
package org.wfc.user.domain.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import org.wfc.user.domain.vo.MetaVo;
import java.util.List;
/**
* 路由配置信息
*
* @author wfc
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class RouterVo
{
/**
* 路由名字
*/
private String name;
/**
* 路由地址
*/
private String path;
/**
* 是否隐藏路由,当设置 true 的时候该路由不会再侧边栏出现
*/
private boolean hideInMenu;
/**
* 重定向地址,当设置 noRedirect 的时候该路由在面包屑导航中不可被点击
*/
private String redirect;
/**
* 组件地址
*/
private String component;
/**
* 路由参数:如 {"id": 1, "name": "ry"}
*/
private String query;
/**
* 当你一个路由下面的 children 声明的路由大于1个时自动会变成嵌套的模式--如组件页面
*/
private Boolean alwaysShow;
/**
* 其他元素
*/
private MetaVo meta;
/**
* 子路由
*/
private List<RouterVo> children;
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public String getPath()
{
return path;
}
public void setPath(String path)
{
this.path = path;
}
public boolean getHideInMenu()
{
return hideInMenu;
}
public void setHideInMenu(boolean hideInMenu)
{
this.hideInMenu = hideInMenu;
}
public String getRedirect()
{
return redirect;
}
public void setRedirect(String redirect)
{
this.redirect = redirect;
}
public String getComponent()
{
return component;
}
public void setComponent(String component)
{
this.component = component;
}
public String getQuery()
{
return query;
}
public void setQuery(String query)
{
this.query = query;
}
public Boolean getAlwaysShow()
{
return alwaysShow;
}
public void setAlwaysShow(Boolean alwaysShow)
{
this.alwaysShow = alwaysShow;
}
public MetaVo getMeta()
{
return meta;
}
public void setMeta(MetaVo meta)
{
this.meta = meta;
}
public List<RouterVo> getChildren()
{
return children;
}
public void setChildren(List<RouterVo> children)
{
this.children = children;
}
}

View File

@@ -0,0 +1,78 @@
package org.wfc.user.domain.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import org.wfc.user.api.domain.UDept;
import org.wfc.user.domain.UMenu;
import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;
/**
* Treeselect树结构实体类
*
* @author wfc
*/
public class TreeSelect implements Serializable
{
private static final long serialVersionUID = 1L;
/** 节点ID */
private Long id;
/** 节点名称 */
private String label;
/** 子节点 */
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<TreeSelect> children;
public TreeSelect()
{
}
public TreeSelect(UDept dept)
{
this.id = dept.getDeptId();
this.label = dept.getDeptName();
this.children = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
}
public TreeSelect(UMenu menu)
{
this.id = menu.getMenuId();
this.label = menu.getMenuName();
this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
}
public Long getId()
{
return id;
}
public void setId(Long id)
{
this.id = id;
}
public String getLabel()
{
return label;
}
public void setLabel(String label)
{
this.label = label;
}
public List<TreeSelect> getChildren()
{
return children;
}
public void setChildren(List<TreeSelect> children)
{
this.children = children;
}
}

View File

@@ -0,0 +1,77 @@
package org.wfc.user.mapper;
import org.wfc.user.domain.UConfig;
import java.util.List;
/**
* 参数配置 数据层
*
* @author wfc
*/
public interface UConfigMapper
{
/**
* 查询参数配置信息
*
* @param config 参数配置信息
* @return 参数配置信息
*/
public UConfig selectConfig(UConfig config);
/**
* 通过ID查询配置
*
* @param configId 参数ID
* @return 参数配置信息
*/
public UConfig selectConfigById(Long configId);
/**
* 查询参数配置列表
*
* @param config 参数配置信息
* @return 参数配置集合
*/
public List<UConfig> selectConfigList(UConfig config);
/**
* 根据键名查询参数配置信息
*
* @param configKey 参数键名
* @return 参数配置信息
*/
public UConfig checkConfigKeyUnique(String configKey);
/**
* 新增参数配置
*
* @param config 参数配置信息
* @return 结果
*/
public int insertConfig(UConfig config);
/**
* 修改参数配置
*
* @param config 参数配置信息
* @return 结果
*/
public int updateConfig(UConfig config);
/**
* 删除参数配置
*
* @param configId 参数ID
* @return 结果
*/
public int deleteConfigById(Long configId);
/**
* 批量删除参数信息
*
* @param configIds 需要删除的参数ID
* @return 结果
*/
public int deleteConfigByIds(Long[] configIds);
}

View File

@@ -0,0 +1,119 @@
package org.wfc.user.mapper;
import org.apache.ibatis.annotations.Param;
import org.wfc.user.api.domain.UDept;
import java.util.List;
/**
* 部门管理 数据层
*
* @author wfc
*/
public interface UDeptMapper
{
/**
* 查询部门管理数据
*
* @param dept 部门信息
* @return 部门信息集合
*/
public List<UDept> selectDeptList(UDept dept);
/**
* 根据角色ID查询部门树信息
*
* @param roleId 角色ID
* @param deptCheckStrictly 部门树选择项是否关联显示
* @return 选中部门列表
*/
public List<Long> selectDeptListByRoleId(@Param("roleId") Long roleId, @Param("deptCheckStrictly") boolean deptCheckStrictly);
/**
* 根据部门ID查询信息
*
* @param deptId 部门ID
* @return 部门信息
*/
public UDept selectDeptById(Long deptId);
/**
* 根据ID查询所有子部门
*
* @param deptId 部门ID
* @return 部门列表
*/
public List<UDept> selectChildrenDeptById(Long deptId);
/**
* 根据ID查询所有子部门正常状态
*
* @param deptId 部门ID
* @return 子部门数
*/
public int selectNormalChildrenDeptById(Long deptId);
/**
* 是否存在子节点
*
* @param deptId 部门ID
* @return 结果
*/
public int hasChildByDeptId(Long deptId);
/**
* 查询部门是否存在用户
*
* @param deptId 部门ID
* @return 结果
*/
public int checkDeptExistUser(Long deptId);
/**
* 校验部门名称是否唯一
*
* @param deptName 部门名称
* @param parentId 父部门ID
* @return 结果
*/
public UDept checkDeptNameUnique(@Param("deptName") String deptName, @Param("parentId") Long parentId);
/**
* 新增部门信息
*
* @param dept 部门信息
* @return 结果
*/
public int insertDept(UDept dept);
/**
* 修改部门信息
*
* @param dept 部门信息
* @return 结果
*/
public int updateDept(UDept dept);
/**
* 修改所在部门正常状态
*
* @param deptIds 部门ID组
*/
public void updateDeptStatusNormal(Long[] deptIds);
/**
* 修改子元素关系
*
* @param depts 子元素
* @return 结果
*/
public int updateDeptChildren(@Param("depts") List<UDept> depts);
/**
* 删除部门管理信息
*
* @param deptId 部门ID
* @return 结果
*/
public int deleteDeptById(Long deptId);
}

View File

@@ -0,0 +1,96 @@
package org.wfc.user.mapper;
import org.apache.ibatis.annotations.Param;
import org.wfc.user.api.domain.UDictData;
import java.util.List;
/**
* 字典表 数据层
*
* @author wfc
*/
public interface UDictDataMapper
{
/**
* 根据条件分页查询字典数据
*
* @param dictData 字典数据信息
* @return 字典数据集合信息
*/
public List<UDictData> selectDictDataList(UDictData dictData);
/**
* 根据字典类型查询字典数据
*
* @param dictType 字典类型
* @return 字典数据集合信息
*/
public List<UDictData> selectDictDataByType(String dictType);
/**
* 根据字典类型和字典键值查询字典数据信息
*
* @param dictType 字典类型
* @param dictValue 字典键值
* @return 字典标签
*/
public String selectDictLabel(@Param("dictType") String dictType, @Param("dictValue") String dictValue);
/**
* 根据字典数据ID查询信息
*
* @param dictCode 字典数据ID
* @return 字典数据
*/
public UDictData selectDictDataById(Long dictCode);
/**
* 查询字典数据
*
* @param dictType 字典类型
* @return 字典数据
*/
public int countDictDataByType(String dictType);
/**
* 通过字典ID删除字典数据信息
*
* @param dictCode 字典数据ID
* @return 结果
*/
public int deleteDictDataById(Long dictCode);
/**
* 批量删除字典数据信息
*
* @param dictCodes 需要删除的字典数据ID
* @return 结果
*/
public int deleteDictDataByIds(Long[] dictCodes);
/**
* 新增字典数据信息
*
* @param dictData 字典数据信息
* @return 结果
*/
public int insertDictData(UDictData dictData);
/**
* 修改字典数据信息
*
* @param dictData 字典数据信息
* @return 结果
*/
public int updateDictData(UDictData dictData);
/**
* 同步修改字典类型
*
* @param oldDictType 旧字典类型
* @param newDictType 新旧字典类型
* @return 结果
*/
public int updateDictDataType(@Param("oldDictType") String oldDictType, @Param("newDictType") String newDictType);
}

View File

@@ -0,0 +1,84 @@
package org.wfc.user.mapper;
import org.wfc.user.api.domain.UDictType;
import java.util.List;
/**
* 字典表 数据层
*
* @author wfc
*/
public interface UDictTypeMapper
{
/**
* 根据条件分页查询字典类型
*
* @param dictType 字典类型信息
* @return 字典类型集合信息
*/
public List<UDictType> selectDictTypeList(UDictType dictType);
/**
* 根据所有字典类型
*
* @return 字典类型集合信息
*/
public List<UDictType> selectDictTypeAll();
/**
* 根据字典类型ID查询信息
*
* @param dictId 字典类型ID
* @return 字典类型
*/
public UDictType selectDictTypeById(Long dictId);
/**
* 根据字典类型查询信息
*
* @param dictType 字典类型
* @return 字典类型
*/
public UDictType selectDictTypeByType(String dictType);
/**
* 通过字典ID删除字典信息
*
* @param dictId 字典ID
* @return 结果
*/
public int deleteDictTypeById(Long dictId);
/**
* 批量删除字典类型信息
*
* @param dictIds 需要删除的字典ID
* @return 结果
*/
public int deleteDictTypeByIds(Long[] dictIds);
/**
* 新增字典类型信息
*
* @param dictType 字典类型信息
* @return 结果
*/
public int insertDictType(UDictType dictType);
/**
* 修改字典类型信息
*
* @param dictType 字典类型信息
* @return 结果
*/
public int updateDictType(UDictType dictType);
/**
* 校验字典类型称是否唯一
*
* @param dictType 字典类型
* @return 结果
*/
public UDictType checkDictTypeUnique(String dictType);
}

View File

@@ -0,0 +1,43 @@
package org.wfc.user.mapper;
import org.wfc.user.api.domain.ULogininfor;
import java.util.List;
/**
* 系统访问日志情况信息 数据层
*
* @author wfc
*/
public interface ULogininforMapper
{
/**
* 新增系统登录日志
*
* @param logininfor 访问日志对象
*/
public int insertLogininfor(ULogininfor logininfor);
/**
* 查询系统登录日志集合
*
* @param logininfor 访问日志对象
* @return 登录记录集合
*/
public List<ULogininfor> selectLogininforList(ULogininfor logininfor);
/**
* 批量删除系统登录日志
*
* @param infoIds 需要删除的登录日志ID
* @return 结果
*/
public int deleteLogininforByIds(Long[] infoIds);
/**
* 清空系统登录日志
*
* @return 结果
*/
public int cleanLogininfor();
}

View File

@@ -0,0 +1,126 @@
package org.wfc.user.mapper;
import org.apache.ibatis.annotations.Param;
import org.wfc.user.domain.UMenu;
import java.util.List;
/**
* 菜单表 数据层
*
* @author wfc
*/
public interface UMenuMapper
{
/**
* 查询系统菜单列表
*
* @param menu 菜单信息
* @return 菜单列表
*/
public List<UMenu> selectMenuList(UMenu menu);
/**
* 根据用户所有权限
*
* @return 权限列表
*/
public List<String> selectMenuPerms();
/**
* 根据用户查询系统菜单列表
*
* @param menu 菜单信息
* @return 菜单列表
*/
public List<UMenu> selectMenuListByUserId(UMenu menu);
/**
* 根据角色ID查询权限
*
* @param roleId 角色ID
* @return 权限列表
*/
public List<String> selectMenuPermsByRoleId(Long roleId);
/**
* 根据用户ID查询权限
*
* @param userId 用户ID
* @return 权限列表
*/
public List<String> selectMenuPermsByUserId(Long userId);
/**
* 根据用户ID查询菜单
*
* @return 菜单列表
*/
public List<UMenu> selectMenuTreeAll();
/**
* 根据用户ID查询菜单
*
* @param userId 用户ID
* @return 菜单列表
*/
public List<UMenu> selectMenuTreeByUserId(Long userId);
/**
* 根据角色ID查询菜单树信息
*
* @param roleId 角色ID
* @param menuCheckStrictly 菜单树选择项是否关联显示
* @return 选中菜单列表
*/
public List<Long> selectMenuListByRoleId(@Param("roleId") Long roleId, @Param("menuCheckStrictly") boolean menuCheckStrictly);
/**
* 根据菜单ID查询信息
*
* @param menuId 菜单ID
* @return 菜单信息
*/
public UMenu selectMenuById(Long menuId);
/**
* 是否存在菜单子节点
*
* @param menuId 菜单ID
* @return 结果
*/
public int hasChildByMenuId(Long menuId);
/**
* 新增菜单信息
*
* @param menu 菜单信息
* @return 结果
*/
public int insertMenu(UMenu menu);
/**
* 修改菜单信息
*
* @param menu 菜单信息
* @return 结果
*/
public int updateMenu(UMenu menu);
/**
* 删除菜单管理信息
*
* @param menuId 菜单ID
* @return 结果
*/
public int deleteMenuById(Long menuId);
/**
* 校验菜单名称是否唯一
*
* @param menuName 菜单名称
* @param parentId 父菜单ID
* @return 结果
*/
public UMenu checkMenuNameUnique(@Param("menuName") String menuName, @Param("parentId") Long parentId);
}

View File

@@ -0,0 +1,49 @@
package org.wfc.user.mapper;
import org.wfc.user.api.domain.UOperLog;
import java.util.List;
/**
* 操作日志 数据层
*
* @author wfc
*/
public interface UOperLogMapper
{
/**
* 新增操作日志
*
* @param operLog 操作日志对象
*/
public int insertOperlog(UOperLog operLog);
/**
* 查询系统操作日志集合
*
* @param operLog 操作日志对象
* @return 操作日志集合
*/
public List<UOperLog> selectOperLogList(UOperLog operLog);
/**
* 批量删除系统操作日志
*
* @param operIds 需要删除的操作日志ID
* @return 结果
*/
public int deleteOperLogByIds(Long[] operIds);
/**
* 查询操作日志详细
*
* @param operId 操作ID
* @return 操作日志对象
*/
public UOperLog selectOperLogById(Long operId);
/**
* 清空操作日志
*/
public void cleanOperLog();
}

View File

@@ -0,0 +1,100 @@
package org.wfc.user.mapper;
import org.wfc.user.domain.UPost;
import java.util.List;
/**
* 岗位信息 数据层
*
* @author wfc
*/
public interface UPostMapper
{
/**
* 查询岗位数据集合
*
* @param post 岗位信息
* @return 岗位数据集合
*/
public List<UPost> selectPostList(UPost post);
/**
* 查询所有岗位
*
* @return 岗位列表
*/
public List<UPost> selectPostAll();
/**
* 通过岗位ID查询岗位信息
*
* @param postId 岗位ID
* @return 角色对象信息
*/
public UPost selectPostById(Long postId);
/**
* 根据用户ID获取岗位选择框列表
*
* @param userId 用户ID
* @return 选中岗位ID列表
*/
public List<Long> selectPostListByUserId(Long userId);
/**
* 查询用户所属岗位组
*
* @param userName 用户名
* @return 结果
*/
public List<UPost> selectPostsByUserName(String userName);
/**
* 删除岗位信息
*
* @param postId 岗位ID
* @return 结果
*/
public int deletePostById(Long postId);
/**
* 批量删除岗位信息
*
* @param postIds 需要删除的岗位ID
* @return 结果
*/
public int deletePostByIds(Long[] postIds);
/**
* 修改岗位信息
*
* @param post 岗位信息
* @return 结果
*/
public int updatePost(UPost post);
/**
* 新增岗位信息
*
* @param post 岗位信息
* @return 结果
*/
public int insertPost(UPost post);
/**
* 校验岗位名称
*
* @param postName 岗位名称
* @return 结果
*/
public UPost checkPostNameUnique(String postName);
/**
* 校验岗位编码
*
* @param postCode 岗位编码
* @return 结果
*/
public UPost checkPostCodeUnique(String postCode);
}

View File

@@ -0,0 +1,45 @@
package org.wfc.user.mapper;
import org.wfc.user.domain.URoleDept;
import java.util.List;
/**
* 角色与部门关联表 数据层
*
* @author wfc
*/
public interface URoleDeptMapper
{
/**
* 通过角色ID删除角色和部门关联
*
* @param roleId 角色ID
* @return 结果
*/
public int deleteRoleDeptByRoleId(Long roleId);
/**
* 批量删除角色部门关联信息
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteRoleDept(Long[] ids);
/**
* 查询部门使用数量
*
* @param deptId 部门ID
* @return 结果
*/
public int selectCountRoleDeptByDeptId(Long deptId);
/**
* 批量新增角色部门信息
*
* @param roleDeptList 角色部门列表
* @return 结果
*/
public int batchRoleDept(List<URoleDept> roleDeptList);
}

View File

@@ -0,0 +1,108 @@
package org.wfc.user.mapper;
import org.wfc.user.api.domain.URole;
import java.util.List;
/**
* 角色表 数据层
*
* @author wfc
*/
public interface URoleMapper
{
/**
* 根据条件分页查询角色数据
*
* @param role 角色信息
* @return 角色数据集合信息
*/
public List<URole> selectRoleList(URole role);
/**
* 根据用户ID查询角色
*
* @param userId 用户ID
* @return 角色列表
*/
public List<URole> selectRolePermissionByUserId(Long userId);
/**
* 查询所有角色
*
* @return 角色列表
*/
public List<URole> selectRoleAll();
/**
* 根据用户ID获取角色选择框列表
*
* @param userId 用户ID
* @return 选中角色ID列表
*/
public List<Long> selectRoleListByUserId(Long userId);
/**
* 通过角色ID查询角色
*
* @param roleId 角色ID
* @return 角色对象信息
*/
public URole selectRoleById(Long roleId);
/**
* 根据用户ID查询角色
*
* @param userName 用户名
* @return 角色列表
*/
public List<URole> selectRolesByUserName(String userName);
/**
* 校验角色名称是否唯一
*
* @param roleName 角色名称
* @return 角色信息
*/
public URole checkRoleNameUnique(String roleName);
/**
* 校验角色权限是否唯一
*
* @param roleKey 角色权限
* @return 角色信息
*/
public URole checkRoleKeyUnique(String roleKey);
/**
* 修改角色信息
*
* @param role 角色信息
* @return 结果
*/
public int updateRole(URole role);
/**
* 新增角色信息
*
* @param role 角色信息
* @return 结果
*/
public int insertRole(URole role);
/**
* 通过角色ID删除角色
*
* @param roleId 角色ID
* @return 结果
*/
public int deleteRoleById(Long roleId);
/**
* 批量删除角色信息
*
* @param roleIds 需要删除的角色ID
* @return 结果
*/
public int deleteRoleByIds(Long[] roleIds);
}

View File

@@ -0,0 +1,45 @@
package org.wfc.user.mapper;
import org.wfc.user.domain.URoleMenu;
import java.util.List;
/**
* 角色与菜单关联表 数据层
*
* @author wfc
*/
public interface URoleMenuMapper
{
/**
* 查询菜单使用数量
*
* @param menuId 菜单ID
* @return 结果
*/
public int checkMenuExistRole(Long menuId);
/**
* 通过角色ID删除角色和菜单关联
*
* @param roleId 角色ID
* @return 结果
*/
public int deleteRoleMenuByRoleId(Long roleId);
/**
* 批量删除角色菜单关联信息
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteRoleMenu(Long[] ids);
/**
* 批量新增角色菜单信息
*
* @param roleMenuList 角色菜单列表
* @return 结果
*/
public int batchRoleMenu(List<URoleMenu> roleMenuList);
}

View File

@@ -1,61 +1,128 @@
package org.wfc.user.mapper;
import org.apache.ibatis.annotations.Param;
import org.wfc.user.api.domain.UUser;
import java.util.List;
import org.wfc.user.domain.UUser;
/**
* 用户平台_用户信息Mapper接口
*
* 用户表 数据层
*
* @author wfc
* @date 2024-11-25
*/
public interface UUserMapper
{
/**
* 查询用户平台_用户信息
*
* @param userId 用户平台_用户信息主键
* @return 用户平台_用户信息
* 根据条件分页查询用户列表
*
* @param UUser 用户信息
* @return 用户信息集合信息
*/
public UUser selectUUserByUserId(Long userId);
public List<UUser> selectUserList(UUser UUser);
/**
* 查询用户平台_用户信息列表
*
* @param uUser 用户平台_用户信息
* @return 用户平台_用户信息集合
* 根据条件分页查询已配用户角色列表
*
* @param user 用户信息
* @return 用户信息集合信息
*/
public List<UUser> selectUUserList(UUser uUser);
public List<UUser> selectAllocatedList(UUser user);
/**
* 新增用户平台_用户信息
*
* @param uUser 用户平台_用户信息
* 根据条件分页查询未分配用户角色列表
*
* @param user 用户信息
* @return 用户信息集合信息
*/
public List<UUser> selectUnallocatedList(UUser user);
/**
* 通过用户名查询用户
*
* @param userName 用户名
* @return 用户对象信息
*/
public UUser selectUserByUserName(String userName);
/**
* 通过用户ID查询用户
*
* @param userId 用户ID
* @return 用户对象信息
*/
public UUser selectUserById(Long userId);
/**
* 新增用户信息
*
* @param user 用户信息
* @return 结果
*/
public int insertUUser(UUser uUser);
public int insertUser(UUser user);
/**
* 修改用户平台_用户信息
*
* @param uUser 用户平台_用户信息
* 修改用户信息
*
* @param user 用户信息
* @return 结果
*/
public int updateUUser(UUser uUser);
public int updateUser(UUser user);
/**
* 删除用户平台_用户信息
*
* @param userId 用户平台_用户信息主键
* 修改用户头像
*
* @param userName 用户名
* @param avatar 头像地址
* @return 结果
*/
public int deleteUUserByUserId(Long userId);
public int updateUserAvatar(@Param("userName") String userName, @Param("avatar") String avatar);
/**
* 批量删除用户平台_用户信息
*
* @param userIds 需要删除的数据主键集合
* 重置用户密码
*
* @param userName 用户名
* @param password 密码
* @return 结果
*/
public int deleteUUserByUserIds(Long[] userIds);
public int resetUserPwd(@Param("userName") String userName, @Param("password") String password);
/**
* 通过用户ID删除用户
*
* @param userId 用户ID
* @return 结果
*/
public int deleteUserById(Long userId);
/**
* 批量删除用户信息
*
* @param userIds 需要删除的用户ID
* @return 结果
*/
public int deleteUserByIds(Long[] userIds);
/**
* 校验用户名称是否唯一
*
* @param userName 用户名称
* @return 结果
*/
public UUser checkUserNameUnique(String userName);
/**
* 校验手机号码是否唯一
*
* @param phonenumber 手机号码
* @return 结果
*/
public UUser checkPhoneUnique(String phonenumber);
/**
* 校验email是否唯一
*
* @param email 用户邮箱
* @return 结果
*/
public UUser checkEmailUnique(String email);
}

View File

@@ -0,0 +1,45 @@
package org.wfc.user.mapper;
import org.wfc.user.domain.UUserPost;
import java.util.List;
/**
* 用户与岗位关联表 数据层
*
* @author wfc
*/
public interface UUserPostMapper
{
/**
* 通过用户ID删除用户和岗位关联
*
* @param userId 用户ID
* @return 结果
*/
public int deleteUserPostByUserId(Long userId);
/**
* 通过岗位ID查询岗位使用数量
*
* @param postId 岗位ID
* @return 结果
*/
public int countUserPostById(Long postId);
/**
* 批量删除用户和岗位关联
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteUserPost(Long[] ids);
/**
* 批量新增用户岗位信息
*
* @param userPostList 用户岗位列表
* @return 结果
*/
public int batchUserPost(List<UUserPost> userPostList);
}

View File

@@ -0,0 +1,63 @@
package org.wfc.user.mapper;
import org.apache.ibatis.annotations.Param;
import org.wfc.user.domain.UUserRole;
import java.util.List;
/**
* 用户与角色关联表 数据层
*
* @author wfc
*/
public interface UUserRoleMapper
{
/**
* 通过用户ID删除用户和角色关联
*
* @param userId 用户ID
* @return 结果
*/
public int deleteUserRoleByUserId(Long userId);
/**
* 批量删除用户和角色关联
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteUserRole(Long[] ids);
/**
* 通过角色ID查询角色使用数量
*
* @param roleId 角色ID
* @return 结果
*/
public int countUserRoleByRoleId(Long roleId);
/**
* 批量新增用户角色信息
*
* @param userRoleList 用户角色列表
* @return 结果
*/
public int batchUserRole(List<UUserRole> userRoleList);
/**
* 删除用户和角色关联信息
*
* @param userRole 用户和角色关联信息
* @return 结果
*/
public int deleteUserRoleInfo(UUserRole userRole);
/**
* 批量取消授权用户角色
*
* @param roleId 角色ID
* @param userIds 需要删除的用户数据ID
* @return 结果
*/
public int deleteUserRoleInfos(@Param("roleId") Long roleId, @Param("userIds") Long[] userIds);
}

View File

@@ -0,0 +1,83 @@
package org.wfc.user.service;
import org.wfc.user.domain.UConfig;
import java.util.List;
/**
* 参数配置 服务层
*
* @author wfc
*/
public interface IUConfigService
{
/**
* 查询参数配置信息
*
* @param configId 参数配置ID
* @return 参数配置信息
*/
public UConfig selectConfigById(Long configId);
/**
* 根据键名查询参数配置信息
*
* @param configKey 参数键名
* @return 参数键值
*/
public String selectConfigByKey(String configKey);
/**
* 查询参数配置列表
*
* @param config 参数配置信息
* @return 参数配置集合
*/
public List<UConfig> selectConfigList(UConfig config);
/**
* 新增参数配置
*
* @param config 参数配置信息
* @return 结果
*/
public int insertConfig(UConfig config);
/**
* 修改参数配置
*
* @param config 参数配置信息
* @return 结果
*/
public int updateConfig(UConfig config);
/**
* 批量删除参数信息
*
* @param configIds 需要删除的参数ID
*/
public void deleteConfigByIds(Long[] configIds);
/**
* 加载参数缓存数据
*/
public void loadingConfigCache();
/**
* 清空参数缓存数据
*/
public void clearConfigCache();
/**
* 重置参数缓存数据
*/
public void resetConfigCache();
/**
* 校验参数键名是否唯一
*
* @param config 参数信息
* @return 结果
*/
public boolean checkConfigKeyUnique(UConfig config);
}

View File

@@ -0,0 +1,125 @@
package org.wfc.user.service;
import org.wfc.user.api.domain.UDept;
import org.wfc.user.domain.vo.TreeSelect;
import java.util.List;
/**
* 部门管理 服务层
*
* @author wfc
*/
public interface IUDeptService
{
/**
* 查询部门管理数据
*
* @param dept 部门信息
* @return 部门信息集合
*/
public List<UDept> selectDeptList(UDept dept);
/**
* 查询部门树结构信息
*
* @param dept 部门信息
* @return 部门树信息集合
*/
public List<TreeSelect> selectDeptTreeList(UDept dept);
/**
* 构建前端所需要树结构
*
* @param depts 部门列表
* @return 树结构列表
*/
public List<UDept> buildDeptTree(List<UDept> depts);
/**
* 构建前端所需要下拉树结构
*
* @param depts 部门列表
* @return 下拉树结构列表
*/
public List<TreeSelect> buildDeptTreeSelect(List<UDept> depts);
/**
* 根据角色ID查询部门树信息
*
* @param roleId 角色ID
* @return 选中部门列表
*/
public List<Long> selectDeptListByRoleId(Long roleId);
/**
* 根据部门ID查询信息
*
* @param deptId 部门ID
* @return 部门信息
*/
public UDept selectDeptById(Long deptId);
/**
* 根据ID查询所有子部门正常状态
*
* @param deptId 部门ID
* @return 子部门数
*/
public int selectNormalChildrenDeptById(Long deptId);
/**
* 是否存在部门子节点
*
* @param deptId 部门ID
* @return 结果
*/
public boolean hasChildByDeptId(Long deptId);
/**
* 查询部门是否存在用户
*
* @param deptId 部门ID
* @return 结果 true 存在 false 不存在
*/
public boolean checkDeptExistUser(Long deptId);
/**
* 校验部门名称是否唯一
*
* @param dept 部门信息
* @return 结果
*/
public boolean checkDeptNameUnique(UDept dept);
/**
* 校验部门是否有数据权限
*
* @param deptId 部门id
*/
public void checkDeptDataScope(Long deptId);
/**
* 新增保存部门信息
*
* @param dept 部门信息
* @return 结果
*/
public int insertDept(UDept dept);
/**
* 修改保存部门信息
*
* @param dept 部门信息
* @return 结果
*/
public int updateDept(UDept dept);
/**
* 删除部门管理信息
*
* @param deptId 部门ID
* @return 结果
*/
public int deleteDeptById(Long deptId);
}

View File

@@ -0,0 +1,61 @@
package org.wfc.user.service;
import org.wfc.user.api.domain.UDictData;
import java.util.List;
/**
* 字典 业务层
*
* @author wfc
*/
public interface IUDictDataService
{
/**
* 根据条件分页查询字典数据
*
* @param dictData 字典数据信息
* @return 字典数据集合信息
*/
public List<UDictData> selectDictDataList(UDictData dictData);
/**
* 根据字典类型和字典键值查询字典数据信息
*
* @param dictType 字典类型
* @param dictValue 字典键值
* @return 字典标签
*/
public String selectDictLabel(String dictType, String dictValue);
/**
* 根据字典数据ID查询信息
*
* @param dictCode 字典数据ID
* @return 字典数据
*/
public UDictData selectDictDataById(Long dictCode);
/**
* 批量删除字典数据信息
*
* @param dictCodes 需要删除的字典数据ID
*/
public void deleteDictDataByIds(Long[] dictCodes);
/**
* 新增保存字典数据信息
*
* @param dictData 字典数据信息
* @return 结果
*/
public int insertDictData(UDictData dictData);
/**
* 修改保存字典数据信息
*
* @param dictData 字典数据信息
* @return 结果
*/
public int updateDictData(UDictData dictData);
}

View File

@@ -0,0 +1,99 @@
package org.wfc.user.service;
import org.wfc.user.api.domain.UDictData;
import org.wfc.user.api.domain.UDictType;
import java.util.List;
/**
* 字典 业务层
*
* @author wfc
*/
public interface IUDictTypeService
{
/**
* 根据条件分页查询字典类型
*
* @param dictType 字典类型信息
* @return 字典类型集合信息
*/
public List<UDictType> selectDictTypeList(UDictType dictType);
/**
* 根据所有字典类型
*
* @return 字典类型集合信息
*/
public List<UDictType> selectDictTypeAll();
/**
* 根据字典类型查询字典数据
*
* @param dictType 字典类型
* @return 字典数据集合信息
*/
public List<UDictData> selectDictDataByType(String dictType);
/**
* 根据字典类型ID查询信息
*
* @param dictId 字典类型ID
* @return 字典类型
*/
public UDictType selectDictTypeById(Long dictId);
/**
* 根据字典类型查询信息
*
* @param dictType 字典类型
* @return 字典类型
*/
public UDictType selectDictTypeByType(String dictType);
/**
* 批量删除字典信息
*
* @param dictIds 需要删除的字典ID
*/
public void deleteDictTypeByIds(Long[] dictIds);
/**
* 加载字典缓存数据
*/
public void loadingDictCache();
/**
* 清空字典缓存数据
*/
public void clearDictCache();
/**
* 重置字典缓存数据
*/
public void resetDictCache();
/**
* 新增保存字典类型信息
*
* @param dictType 字典类型信息
* @return 结果
*/
public int insertDictType(UDictType dictType);
/**
* 修改保存字典类型信息
*
* @param dictType 字典类型信息
* @return 结果
*/
public int updateDictType(UDictType dictType);
/**
* 校验字典类型称是否唯一
*
* @param dictType 字典类型
* @return 结果
*/
public boolean checkDictTypeUnique(UDictType dictType);
}

View File

@@ -0,0 +1,41 @@
package org.wfc.user.service;
import org.wfc.user.api.domain.ULogininfor;
import java.util.List;
/**
* 系统访问日志情况信息 服务层
*
* @author wfc
*/
public interface IULogininforService
{
/**
* 新增系统登录日志
*
* @param logininfor 访问日志对象
*/
public int insertLogininfor(ULogininfor logininfor);
/**
* 查询系统登录日志集合
*
* @param logininfor 访问日志对象
* @return 登录记录集合
*/
public List<ULogininfor> selectLogininforList(ULogininfor logininfor);
/**
* 批量删除系统登录日志
*
* @param infoIds 需要删除的登录日志ID
* @return 结果
*/
public int deleteLogininforByIds(Long[] infoIds);
/**
* 清空系统登录日志
*/
public void cleanLogininfor();
}

View File

@@ -0,0 +1,145 @@
package org.wfc.user.service;
import org.wfc.user.domain.UMenu;
import org.wfc.user.domain.vo.RouterVo;
import org.wfc.user.domain.vo.TreeSelect;
import java.util.List;
import java.util.Set;
/**
* 菜单 业务层
*
* @author wfc
*/
public interface IUMenuService
{
/**
* 根据用户查询系统菜单列表
*
* @param userId 用户ID
* @return 菜单列表
*/
public List<UMenu> selectMenuList(Long userId);
/**
* 根据用户查询系统菜单列表
*
* @param menu 菜单信息
* @param userId 用户ID
* @return 菜单列表
*/
public List<UMenu> selectMenuList(UMenu menu, Long userId);
/**
* 根据用户ID查询权限
*
* @param userId 用户ID
* @return 权限列表
*/
public Set<String> selectMenuPermsByUserId(Long userId);
/**
* 根据角色ID查询权限
*
* @param roleId 角色ID
* @return 权限列表
*/
public Set<String> selectMenuPermsByRoleId(Long roleId);
/**
* 根据用户ID查询菜单树信息
*
* @param userId 用户ID
* @return 菜单列表
*/
public List<UMenu> selectMenuTreeByUserId(Long userId);
/**
* 根据角色ID查询菜单树信息
*
* @param roleId 角色ID
* @return 选中菜单列表
*/
public List<Long> selectMenuListByRoleId(Long roleId);
/**
* 构建前端路由所需要的菜单
*
* @param menus 菜单列表
* @return 路由列表
*/
public List<RouterVo> buildMenus(List<UMenu> menus);
/**
* 构建前端所需要树结构
*
* @param menus 菜单列表
* @return 树结构列表
*/
public List<UMenu> buildMenuTree(List<UMenu> menus);
/**
* 构建前端所需要下拉树结构
*
* @param menus 菜单列表
* @return 下拉树结构列表
*/
public List<TreeSelect> buildMenuTreeSelect(List<UMenu> menus);
/**
* 根据菜单ID查询信息
*
* @param menuId 菜单ID
* @return 菜单信息
*/
public UMenu selectMenuById(Long menuId);
/**
* 是否存在菜单子节点
*
* @param menuId 菜单ID
* @return 结果 true 存在 false 不存在
*/
public boolean hasChildByMenuId(Long menuId);
/**
* 查询菜单是否存在角色
*
* @param menuId 菜单ID
* @return 结果 true 存在 false 不存在
*/
public boolean checkMenuExistRole(Long menuId);
/**
* 新增保存菜单信息
*
* @param menu 菜单信息
* @return 结果
*/
public int insertMenu(UMenu menu);
/**
* 修改保存菜单信息
*
* @param menu 菜单信息
* @return 结果
*/
public int updateMenu(UMenu menu);
/**
* 删除菜单管理信息
*
* @param menuId 菜单ID
* @return 结果
*/
public int deleteMenuById(Long menuId);
/**
* 校验菜单名称是否唯一
*
* @param menu 菜单信息
* @return 结果
*/
public boolean checkMenuNameUnique(UMenu menu);
}

View File

@@ -0,0 +1,50 @@
package org.wfc.user.service;
import org.wfc.user.api.domain.UOperLog;
import java.util.List;
/**
* 操作日志 服务层
*
* @author wfc
*/
public interface IUOperLogService
{
/**
* 新增操作日志
*
* @param operLog 操作日志对象
* @return 结果
*/
public int insertOperlog(UOperLog operLog);
/**
* 查询系统操作日志集合
*
* @param operLog 操作日志对象
* @return 操作日志集合
*/
public List<UOperLog> selectOperLogList(UOperLog operLog);
/**
* 批量删除系统操作日志
*
* @param operIds 需要删除的操作日志ID
* @return 结果
*/
public int deleteOperLogByIds(Long[] operIds);
/**
* 查询操作日志详细
*
* @param operId 操作ID
* @return 操作日志对象
*/
public UOperLog selectOperLogById(Long operId);
/**
* 清空操作日志
*/
public void cleanOperLog();
}

View File

@@ -0,0 +1,29 @@
package org.wfc.user.service;
import org.wfc.user.api.domain.UUser;
import java.util.Set;
/**
* 权限信息 服务层
*
* @author wfc
*/
public interface IUPermissionService
{
/**
* 获取角色数据权限
*
* @param user 用户
* @return 角色权限信息
*/
public Set<String> getRolePermission(UUser user);
/**
* 获取菜单数据权限
*
* @param user 用户Id
* @return 菜单权限信息
*/
public Set<String> getMenuPermission(UUser user);
}

View File

@@ -0,0 +1,100 @@
package org.wfc.user.service;
import org.wfc.user.domain.UPost;
import java.util.List;
/**
* 岗位信息 服务层
*
* @author wfc
*/
public interface IUPostService
{
/**
* 查询岗位信息集合
*
* @param post 岗位信息
* @return 岗位列表
*/
public List<UPost> selectPostList(UPost post);
/**
* 查询所有岗位
*
* @return 岗位列表
*/
public List<UPost> selectPostAll();
/**
* 通过岗位ID查询岗位信息
*
* @param postId 岗位ID
* @return 角色对象信息
*/
public UPost selectPostById(Long postId);
/**
* 根据用户ID获取岗位选择框列表
*
* @param userId 用户ID
* @return 选中岗位ID列表
*/
public List<Long> selectPostListByUserId(Long userId);
/**
* 校验岗位名称
*
* @param post 岗位信息
* @return 结果
*/
public boolean checkPostNameUnique(UPost post);
/**
* 校验岗位编码
*
* @param post 岗位信息
* @return 结果
*/
public boolean checkPostCodeUnique(UPost post);
/**
* 通过岗位ID查询岗位使用数量
*
* @param postId 岗位ID
* @return 结果
*/
public int countUserPostById(Long postId);
/**
* 删除岗位信息
*
* @param postId 岗位ID
* @return 结果
*/
public int deletePostById(Long postId);
/**
* 批量删除岗位信息
*
* @param postIds 需要删除的岗位ID
* @return 结果
*/
public int deletePostByIds(Long[] postIds);
/**
* 新增保存岗位信息
*
* @param post 岗位信息
* @return 结果
*/
public int insertPost(UPost post);
/**
* 修改保存岗位信息
*
* @param post 岗位信息
* @return 结果
*/
public int updatePost(UPost post);
}

View File

@@ -0,0 +1,176 @@
package org.wfc.user.service;
import org.wfc.user.api.domain.URole;
import org.wfc.user.domain.UUserRole;
import java.util.List;
import java.util.Set;
/**
* 角色业务层
*
* @author wfc
*/
public interface IURoleService
{
/**
* 根据条件分页查询角色数据
*
* @param role 角色信息
* @return 角色数据集合信息
*/
public List<URole> selectRoleList(URole role);
/**
* 根据用户ID查询角色列表
*
* @param userId 用户ID
* @return 角色列表
*/
public List<URole> selectRolesByUserId(Long userId);
/**
* 根据用户ID查询角色权限
*
* @param userId 用户ID
* @return 权限列表
*/
public Set<String> selectRolePermissionByUserId(Long userId);
/**
* 查询所有角色
*
* @return 角色列表
*/
public List<URole> selectRoleAll();
/**
* 根据用户ID获取角色选择框列表
*
* @param userId 用户ID
* @return 选中角色ID列表
*/
public List<Long> selectRoleListByUserId(Long userId);
/**
* 通过角色ID查询角色
*
* @param roleId 角色ID
* @return 角色对象信息
*/
public URole selectRoleById(Long roleId);
/**
* 校验角色名称是否唯一
*
* @param role 角色信息
* @return 结果
*/
public boolean checkRoleNameUnique(URole role);
/**
* 校验角色权限是否唯一
*
* @param role 角色信息
* @return 结果
*/
public boolean checkRoleKeyUnique(URole role);
/**
* 校验角色是否允许操作
*
* @param role 角色信息
*/
public void checkRoleAllowed(URole role);
/**
* 校验角色是否有数据权限
*
* @param roleIds 角色id
*/
public void checkRoleDataScope(Long... roleIds);
/**
* 通过角色ID查询角色使用数量
*
* @param roleId 角色ID
* @return 结果
*/
public int countUserRoleByRoleId(Long roleId);
/**
* 新增保存角色信息
*
* @param role 角色信息
* @return 结果
*/
public int insertRole(URole role);
/**
* 修改保存角色信息
*
* @param role 角色信息
* @return 结果
*/
public int updateRole(URole role);
/**
* 修改角色状态
*
* @param role 角色信息
* @return 结果
*/
public int updateRoleStatus(URole role);
/**
* 修改数据权限信息
*
* @param role 角色信息
* @return 结果
*/
public int authDataScope(URole role);
/**
* 通过角色ID删除角色
*
* @param roleId 角色ID
* @return 结果
*/
public int deleteRoleById(Long roleId);
/**
* 批量删除角色信息
*
* @param roleIds 需要删除的角色ID
* @return 结果
*/
public int deleteRoleByIds(Long[] roleIds);
/**
* 取消授权用户角色
*
* @param userRole 用户和角色关联信息
* @return 结果
*/
public int deleteAuthUser(UUserRole userRole);
/**
* 批量取消授权用户角色
*
* @param roleId 角色ID
* @param userIds 需要取消授权的用户数据ID
* @return 结果
*/
public int deleteAuthUsers(Long roleId, Long[] userIds);
/**
* 批量选择授权用户角色
*
* @param roleId 角色ID
* @param userIds 需要删除的用户数据ID
* @return 结果
*/
public int insertAuthUsers(Long roleId, Long[] userIds);
}

View File

@@ -0,0 +1,48 @@
package org.wfc.user.service;
import org.wfc.common.core.domain.LoginUser;
import org.wfc.user.domain.UUserOnline;
/**
* 在线用户 服务层
*
* @author wfc
*/
public interface IUUserOnlineService
{
/**
* 通过登录地址查询信息
*
* @param ipaddr 登录地址
* @param user 用户信息
* @return 在线用户信息
*/
public UUserOnline selectOnlineByIpaddr(String ipaddr, LoginUser user);
/**
* 通过用户名称查询信息
*
* @param userName 用户名称
* @param user 用户信息
* @return 在线用户信息
*/
public UUserOnline selectOnlineByUserName(String userName, LoginUser user);
/**
* 通过登录地址/用户名称查询信息
*
* @param ipaddr 登录地址
* @param userName 用户名称
* @param user 用户信息
* @return 在线用户信息
*/
public UUserOnline selectOnlineByInfo(String ipaddr, String userName, LoginUser user);
/**
* 设置在线用户信息
*
* @param user 用户信息
* @return 在线用户
*/
public UUserOnline loginUserToUserOnline(LoginUser user);
}

View File

@@ -1,61 +1,207 @@
package org.wfc.user.service;
import org.wfc.user.api.domain.UUser;
import java.util.List;
import org.wfc.user.domain.UUser;
/**
* 用户平台_用户信息Service接口
*
* 用户 业务层
*
* @author wfc
* @date 2024-11-25
*/
public interface IUUserService
{
/**
* 查询用户平台_用户信息
*
* @param userId 用户平台_用户信息主键
* @return 用户平台_用户信息
* 根据条件分页查询用户列表
*
* @param user 用户信息
* @return 用户信息集合信息
*/
public UUser selectUUserByUserId(Long userId);
public List<UUser> selectUserList(UUser user);
/**
* 查询用户平台_用户信息列表
*
* @param uUser 用户平台_用户信息
* @return 用户平台_用户信息集合
* 根据条件分页查询已分配用户角色列表
*
* @param user 用户信息
* @return 用户信息集合信息
*/
public List<UUser> selectUUserList(UUser uUser);
public List<UUser> selectAllocatedList(UUser user);
/**
* 新增用户平台_用户信息
*
* @param uUser 用户平台_用户信息
* 根据条件分页查询未分配用户角色列表
*
* @param user 用户信息
* @return 用户信息集合信息
*/
public List<UUser> selectUnallocatedList(UUser user);
/**
* 通过用户名查询用户
*
* @param userName 用户名
* @return 用户对象信息
*/
public UUser selectUserByUserName(String userName);
/**
* 通过用户ID查询用户
*
* @param userId 用户ID
* @return 用户对象信息
*/
public UUser selectUserById(Long userId);
/**
* 根据用户ID查询用户所属角色组
*
* @param userName 用户名
* @return 结果
*/
public int insertUUser(UUser uUser);
public String selectUserRoleGroup(String userName);
/**
* 修改用户平台_用户信息
*
* @param uUser 用户平台_用户信息
* 根据用户ID查询用户所属岗位组
*
* @param userName 用户名
* @return 结果
*/
public int updateUUser(UUser uUser);
public String selectUserPostGroup(String userName);
/**
* 批量删除用户平台_用户信息
*
* @param userIds 需要删除的用户平台_用户信息主键集合
* 校验用户名称是否唯一
*
* @param user 用户信息
* @return 结果
*/
public int deleteUUserByUserIds(Long[] userIds);
public boolean checkUserNameUnique(UUser user);
/**
* 删除用户平台_用户信息信息
* 校验手机号码是否唯一
*
* @param userId 用户平台_用户信息主键
* @param user 用户信息
* @return 结果
*/
public int deleteUUserByUserId(Long userId);
public boolean checkPhoneUnique(UUser user);
/**
* 校验email是否唯一
*
* @param user 用户信息
* @return 结果
*/
public boolean checkEmailUnique(UUser user);
/**
* 校验用户是否允许操作
*
* @param user 用户信息
*/
public void checkUserAllowed(UUser user);
/**
* 校验用户是否有数据权限
*
* @param userId 用户id
*/
public void checkUserDataScope(Long userId);
/**
* 新增用户信息
*
* @param user 用户信息
* @return 结果
*/
public int insertUser(UUser user);
/**
* 注册用户信息
*
* @param user 用户信息
* @return 结果
*/
public boolean registerUser(UUser user);
/**
* 修改用户信息
*
* @param user 用户信息
* @return 结果
*/
public int updateUser(UUser user);
/**
* 用户授权角色
*
* @param userId 用户ID
* @param roleIds 角色组
*/
public void insertUserAuth(Long userId, Long[] roleIds);
/**
* 修改用户状态
*
* @param user 用户信息
* @return 结果
*/
public int updateUserStatus(UUser user);
/**
* 修改用户基本信息
*
* @param user 用户信息
* @return 结果
*/
public boolean updateUserProfile(UUser user);
/**
* 修改用户头像
*
* @param userName 用户名
* @param avatar 头像地址
* @return 结果
*/
public boolean updateUserAvatar(String userName, String avatar);
/**
* 重置用户密码
*
* @param user 用户信息
* @return 结果
*/
public int resetPwd(UUser user);
/**
* 重置用户密码
*
* @param userName 用户名
* @param password 密码
* @return 结果
*/
public int resetUserPwd(String userName, String password);
/**
* 通过用户ID删除用户
*
* @param userId 用户ID
* @return 结果
*/
public int deleteUserById(Long userId);
/**
* 批量删除用户信息
*
* @param userIds 需要删除的用户ID
* @return 结果
*/
public int deleteUserByIds(Long[] userIds);
/**
* 导入用户数据
*
* @param userList 用户数据列表
* @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据
* @param operName 操作用户
* @return 结果
*/
public String importUser(List<UUser> userList, Boolean isUpdateSupport, String operName);
}

View File

@@ -1,96 +0,0 @@
package org.wfc.user.service.impl;
import java.util.List;
import org.wfc.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.wfc.user.mapper.UUserMapper;
import org.wfc.user.domain.UUser;
import org.wfc.user.service.IUUserService;
/**
* 用户平台_用户信息Service业务层处理
*
* @author wfc
* @date 2024-11-25
*/
@Service
public class UUserServiceImpl implements IUUserService
{
@Autowired
private UUserMapper uUserMapper;
/**
* 查询用户平台_用户信息
*
* @param userId 用户平台_用户信息主键
* @return 用户平台_用户信息
*/
@Override
public UUser selectUUserByUserId(Long userId)
{
return uUserMapper.selectUUserByUserId(userId);
}
/**
* 查询用户平台_用户信息列表
*
* @param uUser 用户平台_用户信息
* @return 用户平台_用户信息
*/
@Override
public List<UUser> selectUUserList(UUser uUser)
{
return uUserMapper.selectUUserList(uUser);
}
/**
* 新增用户平台_用户信息
*
* @param uUser 用户平台_用户信息
* @return 结果
*/
@Override
public int insertUUser(UUser uUser)
{
uUser.setCreateTime(DateUtils.getNowDate());
return uUserMapper.insertUUser(uUser);
}
/**
* 修改用户平台_用户信息
*
* @param uUser 用户平台_用户信息
* @return 结果
*/
@Override
public int updateUUser(UUser uUser)
{
uUser.setUpdateTime(DateUtils.getNowDate());
return uUserMapper.updateUUser(uUser);
}
/**
* 批量删除用户平台_用户信息
*
* @param userIds 需要删除的用户平台_用户信息主键
* @return 结果
*/
@Override
public int deleteUUserByUserIds(Long[] userIds)
{
return uUserMapper.deleteUUserByUserIds(userIds);
}
/**
* 删除用户平台_用户信息信息
*
* @param userId 用户平台_用户信息主键
* @return 结果
*/
@Override
public int deleteUUserByUserId(Long userId)
{
return uUserMapper.deleteUUserByUserId(userId);
}
}

View File

@@ -0,0 +1,214 @@
package org.wfc.user.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.wfc.common.core.constant.CacheConstants;
import org.wfc.common.core.constant.UserConstants;
import org.wfc.common.core.exception.ServiceException;
import org.wfc.common.core.text.Convert;
import org.wfc.common.core.utils.StringUtils;
import org.wfc.common.redis.service.RedisService;
import org.wfc.user.domain.UConfig;
import org.wfc.user.mapper.UConfigMapper;
import org.wfc.user.service.IUConfigService;
import javax.annotation.PostConstruct;
import java.util.Collection;
import java.util.List;
/**
* 参数配置 服务层实现
*
* @author wfc
*/
@Service
public class UConfigServiceImpl implements IUConfigService
{
@Autowired
private UConfigMapper configMapper;
@Autowired
private RedisService redisService;
/**
* 项目启动时,初始化参数到缓存
*/
@PostConstruct
public void init()
{
loadingConfigCache();
}
/**
* 查询参数配置信息
*
* @param configId 参数配置ID
* @return 参数配置信息
*/
@Override
public UConfig selectConfigById(Long configId)
{
UConfig config = new UConfig();
config.setConfigId(configId);
return configMapper.selectConfig(config);
}
/**
* 根据键名查询参数配置信息
*
* @param configKey 参数key
* @return 参数键值
*/
@Override
public String selectConfigByKey(String configKey)
{
String configValue = Convert.toStr(redisService.getCacheObject(getCacheKey(configKey)));
if (StringUtils.isNotEmpty(configValue))
{
return configValue;
}
UConfig config = new UConfig();
config.setConfigKey(configKey);
UConfig retConfig = configMapper.selectConfig(config);
if (StringUtils.isNotNull(retConfig))
{
redisService.setCacheObject(getCacheKey(configKey), retConfig.getConfigValue());
return retConfig.getConfigValue();
}
return StringUtils.EMPTY;
}
/**
* 查询参数配置列表
*
* @param config 参数配置信息
* @return 参数配置集合
*/
@Override
public List<UConfig> selectConfigList(UConfig config)
{
return configMapper.selectConfigList(config);
}
/**
* 新增参数配置
*
* @param config 参数配置信息
* @return 结果
*/
@Override
public int insertConfig(UConfig config)
{
int row = configMapper.insertConfig(config);
if (row > 0)
{
redisService.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
}
return row;
}
/**
* 修改参数配置
*
* @param config 参数配置信息
* @return 结果
*/
@Override
public int updateConfig(UConfig config)
{
UConfig temp = configMapper.selectConfigById(config.getConfigId());
if (!StringUtils.equals(temp.getConfigKey(), config.getConfigKey()))
{
redisService.deleteObject(getCacheKey(temp.getConfigKey()));
}
int row = configMapper.updateConfig(config);
if (row > 0)
{
redisService.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
}
return row;
}
/**
* 批量删除参数信息
*
* @param configIds 需要删除的参数ID
*/
@Override
public void deleteConfigByIds(Long[] configIds)
{
for (Long configId : configIds)
{
UConfig config = selectConfigById(configId);
if (StringUtils.equals(UserConstants.YES, config.getConfigType()))
{
throw new ServiceException(String.format("内置参数【%1$s】不能删除 ", config.getConfigKey()));
}
configMapper.deleteConfigById(configId);
redisService.deleteObject(getCacheKey(config.getConfigKey()));
}
}
/**
* 加载参数缓存数据
*/
@Override
public void loadingConfigCache()
{
List<UConfig> configsList = configMapper.selectConfigList(new UConfig());
for (UConfig config : configsList)
{
redisService.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
}
}
/**
* 清空参数缓存数据
*/
@Override
public void clearConfigCache()
{
Collection<String> keys = redisService.keys(CacheConstants.SYS_CONFIG_KEY + "*");
redisService.deleteObject(keys);
}
/**
* 重置参数缓存数据
*/
@Override
public void resetConfigCache()
{
clearConfigCache();
loadingConfigCache();
}
/**
* 校验参数键名是否唯一
*
* @param config 参数配置信息
* @return 结果
*/
@Override
public boolean checkConfigKeyUnique(UConfig config)
{
Long configId = StringUtils.isNull(config.getConfigId()) ? -1L : config.getConfigId();
UConfig info = configMapper.checkConfigKeyUnique(config.getConfigKey());
if (StringUtils.isNotNull(info) && info.getConfigId().longValue() != configId.longValue())
{
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
}
/**
* 设置cache key
*
* @param configKey 参数键
* @return 缓存键key
*/
private String getCacheKey(String configKey)
{
return CacheConstants.SYS_CONFIG_KEY + configKey;
}
}

View File

@@ -0,0 +1,337 @@
package org.wfc.user.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.wfc.common.core.constant.UserConstants;
import org.wfc.common.core.exception.ServiceException;
import org.wfc.common.core.text.Convert;
import org.wfc.common.core.utils.SpringUtils;
import org.wfc.common.core.utils.StringUtils;
import org.wfc.common.security.utils.SecurityUtils;
import org.wfc.user.api.domain.UDept;
import org.wfc.user.api.domain.URole;
import org.wfc.user.api.domain.UUser;
import org.wfc.user.domain.vo.TreeSelect;
import org.wfc.user.mapper.UDeptMapper;
import org.wfc.user.mapper.URoleMapper;
import org.wfc.user.service.IUDeptService;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
/**
* 部门管理 服务实现
*
* @author wfc
*/
@Service
public class UDeptServiceImpl implements IUDeptService
{
@Autowired
private UDeptMapper deptMapper;
@Autowired
private URoleMapper roleMapper;
/**
* 查询部门管理数据
*
* @param dept 部门信息
* @return 部门信息集合
*/
@Override
public List<UDept> selectDeptList(UDept dept)
{
return deptMapper.selectDeptList(dept);
}
/**
* 查询部门树结构信息
*
* @param dept 部门信息
* @return 部门树信息集合
*/
@Override
public List<TreeSelect> selectDeptTreeList(UDept dept)
{
List<UDept> depts = SpringUtils.getAopProxy(this).selectDeptList(dept);
return buildDeptTreeSelect(depts);
}
/**
* 构建前端所需要树结构
*
* @param depts 部门列表
* @return 树结构列表
*/
@Override
public List<UDept> buildDeptTree(List<UDept> depts)
{
List<UDept> returnList = new ArrayList<UDept>();
List<Long> tempList = depts.stream().map(UDept::getDeptId).collect(Collectors.toList());
for (UDept dept : depts)
{
// 如果是顶级节点, 遍历该父节点的所有子节点
if (!tempList.contains(dept.getParentId()))
{
recursionFn(depts, dept);
returnList.add(dept);
}
}
if (returnList.isEmpty())
{
returnList = depts;
}
return returnList;
}
/**
* 构建前端所需要下拉树结构
*
* @param depts 部门列表
* @return 下拉树结构列表
*/
@Override
public List<TreeSelect> buildDeptTreeSelect(List<UDept> depts)
{
List<UDept> deptTrees = buildDeptTree(depts);
return deptTrees.stream().map(TreeSelect::new).collect(Collectors.toList());
}
/**
* 根据角色ID查询部门树信息
*
* @param roleId 角色ID
* @return 选中部门列表
*/
@Override
public List<Long> selectDeptListByRoleId(Long roleId)
{
URole role = roleMapper.selectRoleById(roleId);
return deptMapper.selectDeptListByRoleId(roleId, role.isDeptCheckStrictly());
}
/**
* 根据部门ID查询信息
*
* @param deptId 部门ID
* @return 部门信息
*/
@Override
public UDept selectDeptById(Long deptId)
{
return deptMapper.selectDeptById(deptId);
}
/**
* 根据ID查询所有子部门正常状态
*
* @param deptId 部门ID
* @return 子部门数
*/
@Override
public int selectNormalChildrenDeptById(Long deptId)
{
return deptMapper.selectNormalChildrenDeptById(deptId);
}
/**
* 是否存在子节点
*
* @param deptId 部门ID
* @return 结果
*/
@Override
public boolean hasChildByDeptId(Long deptId)
{
int result = deptMapper.hasChildByDeptId(deptId);
return result > 0;
}
/**
* 查询部门是否存在用户
*
* @param deptId 部门ID
* @return 结果 true 存在 false 不存在
*/
@Override
public boolean checkDeptExistUser(Long deptId)
{
int result = deptMapper.checkDeptExistUser(deptId);
return result > 0;
}
/**
* 校验部门名称是否唯一
*
* @param dept 部门信息
* @return 结果
*/
@Override
public boolean checkDeptNameUnique(UDept dept)
{
Long deptId = StringUtils.isNull(dept.getDeptId()) ? -1L : dept.getDeptId();
UDept info = deptMapper.checkDeptNameUnique(dept.getDeptName(), dept.getParentId());
if (StringUtils.isNotNull(info) && info.getDeptId().longValue() != deptId.longValue())
{
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
}
/**
* 校验部门是否有数据权限
*
* @param deptId 部门id
*/
@Override
public void checkDeptDataScope(Long deptId)
{
if (!UUser.isAdmin(SecurityUtils.getUserId()) && StringUtils.isNotNull(deptId))
{
UDept dept = new UDept();
dept.setDeptId(deptId);
List<UDept> depts = SpringUtils.getAopProxy(this).selectDeptList(dept);
if (StringUtils.isEmpty(depts))
{
throw new ServiceException("没有权限访问部门数据!");
}
}
}
/**
* 新增保存部门信息
*
* @param dept 部门信息
* @return 结果
*/
@Override
public int insertDept(UDept dept)
{
UDept info = deptMapper.selectDeptById(dept.getParentId());
// 如果父节点不为正常状态,则不允许新增子节点
if (!UserConstants.DEPT_NORMAL.equals(info.getStatus()))
{
throw new ServiceException("部门停用,不允许新增");
}
dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
return deptMapper.insertDept(dept);
}
/**
* 修改保存部门信息
*
* @param dept 部门信息
* @return 结果
*/
@Override
public int updateDept(UDept dept)
{
UDept newParentDept = deptMapper.selectDeptById(dept.getParentId());
UDept oldDept = deptMapper.selectDeptById(dept.getDeptId());
if (StringUtils.isNotNull(newParentDept) && StringUtils.isNotNull(oldDept))
{
String newAncestors = newParentDept.getAncestors() + "," + newParentDept.getDeptId();
String oldAncestors = oldDept.getAncestors();
dept.setAncestors(newAncestors);
updateDeptChildren(dept.getDeptId(), newAncestors, oldAncestors);
}
int result = deptMapper.updateDept(dept);
if (UserConstants.DEPT_NORMAL.equals(dept.getStatus()) && StringUtils.isNotEmpty(dept.getAncestors())
&& !StringUtils.equals("0", dept.getAncestors()))
{
// 如果该部门是启用状态,则启用该部门的所有上级部门
updateParentDeptStatusNormal(dept);
}
return result;
}
/**
* 修改该部门的父级部门状态
*
* @param dept 当前部门
*/
private void updateParentDeptStatusNormal(UDept dept)
{
String ancestors = dept.getAncestors();
Long[] deptIds = Convert.toLongArray(ancestors);
deptMapper.updateDeptStatusNormal(deptIds);
}
/**
* 修改子元素关系
*
* @param deptId 被修改的部门ID
* @param newAncestors 新的父ID集合
* @param oldAncestors 旧的父ID集合
*/
public void updateDeptChildren(Long deptId, String newAncestors, String oldAncestors)
{
List<UDept> children = deptMapper.selectChildrenDeptById(deptId);
for (UDept child : children)
{
child.setAncestors(child.getAncestors().replaceFirst(oldAncestors, newAncestors));
}
if (children.size() > 0)
{
deptMapper.updateDeptChildren(children);
}
}
/**
* 删除部门管理信息
*
* @param deptId 部门ID
* @return 结果
*/
@Override
public int deleteDeptById(Long deptId)
{
return deptMapper.deleteDeptById(deptId);
}
/**
* 递归列表
*/
private void recursionFn(List<UDept> list, UDept t)
{
// 得到子节点列表
List<UDept> childList = getChildList(list, t);
t.setChildren(childList);
for (UDept tChild : childList)
{
if (hasChild(list, tChild))
{
recursionFn(list, tChild);
}
}
}
/**
* 得到子节点列表
*/
private List<UDept> getChildList(List<UDept> list, UDept t)
{
List<UDept> tlist = new ArrayList<UDept>();
Iterator<UDept> it = list.iterator();
while (it.hasNext())
{
UDept n = (UDept) it.next();
if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getDeptId().longValue())
{
tlist.add(n);
}
}
return tlist;
}
/**
* 判断是否有子节点
*/
private boolean hasChild(List<UDept> list, UDept t)
{
return getChildList(list, t).size() > 0 ? true : false;
}
}

View File

@@ -0,0 +1,112 @@
package org.wfc.user.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.wfc.common.security.utils.DictUtils;
import org.wfc.user.api.domain.UDictData;
import org.wfc.user.mapper.UDictDataMapper;
import org.wfc.user.service.IUDictDataService;
import java.util.List;
/**
* 字典 业务层处理
*
* @author wfc
*/
@Service
public class UDictDataServiceImpl implements IUDictDataService
{
@Autowired
private UDictDataMapper dictDataMapper;
/**
* 根据条件分页查询字典数据
*
* @param dictData 字典数据信息
* @return 字典数据集合信息
*/
@Override
public List<UDictData> selectDictDataList(UDictData dictData)
{
return dictDataMapper.selectDictDataList(dictData);
}
/**
* 根据字典类型和字典键值查询字典数据信息
*
* @param dictType 字典类型
* @param dictValue 字典键值
* @return 字典标签
*/
@Override
public String selectDictLabel(String dictType, String dictValue)
{
return dictDataMapper.selectDictLabel(dictType, dictValue);
}
/**
* 根据字典数据ID查询信息
*
* @param dictCode 字典数据ID
* @return 字典数据
*/
@Override
public UDictData selectDictDataById(Long dictCode)
{
return dictDataMapper.selectDictDataById(dictCode);
}
/**
* 批量删除字典数据信息
*
* @param dictCodes 需要删除的字典数据ID
*/
@Override
public void deleteDictDataByIds(Long[] dictCodes)
{
for (Long dictCode : dictCodes)
{
UDictData data = selectDictDataById(dictCode);
dictDataMapper.deleteDictDataById(dictCode);
List<UDictData> dictDatas = dictDataMapper.selectDictDataByType(data.getDictType());
DictUtils.setDictCache(data.getDictType(), dictDatas);
}
}
/**
* 新增保存字典数据信息
*
* @param data 字典数据信息
* @return 结果
*/
@Override
public int insertDictData(UDictData data)
{
int row = dictDataMapper.insertDictData(data);
if (row > 0)
{
List<UDictData> dictDatas = dictDataMapper.selectDictDataByType(data.getDictType());
DictUtils.setDictCache(data.getDictType(), dictDatas);
}
return row;
}
/**
* 修改保存字典数据信息
*
* @param data 字典数据信息
* @return 结果
*/
@Override
public int updateDictData(UDictData data)
{
int row = dictDataMapper.updateDictData(data);
if (row > 0)
{
List<UDictData> dictDatas = dictDataMapper.selectDictDataByType(data.getDictType());
DictUtils.setDictCache(data.getDictType(), dictDatas);
}
return row;
}
}

View File

@@ -0,0 +1,224 @@
package org.wfc.user.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.wfc.common.core.constant.UserConstants;
import org.wfc.common.core.exception.ServiceException;
import org.wfc.common.core.utils.StringUtils;
import org.wfc.common.security.utils.DictUtils;
import org.wfc.user.api.domain.UDictData;
import org.wfc.user.api.domain.UDictType;
import org.wfc.user.mapper.UDictDataMapper;
import org.wfc.user.mapper.UDictTypeMapper;
import org.wfc.user.service.IUDictTypeService;
import javax.annotation.PostConstruct;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 字典 业务层处理
*
* @author wfc
*/
@Service
public class UDictTypeServiceImpl implements IUDictTypeService
{
@Autowired
private UDictTypeMapper dictTypeMapper;
@Autowired
private UDictDataMapper dictDataMapper;
/**
* 项目启动时,初始化字典到缓存
*/
@PostConstruct
public void init()
{
loadingDictCache();
}
/**
* 根据条件分页查询字典类型
*
* @param dictType 字典类型信息
* @return 字典类型集合信息
*/
@Override
public List<UDictType> selectDictTypeList(UDictType dictType)
{
return dictTypeMapper.selectDictTypeList(dictType);
}
/**
* 根据所有字典类型
*
* @return 字典类型集合信息
*/
@Override
public List<UDictType> selectDictTypeAll()
{
return dictTypeMapper.selectDictTypeAll();
}
/**
* 根据字典类型查询字典数据
*
* @param dictType 字典类型
* @return 字典数据集合信息
*/
@Override
public List<UDictData> selectDictDataByType(String dictType)
{
List<UDictData> dictDatas = DictUtils.getDictCache(dictType, UDictData.class);
if (StringUtils.isNotEmpty(dictDatas))
{
return dictDatas;
}
dictDatas = dictDataMapper.selectDictDataByType(dictType);
if (StringUtils.isNotEmpty(dictDatas))
{
DictUtils.setDictCache(dictType, dictDatas);
return dictDatas;
}
return null;
}
/**
* 根据字典类型ID查询信息
*
* @param dictId 字典类型ID
* @return 字典类型
*/
@Override
public UDictType selectDictTypeById(Long dictId)
{
return dictTypeMapper.selectDictTypeById(dictId);
}
/**
* 根据字典类型查询信息
*
* @param dictType 字典类型
* @return 字典类型
*/
@Override
public UDictType selectDictTypeByType(String dictType)
{
return dictTypeMapper.selectDictTypeByType(dictType);
}
/**
* 批量删除字典类型信息
*
* @param dictIds 需要删除的字典ID
*/
@Override
public void deleteDictTypeByIds(Long[] dictIds)
{
for (Long dictId : dictIds)
{
UDictType dictType = selectDictTypeById(dictId);
if (dictDataMapper.countDictDataByType(dictType.getDictType()) > 0)
{
throw new ServiceException(String.format("%1$s已分配,不能删除", dictType.getDictName()));
}
dictTypeMapper.deleteDictTypeById(dictId);
DictUtils.removeDictCache(dictType.getDictType());
}
}
/**
* 加载字典缓存数据
*/
@Override
public void loadingDictCache()
{
UDictData dictData = new UDictData();
dictData.setStatus("0");
Map<String, List<UDictData>> dictDataMap = dictDataMapper.selectDictDataList(dictData).stream().collect(Collectors.groupingBy(UDictData::getDictType));
for (Map.Entry<String, List<UDictData>> entry : dictDataMap.entrySet())
{
DictUtils.setDictCache(entry.getKey(), entry.getValue().stream().sorted(Comparator.comparing(UDictData::getDictSort)).collect(Collectors.toList()));
}
}
/**
* 清空字典缓存数据
*/
@Override
public void clearDictCache()
{
DictUtils.clearDictCache();
}
/**
* 重置字典缓存数据
*/
@Override
public void resetDictCache()
{
clearDictCache();
loadingDictCache();
}
/**
* 新增保存字典类型信息
*
* @param dict 字典类型信息
* @return 结果
*/
@Override
public int insertDictType(UDictType dict)
{
int row = dictTypeMapper.insertDictType(dict);
if (row > 0)
{
DictUtils.setDictCache(dict.getDictType(), null);
}
return row;
}
/**
* 修改保存字典类型信息
*
* @param dict 字典类型信息
* @return 结果
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int updateDictType(UDictType dict)
{
UDictType oldDict = dictTypeMapper.selectDictTypeById(dict.getDictId());
dictDataMapper.updateDictDataType(oldDict.getDictType(), dict.getDictType());
int row = dictTypeMapper.updateDictType(dict);
if (row > 0)
{
List<UDictData> dictDatas = dictDataMapper.selectDictDataByType(dict.getDictType());
DictUtils.setDictCache(dict.getDictType(), dictDatas);
}
return row;
}
/**
* 校验字典类型称是否唯一
*
* @param dict 字典类型
* @return 结果
*/
@Override
public boolean checkDictTypeUnique(UDictType dict)
{
Long dictId = StringUtils.isNull(dict.getDictId()) ? -1L : dict.getDictId();
UDictType dictType = dictTypeMapper.checkDictTypeUnique(dict.getDictType());
if (StringUtils.isNotNull(dictType) && dictType.getDictId().longValue() != dictId.longValue())
{
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
}
}

View File

@@ -0,0 +1,66 @@
package org.wfc.user.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.wfc.user.api.domain.ULogininfor;
import org.wfc.user.mapper.ULogininforMapper;
import org.wfc.user.service.IULogininforService;
import java.util.List;
/**
* 系统访问日志情况信息 服务层处理
*
* @author wfc
*/
@Service
public class ULogininforServiceImpl implements IULogininforService
{
@Autowired
private ULogininforMapper logininforMapper;
/**
* 新增系统登录日志
*
* @param logininfor 访问日志对象
*/
@Override
public int insertLogininfor(ULogininfor logininfor)
{
return logininforMapper.insertLogininfor(logininfor);
}
/**
* 查询系统登录日志集合
*
* @param logininfor 访问日志对象
* @return 登录记录集合
*/
@Override
public List<ULogininfor> selectLogininforList(ULogininfor logininfor)
{
return logininforMapper.selectLogininforList(logininfor);
}
/**
* 批量删除系统登录日志
*
* @param infoIds 需要删除的登录日志ID
* @return 结果
*/
@Override
public int deleteLogininforByIds(Long[] infoIds)
{
return logininforMapper.deleteLogininforByIds(infoIds);
}
/**
* 清空系统登录日志
*/
@Override
public void cleanLogininfor()
{
logininforMapper.cleanLogininfor();
}
}

View File

@@ -0,0 +1,516 @@
package org.wfc.user.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.wfc.common.core.constant.Constants;
import org.wfc.common.core.constant.UserConstants;
import org.wfc.common.core.utils.StringUtils;
import org.wfc.common.security.utils.SecurityUtils;
import org.wfc.user.api.domain.URole;
import org.wfc.user.api.domain.UUser;
import org.wfc.user.domain.UMenu;
import org.wfc.user.domain.vo.MetaVo;
import org.wfc.user.domain.vo.RouterVo;
import org.wfc.user.domain.vo.TreeSelect;
import org.wfc.user.mapper.UMenuMapper;
import org.wfc.user.mapper.URoleMapper;
import org.wfc.user.mapper.URoleMenuMapper;
import org.wfc.user.service.IUMenuService;
import java.util.*;
import java.util.stream.Collectors;
/**
* 菜单 业务层处理
*
* @author wfc
*/
@Service
public class UMenuServiceImpl implements IUMenuService
{
public static final String PREMISSION_STRING = "perms[\"{0}\"]";
@Autowired
private UMenuMapper menuMapper;
@Autowired
private URoleMapper roleMapper;
@Autowired
private URoleMenuMapper roleMenuMapper;
/**
* 根据用户查询系统菜单列表
*
* @param userId 用户ID
* @return 菜单列表
*/
@Override
public List<UMenu> selectMenuList(Long userId)
{
return selectMenuList(new UMenu(), userId);
}
/**
* 查询系统菜单列表
*
* @param menu 菜单信息
* @return 菜单列表
*/
@Override
public List<UMenu> selectMenuList(UMenu menu, Long userId)
{
List<UMenu> menuList;
// 管理员显示所有菜单信息
if (UUser.isAdmin(userId))
{
menuList = menuMapper.selectMenuList(menu);
}
else
{
menu.getParams().put("userId", userId);
menuList = menuMapper.selectMenuListByUserId(menu);
}
return menuList;
}
/**
* 根据用户ID查询权限
*
* @param userId 用户ID
* @return 权限列表
*/
@Override
public Set<String> selectMenuPermsByUserId(Long userId)
{
List<String> perms = menuMapper.selectMenuPermsByUserId(userId);
Set<String> permsSet = new HashSet<>();
for (String perm : perms)
{
if (StringUtils.isNotEmpty(perm))
{
permsSet.addAll(Arrays.asList(perm.trim().split(",")));
}
}
return permsSet;
}
/**
* 根据角色ID查询权限
*
* @param roleId 角色ID
* @return 权限列表
*/
@Override
public Set<String> selectMenuPermsByRoleId(Long roleId)
{
List<String> perms = menuMapper.selectMenuPermsByRoleId(roleId);
Set<String> permsSet = new HashSet<>();
for (String perm : perms)
{
if (StringUtils.isNotEmpty(perm))
{
permsSet.addAll(Arrays.asList(perm.trim().split(",")));
}
}
return permsSet;
}
/**
* 根据用户ID查询菜单
*
* @param userId 用户名称
* @return 菜单列表
*/
@Override
public List<UMenu> selectMenuTreeByUserId(Long userId)
{
List<UMenu> menus = null;
if (SecurityUtils.isAdmin(userId))
{
menus = menuMapper.selectMenuTreeAll();
}
else
{
menus = menuMapper.selectMenuTreeByUserId(userId);
}
return getChildPerms(menus, 0);
}
/**
* 根据角色ID查询菜单树信息
*
* @param roleId 角色ID
* @return 选中菜单列表
*/
@Override
public List<Long> selectMenuListByRoleId(Long roleId)
{
URole role = roleMapper.selectRoleById(roleId);
return menuMapper.selectMenuListByRoleId(roleId, role.isMenuCheckStrictly());
}
/**
* 构建前端路由所需要的菜单
*
* @param menus 菜单列表
* @return 路由列表
*/
@Override
public List<RouterVo> buildMenus(List<UMenu> menus)
{
List<RouterVo> routers = new LinkedList<>();
for (UMenu menu : menus)
{
RouterVo router = new RouterVo();
router.setHideInMenu("1".equals(menu.getVisible()));
router.setName(menu.getName());
router.setPath(getRouterPath(menu));
router.setComponent(getComponent(menu));
router.setQuery(menu.getQuery());
router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath()));
List<UMenu> cMenus = menu.getChildren();
if (StringUtils.isNotEmpty(cMenus) && UserConstants.TYPE_DIR.equals(menu.getMenuType()))
{
router.setAlwaysShow(true);
router.setRedirect("noRedirect");
router.setChildren(buildMenus(cMenus));
}
else if (isMenuFrame(menu))
{
router.setMeta(null);
List<RouterVo> childrenList = new ArrayList<RouterVo>();
RouterVo children = new RouterVo();
children.setPath(menu.getPath());
children.setComponent(menu.getComponent());
children.setName(menu.getName());
children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath()));
children.setQuery(menu.getQuery());
childrenList.add(children);
router.setChildren(childrenList);
}
else if (menu.getParentId().intValue() == 0 && isInnerLink(menu))
{
router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon()));
router.setPath("/");
List<RouterVo> childrenList = new ArrayList<RouterVo>();
RouterVo children = new RouterVo();
String routerPath = innerLinkReplaceEach(menu.getPath());
children.setPath(routerPath);
children.setComponent(UserConstants.INNER_LINK);
children.setName(menu.getName());
children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), menu.getPath()));
childrenList.add(children);
router.setChildren(childrenList);
}
routers.add(router);
}
return routers;
}
/**
* 构建前端所需要树结构
*
* @param menus 菜单列表
* @return 树结构列表
*/
@Override
public List<UMenu> buildMenuTree(List<UMenu> menus)
{
List<UMenu> returnList = new ArrayList<>();
List<Long> tempList = menus.stream().map(UMenu::getMenuId).collect(Collectors.toList());
for (UMenu menu : menus) {
// 如果是顶级节点, 遍历该父节点的所有子节点
if (!tempList.contains(menu.getParentId())) {
recursionFn(menus, menu);
returnList.add(menu);
}
}
if (returnList.isEmpty())
{
returnList = menus;
}
return returnList;
}
/**
* 构建前端所需要下拉树结构
*
* @param menus 菜单列表
* @return 下拉树结构列表
*/
@Override
public List<TreeSelect> buildMenuTreeSelect(List<UMenu> menus)
{
List<UMenu> menuTrees = buildMenuTree(menus);
return menuTrees.stream().map(TreeSelect::new).collect(Collectors.toList());
}
/**
* 根据菜单ID查询信息
*
* @param menuId 菜单ID
* @return 菜单信息
*/
@Override
public UMenu selectMenuById(Long menuId)
{
return menuMapper.selectMenuById(menuId);
}
/**
* 是否存在菜单子节点
*
* @param menuId 菜单ID
* @return 结果
*/
@Override
public boolean hasChildByMenuId(Long menuId)
{
int result = menuMapper.hasChildByMenuId(menuId);
return result > 0;
}
/**
* 查询菜单使用数量
*
* @param menuId 菜单ID
* @return 结果
*/
@Override
public boolean checkMenuExistRole(Long menuId)
{
int result = roleMenuMapper.checkMenuExistRole(menuId);
return result > 0;
}
/**
* 新增保存菜单信息
*
* @param menu 菜单信息
* @return 结果
*/
@Override
public int insertMenu(UMenu menu)
{
return menuMapper.insertMenu(menu);
}
/**
* 修改保存菜单信息
*
* @param menu 菜单信息
* @return 结果
*/
@Override
public int updateMenu(UMenu menu)
{
return menuMapper.updateMenu(menu);
}
/**
* 删除菜单管理信息
*
* @param menuId 菜单ID
* @return 结果
*/
@Override
public int deleteMenuById(Long menuId)
{
return menuMapper.deleteMenuById(menuId);
}
/**
* 校验菜单名称是否唯一
*
* @param menu 菜单信息
* @return 结果
*/
@Override
public boolean checkMenuNameUnique(UMenu menu)
{
Long menuId = StringUtils.isNull(menu.getMenuId()) ? -1L : menu.getMenuId();
UMenu info = menuMapper.checkMenuNameUnique(menu.getMenuName(), menu.getParentId());
if (StringUtils.isNotNull(info) && info.getMenuId().longValue() != menuId.longValue())
{
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
}
/**
* 获取路由名称
*
* @param menu 菜单信息
* @return 路由名称
*/
public String getRouteName(UMenu menu)
{
String routerName = StringUtils.capitalize(menu.getName());
// 非外链并且是一级目录(类型为目录)
if (isMenuFrame(menu))
{
routerName = StringUtils.EMPTY;
}
return routerName;
}
/**
* 获取路由地址
*
* @param menu 菜单信息
* @return 路由地址
*/
public String getRouterPath(UMenu menu)
{
String routerPath = menu.getPath();
// 内链打开外网方式
if (menu.getParentId().intValue() != 0 && isInnerLink(menu))
{
routerPath = innerLinkReplaceEach(routerPath);
}
// 非外链并且是一级目录(类型为目录)
if (0 == menu.getParentId().intValue() && UserConstants.TYPE_DIR.equals(menu.getMenuType())
&& UserConstants.NO_FRAME.equals(menu.getIsFrame()))
{
routerPath = menu.getPath();
}
// 非外链并且是一级目录(类型为菜单)
else if (isMenuFrame(menu))
{
routerPath = "/";
}
return routerPath;
}
/**
* 获取组件信息
*
* @param menu 菜单信息
* @return 组件信息
*/
public String getComponent(UMenu menu)
{
String component = UserConstants.LAYOUT;
if (StringUtils.isNotEmpty(menu.getComponent()) && !isMenuFrame(menu))
{
component = menu.getComponent();
}
else if (StringUtils.isEmpty(menu.getComponent()) && menu.getParentId().intValue() != 0 && isInnerLink(menu))
{
component = UserConstants.INNER_LINK;
}
else if (StringUtils.isEmpty(menu.getComponent()) && isParentView(menu))
{
component = UserConstants.PARENT_VIEW;
}
return component;
}
/**
* 是否为菜单内部跳转
*
* @param menu 菜单信息
* @return 结果
*/
public boolean isMenuFrame(UMenu menu)
{
return menu.getParentId().intValue() == 0 && UserConstants.TYPE_MENU.equals(menu.getMenuType())
&& menu.getIsFrame().equals(UserConstants.NO_FRAME);
}
/**
* 是否为内链组件
*
* @param menu 菜单信息
* @return 结果
*/
public boolean isInnerLink(UMenu menu)
{
return menu.getIsFrame().equals(UserConstants.NO_FRAME) && StringUtils.ishttp(menu.getPath());
}
/**
* 是否为parent_view组件
*
* @param menu 菜单信息
* @return 结果
*/
public boolean isParentView(UMenu menu)
{
return menu.getParentId().intValue() != 0 && UserConstants.TYPE_DIR.equals(menu.getMenuType());
}
/**
* 根据父节点的ID获取所有子节点
*
* @param list 分类表
* @param parentId 传入的父节点ID
* @return String
*/
public List<UMenu> getChildPerms(List<UMenu> list, int parentId)
{
List<UMenu> returnList = new ArrayList<>();
for (UMenu t : list) {
// 一、根据传入的某个父节点ID,遍历该父节点的所有子节点
if (t.getParentId() == parentId) {
recursionFn(list, t);
returnList.add(t);
}
}
return returnList;
}
/**
* 递归列表
*
* @param list 分类表
* @param t 子节点
*/
private void recursionFn(List<UMenu> list, UMenu t)
{
// 得到子节点列表
List<UMenu> childList = getChildList(list, t);
t.setChildren(childList);
for (UMenu tChild : childList)
{
if (hasChild(list, tChild))
{
recursionFn(list, tChild);
}
}
}
/**
* 得到子节点列表
*/
private List<UMenu> getChildList(List<UMenu> list, UMenu t)
{
List<UMenu> tlist = new ArrayList<UMenu>();
for (UMenu n : list) {
if (n.getParentId().longValue() == t.getMenuId().longValue()) {
tlist.add(n);
}
}
return tlist;
}
/**
* 判断是否有子节点
*/
private boolean hasChild(List<UMenu> list, UMenu t)
{
return !getChildList(list, t).isEmpty();
}
/**
* 内链域名特殊字符替换
*
* @return 替换后的内链域名
*/
public String innerLinkReplaceEach(String path)
{
return StringUtils.replaceEach(path, new String[] { Constants.HTTP, Constants.HTTPS, Constants.WWW, ".", ":" },
new String[] { "", "", "", "/", "/" });
}
}

View File

@@ -0,0 +1,78 @@
package org.wfc.user.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.wfc.user.api.domain.UOperLog;
import org.wfc.user.mapper.UOperLogMapper;
import org.wfc.user.service.IUOperLogService;
import java.util.List;
/**
* 操作日志 服务层处理
*
* @author wfc
*/
@Service
public class UOperLogServiceImpl implements IUOperLogService
{
@Autowired
private UOperLogMapper operLogMapper;
/**
* 新增操作日志
*
* @param operLog 操作日志对象
* @return 结果
*/
@Override
public int insertOperlog(UOperLog operLog)
{
return operLogMapper.insertOperlog(operLog);
}
/**
* 查询系统操作日志集合
*
* @param operLog 操作日志对象
* @return 操作日志集合
*/
@Override
public List<UOperLog> selectOperLogList(UOperLog operLog)
{
return operLogMapper.selectOperLogList(operLog);
}
/**
* 批量删除系统操作日志
*
* @param operIds 需要删除的操作日志ID
* @return 结果
*/
@Override
public int deleteOperLogByIds(Long[] operIds)
{
return operLogMapper.deleteOperLogByIds(operIds);
}
/**
* 查询操作日志详细
*
* @param operId 操作ID
* @return 操作日志对象
*/
@Override
public UOperLog selectOperLogById(Long operId)
{
return operLogMapper.selectOperLogById(operId);
}
/**
* 清空操作日志
*/
@Override
public void cleanOperLog()
{
operLogMapper.cleanOperLog();
}
}

View File

@@ -0,0 +1,92 @@
package org.wfc.user.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.wfc.common.core.constant.UserConstants;
import org.wfc.common.core.utils.StringUtils;
import org.wfc.user.api.domain.URole;
import org.wfc.user.api.domain.UUser;
import org.wfc.user.service.IUMenuService;
import org.wfc.user.service.IUPermissionService;
import org.wfc.user.service.IURoleService;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* 用户权限处理
*
* @author wfc
*/
@Service
public class UPermissionServiceImpl implements IUPermissionService
{
@Autowired
private IURoleService roleService;
@Autowired
private IUMenuService menuService;
/**
* 获取角色数据权限
*
* @param user 用户
* @return 角色权限信息
*/
@Override
public Set<String> getRolePermission(UUser user)
{
Set<String> roles = new HashSet<String>();
// 管理员拥有所有权限
if (user.isAdmin())
{
roles.add("admin");
}
else
{
roles.addAll(roleService.selectRolePermissionByUserId(user.getUserId()));
}
return roles;
}
/**
* 获取菜单数据权限
*
* @param user 用户
* @return 菜单权限信息
*/
@Override
public Set<String> getMenuPermission(UUser user)
{
Set<String> perms = new HashSet<String>();
// 管理员拥有所有权限
if (user.isAdmin())
{
perms.add("*:*:*");
}
else
{
List<URole> roles = user.getRoles();
if (!CollectionUtils.isEmpty(roles))
{
// 多角色设置permissions属性以便数据权限匹配权限
for (URole role : roles)
{
if (StringUtils.equals(role.getStatus(), UserConstants.ROLE_NORMAL))
{
Set<String> rolePerms = menuService.selectMenuPermsByRoleId(role.getRoleId());
role.setPermissions(rolePerms);
perms.addAll(rolePerms);
}
}
}
else
{
perms.addAll(menuService.selectMenuPermsByUserId(user.getUserId()));
}
}
return perms;
}
}

View File

@@ -0,0 +1,179 @@
package org.wfc.user.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.wfc.common.core.constant.UserConstants;
import org.wfc.common.core.exception.ServiceException;
import org.wfc.common.core.utils.StringUtils;
import org.wfc.user.domain.UPost;
import org.wfc.user.mapper.UPostMapper;
import org.wfc.user.mapper.UUserPostMapper;
import org.wfc.user.service.IUPostService;
import java.util.List;
/**
* 岗位信息 服务层处理
*
* @author wfc
*/
@Service
public class UPostServiceImpl implements IUPostService
{
@Autowired
private UPostMapper postMapper;
@Autowired
private UUserPostMapper userPostMapper;
/**
* 查询岗位信息集合
*
* @param post 岗位信息
* @return 岗位信息集合
*/
@Override
public List<UPost> selectPostList(UPost post)
{
return postMapper.selectPostList(post);
}
/**
* 查询所有岗位
*
* @return 岗位列表
*/
@Override
public List<UPost> selectPostAll()
{
return postMapper.selectPostAll();
}
/**
* 通过岗位ID查询岗位信息
*
* @param postId 岗位ID
* @return 角色对象信息
*/
@Override
public UPost selectPostById(Long postId)
{
return postMapper.selectPostById(postId);
}
/**
* 根据用户ID获取岗位选择框列表
*
* @param userId 用户ID
* @return 选中岗位ID列表
*/
@Override
public List<Long> selectPostListByUserId(Long userId)
{
return postMapper.selectPostListByUserId(userId);
}
/**
* 校验岗位名称是否唯一
*
* @param post 岗位信息
* @return 结果
*/
@Override
public boolean checkPostNameUnique(UPost post)
{
Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId();
UPost info = postMapper.checkPostNameUnique(post.getPostName());
if (StringUtils.isNotNull(info) && info.getPostId().longValue() != postId.longValue())
{
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
}
/**
* 校验岗位编码是否唯一
*
* @param post 岗位信息
* @return 结果
*/
@Override
public boolean checkPostCodeUnique(UPost post)
{
Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId();
UPost info = postMapper.checkPostCodeUnique(post.getPostCode());
if (StringUtils.isNotNull(info) && info.getPostId().longValue() != postId.longValue())
{
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
}
/**
* 通过岗位ID查询岗位使用数量
*
* @param postId 岗位ID
* @return 结果
*/
@Override
public int countUserPostById(Long postId)
{
return userPostMapper.countUserPostById(postId);
}
/**
* 删除岗位信息
*
* @param postId 岗位ID
* @return 结果
*/
@Override
public int deletePostById(Long postId)
{
return postMapper.deletePostById(postId);
}
/**
* 批量删除岗位信息
*
* @param postIds 需要删除的岗位ID
* @return 结果
*/
@Override
public int deletePostByIds(Long[] postIds)
{
for (Long postId : postIds)
{
UPost post = selectPostById(postId);
if (countUserPostById(postId) > 0)
{
throw new ServiceException(String.format("%1$s已分配,不能删除", post.getPostName()));
}
}
return postMapper.deletePostByIds(postIds);
}
/**
* 新增保存岗位信息
*
* @param post 岗位信息
* @return 结果
*/
@Override
public int insertPost(UPost post)
{
return postMapper.insertPost(post);
}
/**
* 修改保存岗位信息
*
* @param post 岗位信息
* @return 结果
*/
@Override
public int updatePost(UPost post)
{
return postMapper.updatePost(post);
}
}

View File

@@ -0,0 +1,422 @@
package org.wfc.user.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.wfc.common.core.constant.UserConstants;
import org.wfc.common.core.exception.ServiceException;
import org.wfc.common.core.utils.SpringUtils;
import org.wfc.common.core.utils.StringUtils;
import org.wfc.common.security.utils.SecurityUtils;
import org.wfc.user.api.domain.URole;
import org.wfc.user.api.domain.UUser;
import org.wfc.user.domain.URoleDept;
import org.wfc.user.domain.URoleMenu;
import org.wfc.user.domain.UUserRole;
import org.wfc.user.mapper.URoleDeptMapper;
import org.wfc.user.mapper.URoleMapper;
import org.wfc.user.mapper.URoleMenuMapper;
import org.wfc.user.mapper.UUserRoleMapper;
import org.wfc.user.service.IURoleService;
import java.util.*;
/**
* 角色 业务层处理
*
* @author wfc
*/
@Service
public class URoleServiceImpl implements IURoleService
{
@Autowired
private URoleMapper roleMapper;
@Autowired
private URoleMenuMapper roleMenuMapper;
@Autowired
private UUserRoleMapper userRoleMapper;
@Autowired
private URoleDeptMapper roleDeptMapper;
/**
* 根据条件分页查询角色数据
*
* @param role 角色信息
* @return 角色数据集合信息
*/
@Override
public List<URole> selectRoleList(URole role)
{
return roleMapper.selectRoleList(role);
}
/**
* 根据用户ID查询角色
*
* @param userId 用户ID
* @return 角色列表
*/
@Override
public List<URole> selectRolesByUserId(Long userId)
{
List<URole> userRoles = roleMapper.selectRolePermissionByUserId(userId);
List<URole> roles = selectRoleAll();
for (URole role : roles)
{
for (URole userRole : userRoles)
{
if (role.getRoleId().longValue() == userRole.getRoleId().longValue())
{
role.setFlag(true);
break;
}
}
}
return roles;
}
/**
* 根据用户ID查询权限
*
* @param userId 用户ID
* @return 权限列表
*/
@Override
public Set<String> selectRolePermissionByUserId(Long userId)
{
List<URole> perms = roleMapper.selectRolePermissionByUserId(userId);
Set<String> permsSet = new HashSet<>();
for (URole perm : perms)
{
if (StringUtils.isNotNull(perm))
{
permsSet.addAll(Arrays.asList(perm.getRoleKey().trim().split(",")));
}
}
return permsSet;
}
/**
* 查询所有角色
*
* @return 角色列表
*/
@Override
public List<URole> selectRoleAll()
{
return SpringUtils.getAopProxy(this).selectRoleList(new URole());
}
/**
* 根据用户ID获取角色选择框列表
*
* @param userId 用户ID
* @return 选中角色ID列表
*/
@Override
public List<Long> selectRoleListByUserId(Long userId)
{
return roleMapper.selectRoleListByUserId(userId);
}
/**
* 通过角色ID查询角色
*
* @param roleId 角色ID
* @return 角色对象信息
*/
@Override
public URole selectRoleById(Long roleId)
{
return roleMapper.selectRoleById(roleId);
}
/**
* 校验角色名称是否唯一
*
* @param role 角色信息
* @return 结果
*/
@Override
public boolean checkRoleNameUnique(URole role)
{
Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId();
URole info = roleMapper.checkRoleNameUnique(role.getRoleName());
if (StringUtils.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue())
{
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
}
/**
* 校验角色权限是否唯一
*
* @param role 角色信息
* @return 结果
*/
@Override
public boolean checkRoleKeyUnique(URole role)
{
Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId();
URole info = roleMapper.checkRoleKeyUnique(role.getRoleKey());
if (StringUtils.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue())
{
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
}
/**
* 校验角色是否允许操作
*
* @param role 角色信息
*/
@Override
public void checkRoleAllowed(URole role)
{
if (StringUtils.isNotNull(role.getRoleId()) && role.isAdmin())
{
throw new ServiceException("不允许操作超级管理员角色");
}
}
/**
* 校验角色是否有数据权限
*
* @param roleIds 角色id
*/
@Override
public void checkRoleDataScope(Long... roleIds)
{
if (!UUser.isAdmin(SecurityUtils.getUserId()))
{
for (Long roleId : roleIds)
{
URole role = new URole();
role.setRoleId(roleId);
List<URole> roles = SpringUtils.getAopProxy(this).selectRoleList(role);
if (StringUtils.isEmpty(roles))
{
throw new ServiceException("没有权限访问角色数据!");
}
}
}
}
/**
* 通过角色ID查询角色使用数量
*
* @param roleId 角色ID
* @return 结果
*/
@Override
public int countUserRoleByRoleId(Long roleId)
{
return userRoleMapper.countUserRoleByRoleId(roleId);
}
/**
* 新增保存角色信息
*
* @param role 角色信息
* @return 结果
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int insertRole(URole role)
{
// 新增角色信息
roleMapper.insertRole(role);
return insertRoleMenu(role);
}
/**
* 修改保存角色信息
*
* @param role 角色信息
* @return 结果
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int updateRole(URole role)
{
// 修改角色信息
roleMapper.updateRole(role);
// 删除角色与菜单关联
roleMenuMapper.deleteRoleMenuByRoleId(role.getRoleId());
return insertRoleMenu(role);
}
/**
* 修改角色状态
*
* @param role 角色信息
* @return 结果
*/
@Override
public int updateRoleStatus(URole role)
{
return roleMapper.updateRole(role);
}
/**
* 修改数据权限信息
*
* @param role 角色信息
* @return 结果
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int authDataScope(URole role)
{
// 修改角色信息
roleMapper.updateRole(role);
// 删除角色与部门关联
roleDeptMapper.deleteRoleDeptByRoleId(role.getRoleId());
// 新增角色和部门信息(数据权限)
return insertRoleDept(role);
}
/**
* 新增角色菜单信息
*
* @param role 角色对象
*/
public int insertRoleMenu(URole role)
{
int rows = 1;
// 新增用户与角色管理
List<URoleMenu> list = new ArrayList<URoleMenu>();
for (Long menuId : role.getMenuIds())
{
URoleMenu rm = new URoleMenu();
rm.setRoleId(role.getRoleId());
rm.setMenuId(menuId);
list.add(rm);
}
if (list.size() > 0)
{
rows = roleMenuMapper.batchRoleMenu(list);
}
return rows;
}
/**
* 新增角色部门信息(数据权限)
*
* @param role 角色对象
*/
public int insertRoleDept(URole role)
{
int rows = 1;
// 新增角色与部门(数据权限)管理
List<URoleDept> list = new ArrayList<URoleDept>();
for (Long deptId : role.getDeptIds())
{
URoleDept rd = new URoleDept();
rd.setRoleId(role.getRoleId());
rd.setDeptId(deptId);
list.add(rd);
}
if (list.size() > 0)
{
rows = roleDeptMapper.batchRoleDept(list);
}
return rows;
}
/**
* 通过角色ID删除角色
*
* @param roleId 角色ID
* @return 结果
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int deleteRoleById(Long roleId)
{
// 删除角色与菜单关联
roleMenuMapper.deleteRoleMenuByRoleId(roleId);
// 删除角色与部门关联
roleDeptMapper.deleteRoleDeptByRoleId(roleId);
return roleMapper.deleteRoleById(roleId);
}
/**
* 批量删除角色信息
*
* @param roleIds 需要删除的角色ID
* @return 结果
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int deleteRoleByIds(Long[] roleIds)
{
for (Long roleId : roleIds)
{
checkRoleAllowed(new URole(roleId));
checkRoleDataScope(roleId);
URole role = selectRoleById(roleId);
if (countUserRoleByRoleId(roleId) > 0)
{
throw new ServiceException(String.format("%1$s已分配,不能删除", role.getRoleName()));
}
}
// 删除角色与菜单关联
roleMenuMapper.deleteRoleMenu(roleIds);
// 删除角色与部门关联
roleDeptMapper.deleteRoleDept(roleIds);
return roleMapper.deleteRoleByIds(roleIds);
}
/**
* 取消授权用户角色
*
* @param userRole 用户和角色关联信息
* @return 结果
*/
@Override
public int deleteAuthUser(UUserRole userRole)
{
return userRoleMapper.deleteUserRoleInfo(userRole);
}
/**
* 批量取消授权用户角色
*
* @param roleId 角色ID
* @param userIds 需要取消授权的用户数据ID
* @return 结果
*/
@Override
public int deleteAuthUsers(Long roleId, Long[] userIds)
{
return userRoleMapper.deleteUserRoleInfos(roleId, userIds);
}
/**
* 批量选择授权用户角色
*
* @param roleId 角色ID
* @param userIds 需要授权的用户数据ID
* @return 结果
*/
@Override
public int insertAuthUsers(Long roleId, Long[] userIds)
{
// 新增用户与角色管理
List<UUserRole> list = new ArrayList<UUserRole>();
for (Long userId : userIds)
{
UUserRole ur = new UUserRole();
ur.setUserId(userId);
ur.setRoleId(roleId);
list.add(ur);
}
return userRoleMapper.batchUserRole(list);
}
}

View File

@@ -0,0 +1,89 @@
package org.wfc.user.service.impl;
import org.springframework.stereotype.Service;
import org.wfc.common.core.domain.LoginUser;
import org.wfc.common.core.utils.StringUtils;
import org.wfc.user.domain.UUserOnline;
import org.wfc.user.service.IUUserOnlineService;
/**
* 在线用户 服务层处理
*
* @author wfc
*/
@Service
public class UUserOnlineServiceImpl implements IUUserOnlineService
{
/**
* 通过登录地址查询信息
*
* @param ipaddr 登录地址
* @param user 用户信息
* @return 在线用户信息
*/
@Override
public UUserOnline selectOnlineByIpaddr(String ipaddr, LoginUser user)
{
if (StringUtils.equals(ipaddr, user.getIpaddr()))
{
return loginUserToUserOnline(user);
}
return null;
}
/**
* 通过用户名称查询信息
*
* @param userName 用户名称
* @param user 用户信息
* @return 在线用户信息
*/
@Override
public UUserOnline selectOnlineByUserName(String userName, LoginUser user)
{
if (StringUtils.equals(userName, user.getUsername()))
{
return loginUserToUserOnline(user);
}
return null;
}
/**
* 通过登录地址/用户名称查询信息
*
* @param ipaddr 登录地址
* @param userName 用户名称
* @param user 用户信息
* @return 在线用户信息
*/
@Override
public UUserOnline selectOnlineByInfo(String ipaddr, String userName, LoginUser user)
{
if (StringUtils.equals(ipaddr, user.getIpaddr()) && StringUtils.equals(userName, user.getUsername()))
{
return loginUserToUserOnline(user);
}
return null;
}
/**
* 设置在线用户信息
*
* @param user 用户信息
* @return 在线用户
*/
@Override
public UUserOnline loginUserToUserOnline(LoginUser user)
{
if (StringUtils.isNull(user))
{
return null;
}
UUserOnline UUserOnline = new UUserOnline();
UUserOnline.setTokenId(user.getToken());
UUserOnline.setUserName(user.getUsername());
UUserOnline.setIpaddr(user.getIpaddr());
UUserOnline.setLoginTime(user.getLoginTime());
return UUserOnline;
}
}

View File

@@ -0,0 +1,544 @@
package org.wfc.user.service.impl;
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 org.springframework.util.CollectionUtils;
import org.wfc.common.core.constant.UserConstants;
import org.wfc.common.core.exception.ServiceException;
import org.wfc.common.core.utils.SpringUtils;
import org.wfc.common.core.utils.StringUtils;
import org.wfc.common.core.utils.bean.BeanValidators;
import org.wfc.common.security.utils.SecurityUtils;
import org.wfc.user.api.domain.URole;
import org.wfc.user.api.domain.UUser;
import org.wfc.user.domain.UPost;
import org.wfc.user.domain.UUserPost;
import org.wfc.user.domain.UUserRole;
import org.wfc.user.mapper.*;
import org.wfc.user.service.IUConfigService;
import org.wfc.user.service.IUDeptService;
import org.wfc.user.service.IUUserService;
import javax.validation.Validator;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* 用户 业务层处理
*
* @author wfc
*/
@Service
public class UUserServiceImpl implements IUUserService
{
private static final Logger log = LoggerFactory.getLogger(UUserServiceImpl.class);
@Autowired
private UUserMapper userMapper;
@Autowired
private URoleMapper roleMapper;
@Autowired
private UPostMapper postMapper;
@Autowired
private UUserRoleMapper userRoleMapper;
@Autowired
private UUserPostMapper userPostMapper;
@Autowired
private IUConfigService configService;
@Autowired
private IUDeptService deptService;
@Autowired
protected Validator validator;
/**
* 根据条件分页查询用户列表
*
* @param user 用户信息
* @return 用户信息集合信息
*/
@Override
public List<UUser> selectUserList(UUser user)
{
return userMapper.selectUserList(user);
}
/**
* 根据条件分页查询已分配用户角色列表
*
* @param user 用户信息
* @return 用户信息集合信息
*/
@Override
public List<UUser> selectAllocatedList(UUser user)
{
return userMapper.selectAllocatedList(user);
}
/**
* 根据条件分页查询未分配用户角色列表
*
* @param user 用户信息
* @return 用户信息集合信息
*/
@Override
public List<UUser> selectUnallocatedList(UUser user)
{
return userMapper.selectUnallocatedList(user);
}
/**
* 通过用户名查询用户
*
* @param userName 用户名
* @return 用户对象信息
*/
@Override
public UUser selectUserByUserName(String userName)
{
return userMapper.selectUserByUserName(userName);
}
/**
* 通过用户ID查询用户
*
* @param userId 用户ID
* @return 用户对象信息
*/
@Override
public UUser selectUserById(Long userId)
{
return userMapper.selectUserById(userId);
}
/**
* 查询用户所属角色组
*
* @param userName 用户名
* @return 结果
*/
@Override
public String selectUserRoleGroup(String userName)
{
List<URole> list = roleMapper.selectRolesByUserName(userName);
if (CollectionUtils.isEmpty(list))
{
return StringUtils.EMPTY;
}
return list.stream().map(URole::getRoleName).collect(Collectors.joining(","));
}
/**
* 查询用户所属岗位组
*
* @param userName 用户名
* @return 结果
*/
@Override
public String selectUserPostGroup(String userName)
{
List<UPost> list = postMapper.selectPostsByUserName(userName);
if (CollectionUtils.isEmpty(list))
{
return StringUtils.EMPTY;
}
return list.stream().map(UPost::getPostName).collect(Collectors.joining(","));
}
/**
* 校验用户名称是否唯一
*
* @param user 用户信息
* @return 结果
*/
@Override
public boolean checkUserNameUnique(UUser user)
{
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
UUser info = userMapper.checkUserNameUnique(user.getUserName());
if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue())
{
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
}
/**
* 校验手机号码是否唯一
*
* @param user 用户信息
* @return
*/
@Override
public boolean checkPhoneUnique(UUser user)
{
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
UUser info = userMapper.checkPhoneUnique(user.getPhonenumber());
if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue())
{
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
}
/**
* 校验email是否唯一
*
* @param user 用户信息
* @return
*/
@Override
public boolean checkEmailUnique(UUser user)
{
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
UUser info = userMapper.checkEmailUnique(user.getEmail());
if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue())
{
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
}
/**
* 校验用户是否允许操作
*
* @param user 用户信息
*/
@Override
public void checkUserAllowed(UUser user)
{
if (StringUtils.isNotNull(user.getUserId()) && user.isAdmin())
{
throw new ServiceException("不允许操作超级管理员用户");
}
}
/**
* 校验用户是否有数据权限
*
* @param userId 用户id
*/
@Override
public void checkUserDataScope(Long userId)
{
if (!UUser.isAdmin(SecurityUtils.getUserId()))
{
UUser user = new UUser();
user.setUserId(userId);
List<UUser> users = SpringUtils.getAopProxy(this).selectUserList(user);
if (StringUtils.isEmpty(users))
{
throw new ServiceException("没有权限访问用户数据!");
}
}
}
/**
* 新增保存用户信息
*
* @param user 用户信息
* @return 结果
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int insertUser(UUser user)
{
// 新增用户信息
int rows = userMapper.insertUser(user);
// 新增用户岗位关联
insertUserPost(user);
// 新增用户与角色管理
insertUserRole(user);
return rows;
}
/**
* 注册用户信息
*
* @param user 用户信息
* @return 结果
*/
@Override
public boolean registerUser(UUser user)
{
return userMapper.insertUser(user) > 0;
}
/**
* 修改保存用户信息
*
* @param user 用户信息
* @return 结果
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int updateUser(UUser user)
{
Long userId = user.getUserId();
// 删除用户与角色关联
userRoleMapper.deleteUserRoleByUserId(userId);
// 新增用户与角色管理
insertUserRole(user);
// 删除用户与岗位关联
userPostMapper.deleteUserPostByUserId(userId);
// 新增用户与岗位管理
insertUserPost(user);
return userMapper.updateUser(user);
}
/**
* 用户授权角色
*
* @param userId 用户ID
* @param roleIds 角色组
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void insertUserAuth(Long userId, Long[] roleIds)
{
userRoleMapper.deleteUserRoleByUserId(userId);
insertUserRole(userId, roleIds);
}
/**
* 修改用户状态
*
* @param user 用户信息
* @return 结果
*/
@Override
public int updateUserStatus(UUser user)
{
return userMapper.updateUser(user);
}
/**
* 修改用户基本信息
*
* @param user 用户信息
* @return 结果
*/
@Override
public boolean updateUserProfile(UUser user)
{
return userMapper.updateUser(user) > 0;
}
/**
* 修改用户头像
*
* @param userName 用户名
* @param avatar 头像地址
* @return 结果
*/
@Override
public boolean updateUserAvatar(String userName, String avatar)
{
return userMapper.updateUserAvatar(userName, avatar) > 0;
}
/**
* 重置用户密码
*
* @param user 用户信息
* @return 结果
*/
@Override
public int resetPwd(UUser user)
{
return userMapper.updateUser(user);
}
/**
* 重置用户密码
*
* @param userName 用户名
* @param password 密码
* @return 结果
*/
@Override
public int resetUserPwd(String userName, String password)
{
return userMapper.resetUserPwd(userName, password);
}
/**
* 新增用户角色信息
*
* @param user 用户对象
*/
public void insertUserRole(UUser user)
{
this.insertUserRole(user.getUserId(), user.getRoleIds());
}
/**
* 新增用户岗位信息
*
* @param user 用户对象
*/
public void insertUserPost(UUser user)
{
Long[] posts = user.getPostIds();
if (StringUtils.isNotEmpty(posts))
{
// 新增用户与岗位管理
List<UUserPost> list = new ArrayList<UUserPost>();
for (Long postId : posts)
{
UUserPost up = new UUserPost();
up.setUserId(user.getUserId());
up.setPostId(postId);
list.add(up);
}
userPostMapper.batchUserPost(list);
}
}
/**
* 新增用户角色信息
*
* @param userId 用户ID
* @param roleIds 角色组
*/
public void insertUserRole(Long userId, Long[] roleIds)
{
if (StringUtils.isNotEmpty(roleIds))
{
// 新增用户与角色管理
List<UUserRole> list = new ArrayList<UUserRole>();
for (Long roleId : roleIds)
{
UUserRole ur = new UUserRole();
ur.setUserId(userId);
ur.setRoleId(roleId);
list.add(ur);
}
userRoleMapper.batchUserRole(list);
}
}
/**
* 通过用户ID删除用户
*
* @param userId 用户ID
* @return 结果
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int deleteUserById(Long userId)
{
// 删除用户与角色关联
userRoleMapper.deleteUserRoleByUserId(userId);
// 删除用户与岗位表
userPostMapper.deleteUserPostByUserId(userId);
return userMapper.deleteUserById(userId);
}
/**
* 批量删除用户信息
*
* @param userIds 需要删除的用户ID
* @return 结果
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int deleteUserByIds(Long[] userIds)
{
for (Long userId : userIds)
{
checkUserAllowed(new UUser(userId));
checkUserDataScope(userId);
}
// 删除用户与角色关联
userRoleMapper.deleteUserRole(userIds);
// 删除用户与岗位关联
userPostMapper.deleteUserPost(userIds);
return userMapper.deleteUserByIds(userIds);
}
/**
* 导入用户数据
*
* @param userList 用户数据列表
* @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据
* @param operName 操作用户
* @return 结果
*/
@Override
public String importUser(List<UUser> userList, Boolean isUpdateSupport, String operName)
{
if (StringUtils.isNull(userList) || userList.size() == 0)
{
throw new ServiceException("导入用户数据不能为空!");
}
int successNum = 0;
int failureNum = 0;
StringBuilder successMsg = new StringBuilder();
StringBuilder failureMsg = new StringBuilder();
for (UUser user : userList)
{
try
{
// 验证是否存在这个用户
UUser u = userMapper.selectUserByUserName(user.getUserName());
if (StringUtils.isNull(u))
{
BeanValidators.validateWithException(validator, user);
deptService.checkDeptDataScope(user.getDeptId());
String password = configService.selectConfigByKey("U.user.initPassword");
user.setPassword(SecurityUtils.encryptPassword(password));
user.setCreateBy(operName);
userMapper.insertUser(user);
successNum++;
successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " 导入成功");
}
else if (isUpdateSupport)
{
BeanValidators.validateWithException(validator, user);
checkUserAllowed(u);
checkUserDataScope(u.getUserId());
deptService.checkDeptDataScope(user.getDeptId());
user.setUserId(u.getUserId());
user.setUpdateBy(operName);
userMapper.updateUser(user);
successNum++;
successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " 更新成功");
}
else
{
failureNum++;
failureMsg.append("<br/>" + failureNum + "、账号 " + user.getUserName() + " 已存在");
}
}
catch (Exception e)
{
failureNum++;
String msg = "<br/>" + failureNum + "、账号 " + user.getUserName() + " 导入失败:";
failureMsg.append(msg + e.getMessage());
log.error(msg, e);
}
}
if (failureNum > 0)
{
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
throw new ServiceException(failureMsg.toString());
}
else
{
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
}
return successMsg.toString();
}
}

View File

@@ -1,24 +1,56 @@
# spring配置
spring:
redis:
host: 192.168.2.248
port: 6379
password:
host: 192.168.9.58
port: 16379
password: helloearth
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://192.168.2.248:3306/wfc-cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: 123456
druid:
stat-view-servlet:
enabled: true
loginUsername: admin
loginPassword: 123456
dynamic:
druid:
initial-size: 5
min-idle: 5
maxActive: 20
maxWait: 60000
connectTimeout: 30000
socketTimeout: 60000
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true
maxPoolPreparedStatementPerConnectionSize: 20
filters: stat,slf4j
connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
datasource:
# 主库数据源
master:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://192.168.9.58:13306/wfc-user-platform?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: 1000omc@kp!
# 从库数据源
# slave:
# username:
# password:
# url:
# driver-class-name:
# mybatis配置
mybatis:
# 搜索指定包别名
typeAliasesPackage: org.wfc.user.domain
typeAliasesPackage: org.wfc.user
# 配置mapper的扫描找到所有的mapper.xml映射文件
mapperLocations: classpath:mapper/**/*.xml
# swagger配置
swagger:
title: 用户平台接口文档
title: 系统模块接口文档
license: Powered By wfc
licenseUrl: https://wfc.vip
licenseUrl: https://wfc.vip

View File

@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.wfc.user.mapper.UConfigMapper">
<resultMap type="UConfig" id="UConfigResult">
<id property="configId" column="config_id" />
<result property="configName" column="config_name" />
<result property="configKey" column="config_key" />
<result property="configValue" column="config_value" />
<result property="configType" column="config_type" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectConfigVo">
select config_id, config_name, config_key, config_value, config_type, create_by, create_time, update_by, update_time, remark
from u_config
</sql>
<!-- 查询条件 -->
<sql id="sqlwhereSearch">
<where>
<if test="configId !=null">
and config_id = #{configId}
</if>
<if test="configKey !=null and configKey != ''">
and config_key = #{configKey}
</if>
</where>
</sql>
<select id="selectConfig" parameterType="UConfig" resultMap="UConfigResult">
<include refid="selectConfigVo"/>
<include refid="sqlwhereSearch"/>
</select>
<select id="selectConfigList" parameterType="UConfig" resultMap="UConfigResult">
<include refid="selectConfigVo"/>
<where>
<if test="configName != null and configName != ''">
AND config_name like concat('%', #{configName}, '%')
</if>
<if test="configType != null and configType != ''">
AND config_type = #{configType}
</if>
<if test="configKey != null and configKey != ''">
AND config_key like concat('%', #{configKey}, '%')
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(create_time,'%Y%m%d') &gt;= date_format(#{params.beginTime},'%Y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
and date_format(create_time,'%Y%m%d') &lt;= date_format(#{params.endTime},'%Y%m%d')
</if>
</where>
</select>
<select id="selectConfigById" parameterType="Long" resultMap="UConfigResult">
<include refid="selectConfigVo"/>
where config_id = #{configId}
</select>
<select id="checkConfigKeyUnique" parameterType="String" resultMap="UConfigResult">
<include refid="selectConfigVo"/>
where config_key = #{configKey} limit 1
</select>
<insert id="insertConfig" parameterType="UConfig">
insert into u_config (
<if test="configName != null and configName != '' ">config_name,</if>
<if test="configKey != null and configKey != '' ">config_key,</if>
<if test="configValue != null and configValue != '' ">config_value,</if>
<if test="configType != null and configType != '' ">config_type,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="remark != null and remark != ''">remark,</if>
create_time
)values(
<if test="configName != null and configName != ''">#{configName},</if>
<if test="configKey != null and configKey != ''">#{configKey},</if>
<if test="configValue != null and configValue != ''">#{configValue},</if>
<if test="configType != null and configType != ''">#{configType},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="remark != null and remark != ''">#{remark},</if>
sysdate()
)
</insert>
<update id="updateConfig" parameterType="UConfig">
update u_config
<set>
<if test="configName != null and configName != ''">config_name = #{configName},</if>
<if test="configKey != null and configKey != ''">config_key = #{configKey},</if>
<if test="configValue != null and configValue != ''">config_value = #{configValue},</if>
<if test="configType != null and configType != ''">config_type = #{configType},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if>
update_time = sysdate()
</set>
where config_id = #{configId}
</update>
<delete id="deleteConfigById" parameterType="Long">
delete from u_config where config_id = #{configId}
</delete>
<delete id="deleteConfigByIds" parameterType="Long">
delete from u_config where config_id in
<foreach item="configId" collection="array" open="(" separator="," close=")">
#{configId}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,161 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.wfc.user.mapper.UDeptMapper">
<resultMap type="UDept" id="UDeptResult">
<id property="deptId" column="dept_id" />
<result property="parentId" column="parent_id" />
<result property="ancestors" column="ancestors" />
<result property="deptName" column="dept_name" />
<result property="orderNum" column="order_num" />
<result property="leader" column="leader" />
<result property="phone" column="phone" />
<result property="email" column="email" />
<result property="status" column="status" />
<result property="delFlag" column="del_flag" />
<result property="parentName" column="parent_name" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectDeptVo">
select d.dept_id, d.parent_id, d.ancestors, d.remark, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time
from u_dept d
</sql>
<select id="selectDeptList" parameterType="UDept" resultMap="UDeptResult">
<include refid="selectDeptVo"/>
where d.del_flag = '0'
<if test="deptId != null and deptId != 0">
AND dept_id = #{deptId}
</if>
<if test="parentId != null and parentId != 0">
AND parent_id = #{parentId}
</if>
<if test="deptName != null and deptName != ''">
AND dept_name like concat('%', #{deptName}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
<!-- 数据范围过滤 -->
-- ${params.dataScope}
order by d.parent_id, d.order_num
</select>
<select id="selectDeptListByRoleId" resultType="Long">
select d.dept_id
from u_dept d
left join u_role_dept rd on d.dept_id = rd.dept_id
where rd.role_id = #{roleId}
<if test="deptCheckStrictly">
and d.dept_id not in (select d.parent_id from u_dept d inner join u_role_dept rd on d.dept_id = rd.dept_id and rd.role_id = #{roleId})
</if>
order by d.parent_id, d.order_num
</select>
<select id="selectDeptById" parameterType="Long" resultMap="UDeptResult">
<include refid="selectDeptVo"/>
where dept_id = #{deptId}
</select>
<select id="checkDeptExistUser" parameterType="Long" resultType="int">
select count(1) from u_user where dept_id = #{deptId} and del_flag = '0'
</select>
<select id="hasChildByDeptId" parameterType="Long" resultType="int">
select count(1) from u_dept
where del_flag = '0' and parent_id = #{deptId} limit 1
</select>
<select id="selectChildrenDeptById" parameterType="Long" resultMap="UDeptResult">
select * from u_dept where find_in_set(#{deptId}, ancestors)
</select>
<select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int">
select count(*) from u_dept where status = 0 and del_flag = '0' and find_in_set(#{deptId}, ancestors)
</select>
<select id="checkDeptNameUnique" resultMap="UDeptResult">
<include refid="selectDeptVo"/>
where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
</select>
<insert id="insertDept" parameterType="UDept">
insert into u_dept(
<if test="deptId != null and deptId != 0">dept_id,</if>
<if test="parentId != null and parentId != 0">parent_id,</if>
<if test="deptName != null and deptName != ''">dept_name,</if>
<if test="ancestors != null and ancestors != ''">ancestors,</if>
<if test="orderNum != null">order_num,</if>
<if test="leader != null and leader != ''">leader,</if>
<if test="phone != null and phone != ''">phone,</if>
<if test="email != null and email != ''">email,</if>
<if test="status != null">status,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="remark != null and remark != ''">remark,</if>
create_time
)values(
<if test="deptId != null and deptId != 0">#{deptId},</if>
<if test="parentId != null and parentId != 0">#{parentId},</if>
<if test="deptName != null and deptName != ''">#{deptName},</if>
<if test="ancestors != null and ancestors != ''">#{ancestors},</if>
<if test="orderNum != null">#{orderNum},</if>
<if test="leader != null and leader != ''">#{leader},</if>
<if test="phone != null and phone != ''">#{phone},</if>
<if test="email != null and email != ''">#{email},</if>
<if test="status != null">#{status},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="remark != null and remark != ''">#{remark},</if>
sysdate()
)
</insert>
<update id="updateDept" parameterType="UDept">
update u_dept
<set>
<if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
<if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
<if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if>
<if test="orderNum != null">order_num = #{orderNum},</if>
<if test="leader != null">leader = #{leader},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="email != null">email = #{email},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
update_time = sysdate()
</set>
where dept_id = #{deptId}
</update>
<update id="updateDeptChildren" parameterType="java.util.List">
update u_dept set ancestors =
<foreach collection="depts" item="item" index="index"
separator=" " open="case dept_id" close="end">
when #{item.deptId} then #{item.ancestors}
</foreach>
where dept_id in
<foreach collection="depts" item="item" index="index"
separator="," open="(" close=")">
#{item.deptId}
</foreach>
</update>
<update id="updateDeptStatusNormal" parameterType="Long">
update u_dept set status = '0' where dept_id in
<foreach collection="array" item="deptId" open="(" separator="," close=")">
#{deptId}
</foreach>
</update>
<delete id="deleteDeptById" parameterType="Long">
update u_dept set del_flag = '2' where dept_id = #{deptId}
</delete>
</mapper>

View File

@@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.wfc.user.mapper.UDictDataMapper">
<resultMap type="UDictData" id="UDictDataResult">
<id property="dictCode" column="dict_code" />
<result property="dictSort" column="dict_sort" />
<result property="dictLabel" column="dict_label" />
<result property="dictValue" column="dict_value" />
<result property="dictType" column="dict_type" />
<result property="cssClass" column="css_class" />
<result property="listClass" column="list_class" />
<result property="isDefault" column="is_default" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectDictDataVo">
select dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, remark
from u_dict_data
</sql>
<select id="selectDictDataList" parameterType="UDictData" resultMap="UDictDataResult">
<include refid="selectDictDataVo"/>
<where>
<if test="dictType != null and dictType != ''">
AND dict_type = #{dictType}
</if>
<if test="dictLabel != null and dictLabel != ''">
AND dict_label like concat('%', #{dictLabel}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
</where>
order by dict_sort asc
</select>
<select id="selectDictDataByType" parameterType="String" resultMap="UDictDataResult">
<include refid="selectDictDataVo"/>
where status = '0' and dict_type = #{dictType} order by dict_sort asc
</select>
<select id="selectDictLabel" resultType="String">
select dict_label from u_dict_data
where dict_type = #{dictType} and dict_value = #{dictValue}
</select>
<select id="selectDictDataById" parameterType="Long" resultMap="UDictDataResult">
<include refid="selectDictDataVo"/>
where dict_code = #{dictCode}
</select>
<select id="countDictDataByType" resultType="Integer">
select count(1) from u_dict_data where dict_type=#{dictType}
</select>
<delete id="deleteDictDataById" parameterType="Long">
delete from u_dict_data where dict_code = #{dictCode}
</delete>
<delete id="deleteDictDataByIds" parameterType="Long">
delete from u_dict_data where dict_code in
<foreach collection="array" item="dictCode" open="(" separator="," close=")">
#{dictCode}
</foreach>
</delete>
<update id="updateDictData" parameterType="UDictData">
update u_dict_data
<set>
<if test="dictSort != null">dict_sort = #{dictSort},</if>
<if test="dictLabel != null and dictLabel != ''">dict_label = #{dictLabel},</if>
<if test="dictValue != null and dictValue != ''">dict_value = #{dictValue},</if>
<if test="dictType != null and dictType != ''">dict_type = #{dictType},</if>
<if test="cssClass != null">css_class = #{cssClass},</if>
<if test="listClass != null">list_class = #{listClass},</if>
<if test="isDefault != null and isDefault != ''">is_default = #{isDefault},</if>
<if test="status != null">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
where dict_code = #{dictCode}
</update>
<update id="updateDictDataType" parameterType="String">
update u_dict_data set dict_type = #{newDictType} where dict_type = #{oldDictType}
</update>
<insert id="insertDictData" parameterType="UDictData">
insert into u_dict_data(
<if test="dictSort != null">dict_sort,</if>
<if test="dictLabel != null and dictLabel != ''">dict_label,</if>
<if test="dictValue != null and dictValue != ''">dict_value,</if>
<if test="dictType != null and dictType != ''">dict_type,</if>
<if test="cssClass != null and cssClass != ''">css_class,</if>
<if test="listClass != null and listClass != ''">list_class,</if>
<if test="isDefault != null and isDefault != ''">is_default,</if>
<if test="status != null">status,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="dictSort != null">#{dictSort},</if>
<if test="dictLabel != null and dictLabel != ''">#{dictLabel},</if>
<if test="dictValue != null and dictValue != ''">#{dictValue},</if>
<if test="dictType != null and dictType != ''">#{dictType},</if>
<if test="cssClass != null and cssClass != ''">#{cssClass},</if>
<if test="listClass != null and listClass != ''">#{listClass},</if>
<if test="isDefault != null and isDefault != ''">#{isDefault},</if>
<if test="status != null">#{status},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
</mapper>

View File

@@ -0,0 +1,105 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.wfc.user.mapper.UDictTypeMapper">
<resultMap type="UDictType" id="UDictTypeResult">
<id property="dictId" column="dict_id" />
<result property="dictName" column="dict_name" />
<result property="dictType" column="dict_type" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectDictTypeVo">
select dict_id, dict_name, dict_type, status, create_by, create_time, remark
from u_dict_type
</sql>
<select id="selectDictTypeList" parameterType="UDictType" resultMap="UDictTypeResult">
<include refid="selectDictTypeVo"/>
<where>
<if test="dictName != null and dictName != ''">
AND dict_name like concat('%', #{dictName}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
<if test="dictType != null and dictType != ''">
AND dict_type like concat('%', #{dictType}, '%')
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(create_time,'%Y%m%d') &gt;= date_format(#{params.beginTime},'%Y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
and date_format(create_time,'%Y%m%d') &lt;= date_format(#{params.endTime},'%Y%m%d')
</if>
</where>
</select>
<select id="selectDictTypeAll" resultMap="UDictTypeResult">
<include refid="selectDictTypeVo"/>
</select>
<select id="selectDictTypeById" parameterType="Long" resultMap="UDictTypeResult">
<include refid="selectDictTypeVo"/>
where dict_id = #{dictId}
</select>
<select id="selectDictTypeByType" parameterType="String" resultMap="UDictTypeResult">
<include refid="selectDictTypeVo"/>
where dict_type = #{dictType}
</select>
<select id="checkDictTypeUnique" parameterType="String" resultMap="UDictTypeResult">
<include refid="selectDictTypeVo"/>
where dict_type = #{dictType} limit 1
</select>
<delete id="deleteDictTypeById" parameterType="Long">
delete from u_dict_type where dict_id = #{dictId}
</delete>
<delete id="deleteDictTypeByIds" parameterType="Long">
delete from u_dict_type where dict_id in
<foreach collection="array" item="dictId" open="(" separator="," close=")">
#{dictId}
</foreach>
</delete>
<update id="updateDictType" parameterType="UDictType">
update u_dict_type
<set>
<if test="dictName != null and dictName != ''">dict_name = #{dictName},</if>
<if test="dictType != null and dictType != ''">dict_type = #{dictType},</if>
<if test="status != null">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
where dict_id = #{dictId}
</update>
<insert id="insertDictType" parameterType="UDictType">
insert into u_dict_type(
<if test="dictName != null and dictName != ''">dict_name,</if>
<if test="dictType != null and dictType != ''">dict_type,</if>
<if test="status != null">status,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="dictName != null and dictName != ''">#{dictName},</if>
<if test="dictType != null and dictType != ''">#{dictType},</if>
<if test="status != null">#{status},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
</mapper>

View File

@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.wfc.user.mapper.ULogininforMapper">
<resultMap type="ULogininfor" id="ULogininforResult">
<id property="infoId" column="info_id" />
<result property="userName" column="user_name" />
<result property="status" column="status" />
<result property="ipaddr" column="ipaddr" />
<result property="msg" column="msg" />
<result property="accessTime" column="access_time" />
</resultMap>
<insert id="insertLogininfor" parameterType="ULogininfor">
insert into u_logininfor (user_name, status, ipaddr, msg, access_time)
values (#{userName}, #{status}, #{ipaddr}, #{msg}, sysdate())
</insert>
<select id="selectLogininforList" parameterType="ULogininfor" resultMap="ULogininforResult">
select info_id, user_name, ipaddr, status, msg, access_time from u_logininfor
<where>
<if test="ipaddr != null and ipaddr != ''">
AND ipaddr like concat('%', #{ipaddr}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
<if test="userName != null and userName != ''">
AND user_name like concat('%', #{userName}, '%')
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
AND access_time &gt;= #{params.beginTime}
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
AND access_time &lt;= #{params.endTime}
</if>
</where>
order by info_id desc
</select>
<delete id="deleteLogininforByIds" parameterType="Long">
delete from u_logininfor where info_id in
<foreach collection="array" item="infoId" open="(" separator="," close=")">
#{infoId}
</foreach>
</delete>
<update id="cleanLogininfor">
truncate table u_logininfor
</update>
</mapper>

View File

@@ -0,0 +1,211 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.wfc.user.mapper.UMenuMapper">
<resultMap type="UMenu" id="UMenuResult">
<id property="menuId" column="menu_id" />
<result property="menuName" column="menu_name" />
<result property="parentName" column="parent_name" />
<result property="parentId" column="parent_id" />
<result property="orderNum" column="order_num" />
<result property="name" column="name" />
<result property="path" column="path" />
<result property="component" column="component" />
<result property="query" column="query" />
<result property="isFrame" column="is_frame" />
<result property="isCache" column="is_cache" />
<result property="menuType" column="menu_type" />
<result property="visible" column="visible" />
<result property="status" column="status" />
<result property="perms" column="perms" />
<result property="icon" column="icon" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectMenuVo">
select menu_id, menu_name, parent_id, order_num, path, name, component, `query`, is_frame, is_cache, menu_type, visible, status, ifnull(perms,'') as perms, icon, create_time
from u_menu
</sql>
<select id="selectMenuList" parameterType="UMenu" resultMap="UMenuResult">
<include refid="selectMenuVo"/>
<where>
<if test="menuName != null and menuName != ''">
AND menu_name like concat('%', #{menuName}, '%')
</if>
<if test="visible != null and visible != ''">
AND visible = #{visible}
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
</where>
order by parent_id, order_num
</select>
<select id="selectMenuTreeAll" resultMap="UMenuResult">
select distinct m.menu_id, m.parent_id, m.name , m.menu_name, m.path, m.component, m.`query`, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
from u_menu m where m.menu_type in ('M', 'C') and m.status = 0
order by m.parent_id, m.order_num
</select>
<select id="selectMenuListByUserId" parameterType="UMenu" resultMap="UMenuResult">
select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
from u_menu m
left join u_role_menu rm on m.menu_id = rm.menu_id
left join u_user_role ur on rm.role_id = ur.role_id
left join u_role ro on ur.role_id = ro.role_id
where ur.user_id = #{params.userId}
<if test="menuName != null and menuName != ''">
AND m.menu_name like concat('%', #{menuName}, '%')
</if>
<if test="visible != null and visible != ''">
AND m.visible = #{visible}
</if>
<if test="status != null and status != ''">
AND m.status = #{status}
</if>
<if test="menuType != null and menuType != ''">
AND menu_type = #{menuType}
</if>
<if test="path != null and path != ''">
AND path = #{path}
</if>
order by m.parent_id, m.order_num
</select>
<select id="selectMenuTreeByUserId" parameterType="Long" resultMap="UMenuResult">
select distinct m.menu_id, m.name, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
from u_menu m
left join u_role_menu rm on m.menu_id = rm.menu_id
left join u_user_role ur on rm.role_id = ur.role_id
left join u_role ro on ur.role_id = ro.role_id
left join u_user u on ur.user_id = u.user_id
where u.user_id = #{userId} and m.menu_type in ('M', 'C') and m.status = 0 AND ro.status = 0
order by m.parent_id, m.order_num
</select>
<select id="selectMenuListByRoleId" resultType="Long">
select m.menu_id
from u_menu m
left join u_role_menu rm on m.menu_id = rm.menu_id
where rm.role_id = #{roleId}
<if test="menuCheckStrictly">
and m.menu_id not in (select m.parent_id from u_menu m inner join u_role_menu rm on m.menu_id = rm.menu_id and rm.role_id = #{roleId})
</if>
order by m.parent_id, m.order_num
</select>
<select id="selectMenuPerms" resultType="String">
select distinct m.perms
from u_menu m
left join u_role_menu rm on m.menu_id = rm.menu_id
left join u_user_role ur on rm.role_id = ur.role_id
</select>
<select id="selectMenuPermsByUserId" parameterType="Long" resultType="String">
select distinct m.perms
from u_menu m
left join u_role_menu rm on m.menu_id = rm.menu_id
left join u_user_role ur on rm.role_id = ur.role_id
left join u_role r on r.role_id = ur.role_id
where m.status = '0' and r.status = '0' and ur.user_id = #{userId}
</select>
<select id="selectMenuPermsByRoleId" parameterType="Long" resultType="String">
select distinct m.perms
from u_menu m
left join u_role_menu rm on m.menu_id = rm.menu_id
where m.status = '0' and rm.role_id = #{roleId}
</select>
<select id="selectMenuById" parameterType="Long" resultMap="UMenuResult">
<include refid="selectMenuVo"/>
where menu_id = #{menuId}
</select>
<select id="hasChildByMenuId" resultType="Integer">
select count(1) from u_menu where parent_id = #{menuId}
</select>
<select id="checkMenuNameUnique" parameterType="UMenu" resultMap="UMenuResult">
<include refid="selectMenuVo"/>
where menu_name=#{menuName} and parent_id = #{parentId} limit 1
</select>
<update id="updateMenu" parameterType="UMenu">
update u_menu
<set>
<if test="menuName != null and menuName != ''">menu_name = #{menuName},</if>
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="orderNum != null">order_num = #{orderNum},</if>
<if test="path != null and path != ''">path = #{path},</if>
<if test="component != null">component = #{component},</if>
<if test="query != null">`query` = #{query},</if>
<if test="isFrame != null and isFrame != ''">is_frame = #{isFrame},</if>
<if test="isCache != null and isCache != ''">is_cache = #{isCache},</if>
<if test="menuType != null and menuType != ''">menu_type = #{menuType},</if>
<if test="visible != null">visible = #{visible},</if>
<if test="status != null">status = #{status},</if>
<if test="perms !=null">perms = #{perms},</if>
<if test="icon !=null and icon != ''">icon = #{icon},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="name != null and name != ''">name = #{name},</if>
update_time = sysdate()
</set>
where menu_id = #{menuId}
</update>
<insert id="insertMenu" parameterType="UMenu">
insert into u_menu(
<if test="menuId != null and menuId != 0">menu_id,</if>
<if test="parentId != null and parentId != 0">parent_id,</if>
<if test="menuName != null and menuName != ''">menu_name,</if>
<if test="orderNum != null">order_num,</if>
<if test="path != null and path != ''">path,</if>
<if test="component != null and component != ''">component,</if>
<if test="query != null and query != ''">`query`,</if>
<if test="isFrame != null and isFrame != ''">is_frame,</if>
<if test="isCache != null and isCache != ''">is_cache,</if>
<if test="menuType != null and menuType != ''">menu_type,</if>
<if test="visible != null">visible,</if>
<if test="status != null">status,</if>
<if test="perms !=null and perms != ''">perms,</if>
<if test="icon != null and icon != ''">icon,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="name != null and name != ''">name,</if>
create_time
)values(
<if test="menuId != null and menuId != 0">#{menuId},</if>
<if test="parentId != null and parentId != 0">#{parentId},</if>
<if test="menuName != null and menuName != ''">#{menuName},</if>
<if test="orderNum != null">#{orderNum},</if>
<if test="path != null and path != ''">#{path},</if>
<if test="component != null and component != ''">#{component},</if>
<if test="query != null and query != ''">#{query},</if>
<if test="isFrame != null and isFrame != ''">#{isFrame},</if>
<if test="isCache != null and isCache != ''">#{isCache},</if>
<if test="menuType != null and menuType != ''">#{menuType},</if>
<if test="visible != null">#{visible},</if>
<if test="status != null">#{status},</if>
<if test="perms !=null and perms != ''">#{perms},</if>
<if test="icon != null and icon != ''">#{icon},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="name != null and name != ''">#{name},</if>
sysdate()
)
</insert>
<delete id="deleteMenuById" parameterType="Long">
delete from u_menu where menu_id = #{menuId}
</delete>
</mapper>

View File

@@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.wfc.user.mapper.UOperLogMapper">
<resultMap type="UOperLog" id="UOperLogResult">
<id property="operId" column="oper_id" />
<result property="title" column="title" />
<result property="businessType" column="business_type" />
<result property="method" column="method" />
<result property="requestMethod" column="request_method" />
<result property="operatorType" column="operator_type" />
<result property="operName" column="oper_name" />
<result property="deptName" column="dept_name" />
<result property="operUrl" column="oper_url" />
<result property="operIp" column="oper_ip" />
<result property="operParam" column="oper_param" />
<result property="jsonResult" column="json_result" />
<result property="status" column="status" />
<result property="errorMsg" column="error_msg" />
<result property="operTime" column="oper_time" />
<result property="costTime" column="cost_time" />
</resultMap>
<sql id="selectOperLogVo">
select oper_id, title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_param, json_result, status, error_msg, oper_time, cost_time
from u_oper_log
</sql>
<insert id="insertOperlog" parameterType="UOperLog">
insert into u_oper_log(title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_param, json_result, status, error_msg, cost_time, oper_time)
values (#{title}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg}, #{costTime}, sysdate())
</insert>
<select id="selectOperLogList" parameterType="UOperLog" resultMap="UOperLogResult">
<include refid="selectOperLogVo"/>
<where>
<if test="operIp != null and operIp != ''">
AND oper_ip like concat('%', #{operIp}, '%')
</if>
<if test="title != null and title != ''">
AND title like concat('%', #{title}, '%')
</if>
<if test="businessType != null">
AND business_type = #{businessType}
</if>
<if test="businessTypes != null and businessTypes.length > 0">
AND business_type in
<foreach collection="businessTypes" item="businessType" open="(" separator="," close=")">
#{businessType}
</foreach>
</if>
<if test="status != null">
AND status = #{status}
</if>
<if test="operName != null and operName != ''">
AND oper_name like concat('%', #{operName}, '%')
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
AND oper_time &gt;= #{params.beginTime}
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
AND oper_time &lt;= #{params.endTime}
</if>
</where>
order by oper_id desc
</select>
<delete id="deleteOperLogByIds" parameterType="Long">
delete from u_oper_log where oper_id in
<foreach collection="array" item="operId" open="(" separator="," close=")">
#{operId}
</foreach>
</delete>
<select id="selectOperLogById" parameterType="Long" resultMap="UOperLogResult">
<include refid="selectOperLogVo"/>
where oper_id = #{operId}
</select>
<update id="cleanOperLog">
truncate table u_oper_log
</update>
</mapper>

View File

@@ -0,0 +1,122 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.wfc.user.mapper.UPostMapper">
<resultMap type="UPost" id="UPostResult">
<id property="postId" column="post_id" />
<result property="postCode" column="post_code" />
<result property="postName" column="post_name" />
<result property="postSort" column="post_sort" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectPostVo">
select post_id, post_code, post_name, post_sort, status, create_by, create_time, remark
from u_post
</sql>
<select id="selectPostList" parameterType="UPost" resultMap="UPostResult">
<include refid="selectPostVo"/>
<where>
<if test="postCode != null and postCode != ''">
AND post_code like concat('%', #{postCode}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
<if test="postName != null and postName != ''">
AND post_name like concat('%', #{postName}, '%')
</if>
</where>
</select>
<select id="selectPostAll" resultMap="UPostResult">
<include refid="selectPostVo"/>
</select>
<select id="selectPostById" parameterType="Long" resultMap="UPostResult">
<include refid="selectPostVo"/>
where post_id = #{postId}
</select>
<select id="selectPostListByUserId" parameterType="Long" resultType="Long">
select p.post_id
from u_post p
left join u_user_post up on up.post_id = p.post_id
left join u_user u on u.user_id = up.user_id
where u.user_id = #{userId}
</select>
<select id="selectPostsByUserName" parameterType="String" resultMap="UPostResult">
select p.post_id, p.post_name, p.post_code
from u_post p
left join u_user_post up on up.post_id = p.post_id
left join u_user u on u.user_id = up.user_id
where u.user_name = #{userName}
</select>
<select id="checkPostNameUnique" parameterType="String" resultMap="UPostResult">
<include refid="selectPostVo"/>
where post_name=#{postName} limit 1
</select>
<select id="checkPostCodeUnique" parameterType="String" resultMap="UPostResult">
<include refid="selectPostVo"/>
where post_code=#{postCode} limit 1
</select>
<update id="updatePost" parameterType="UPost">
update u_post
<set>
<if test="postCode != null and postCode != ''">post_code = #{postCode},</if>
<if test="postName != null and postName != ''">post_name = #{postName},</if>
<if test="postSort != null">post_sort = #{postSort},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
where post_id = #{postId}
</update>
<insert id="insertPost" parameterType="UPost" useGeneratedKeys="true" keyProperty="postId">
insert into u_post(
<if test="postId != null and postId != 0">post_id,</if>
<if test="postCode != null and postCode != ''">post_code,</if>
<if test="postName != null and postName != ''">post_name,</if>
<if test="postSort != null">post_sort,</if>
<if test="status != null and status != ''">status,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="postId != null and postId != 0">#{postId},</if>
<if test="postCode != null and postCode != ''">#{postCode},</if>
<if test="postName != null and postName != ''">#{postName},</if>
<if test="postSort != null">#{postSort},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
<delete id="deletePostById" parameterType="Long">
delete from u_post where post_id = #{postId}
</delete>
<delete id="deletePostByIds" parameterType="Long">
delete from u_post where post_id in
<foreach collection="array" item="postId" open="(" separator="," close=")">
#{postId}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.wfc.user.mapper.URoleDeptMapper">
<resultMap type="URoleDept" id="URoleDeptResult">
<result property="roleId" column="role_id" />
<result property="deptId" column="dept_id" />
</resultMap>
<delete id="deleteRoleDeptByRoleId" parameterType="Long">
delete from u_role_dept where role_id=#{roleId}
</delete>
<select id="selectCountRoleDeptByDeptId" resultType="Integer">
select count(1) from u_role_dept where dept_id=#{deptId}
</select>
<delete id="deleteRoleDept" parameterType="Long">
delete from u_role_dept where role_id in
<foreach collection="array" item="roleId" open="(" separator="," close=")">
#{roleId}
</foreach>
</delete>
<insert id="batchRoleDept">
insert into u_role_dept(role_id, dept_id) values
<foreach item="item" index="index" collection="list" separator=",">
(#{item.roleId},#{item.deptId})
</foreach>
</insert>
</mapper>

View File

@@ -0,0 +1,152 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.wfc.user.mapper.URoleMapper">
<resultMap type="URole" id="URoleResult">
<id property="roleId" column="role_id" />
<result property="roleName" column="role_name" />
<result property="roleKey" column="role_key" />
<result property="roleSort" column="role_sort" />
<result property="dataScope" column="data_scope" />
<result property="menuCheckStrictly" column="menu_check_strictly" />
<result property="deptCheckStrictly" column="dept_check_strictly" />
<result property="status" column="status" />
<result property="delFlag" column="del_flag" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectRoleVo">
select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.menu_check_strictly, r.dept_check_strictly,
r.status, r.del_flag, r.create_time, r.remark
from u_role r
left join u_user_role ur on ur.role_id = r.role_id
left join u_user u on u.user_id = ur.user_id
left join u_dept d on u.dept_id = d.dept_id
</sql>
<select id="selectRoleList" parameterType="URole" resultMap="URoleResult">
<include refid="selectRoleVo"/>
where r.del_flag = '0'
<if test="roleId != null and roleId != 0">
AND r.role_id = #{roleId}
</if>
<if test="roleName != null and roleName != ''">
AND r.role_name like concat('%', #{roleName}, '%')
</if>
<if test="status != null and status != ''">
AND r.status = #{status}
</if>
<if test="roleKey != null and roleKey != ''">
AND r.role_key like concat('%', #{roleKey}, '%')
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(r.create_time,'%Y%m%d') &gt;= date_format(#{params.beginTime},'%Y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
and date_format(r.create_time,'%Y%m%d') &lt;= date_format(#{params.endTime},'%Y%m%d')
</if>
<!-- 数据范围过滤 -->
-- ${params.dataScope}
order by r.role_sort
</select>
<select id="selectRolePermissionByUserId" parameterType="Long" resultMap="URoleResult">
<include refid="selectRoleVo"/>
WHERE r.del_flag = '0' and ur.user_id = #{userId}
</select>
<select id="selectRoleAll" resultMap="URoleResult">
<include refid="selectRoleVo"/>
</select>
<select id="selectRoleListByUserId" parameterType="Long" resultType="Long">
select r.role_id
from u_role r
left join u_user_role ur on ur.role_id = r.role_id
left join u_user u on u.user_id = ur.user_id
where u.user_id = #{userId}
</select>
<select id="selectRoleById" parameterType="Long" resultMap="URoleResult">
<include refid="selectRoleVo"/>
where r.role_id = #{roleId}
</select>
<select id="selectRolesByUserName" parameterType="String" resultMap="URoleResult">
<include refid="selectRoleVo"/>
WHERE r.del_flag = '0' and u.user_name = #{userName}
</select>
<select id="checkRoleNameUnique" parameterType="String" resultMap="URoleResult">
<include refid="selectRoleVo"/>
where r.role_name=#{roleName} and r.del_flag = '0' limit 1
</select>
<select id="checkRoleKeyUnique" parameterType="String" resultMap="URoleResult">
<include refid="selectRoleVo"/>
where r.role_key=#{roleKey} and r.del_flag = '0' limit 1
</select>
<insert id="insertRole" parameterType="URole" useGeneratedKeys="true" keyProperty="roleId">
insert into u_role(
<if test="roleId != null and roleId != 0">role_id,</if>
<if test="roleName != null and roleName != ''">role_name,</if>
<if test="roleKey != null and roleKey != ''">role_key,</if>
<if test="roleSort != null">role_sort,</if>
<if test="dataScope != null and dataScope != ''">data_scope,</if>
<if test="menuCheckStrictly != null">menu_check_strictly,</if>
<if test="deptCheckStrictly != null">dept_check_strictly,</if>
<if test="status != null and status != ''">status,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="roleId != null and roleId != 0">#{roleId},</if>
<if test="roleName != null and roleName != ''">#{roleName},</if>
<if test="roleKey != null and roleKey != ''">#{roleKey},</if>
<if test="roleSort != null">#{roleSort},</if>
<if test="dataScope != null and dataScope != ''">#{dataScope},</if>
<if test="menuCheckStrictly != null">#{menuCheckStrictly},</if>
<if test="deptCheckStrictly != null">#{deptCheckStrictly},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
<update id="updateRole" parameterType="URole">
update u_role
<set>
<if test="roleName != null and roleName != ''">role_name = #{roleName},</if>
<if test="roleKey != null and roleKey != ''">role_key = #{roleKey},</if>
<if test="roleSort != null">role_sort = #{roleSort},</if>
<if test="dataScope != null and dataScope != ''">data_scope = #{dataScope},</if>
<if test="menuCheckStrictly != null">menu_check_strictly = #{menuCheckStrictly},</if>
<if test="deptCheckStrictly != null">dept_check_strictly = #{deptCheckStrictly},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
where role_id = #{roleId}
</update>
<delete id="deleteRoleById" parameterType="Long">
update u_role set del_flag = '2' where role_id = #{roleId}
</delete>
<delete id="deleteRoleByIds" parameterType="Long">
update u_role set del_flag = '2' where role_id in
<foreach collection="array" item="roleId" open="(" separator="," close=")">
#{roleId}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.wfc.user.mapper.URoleMenuMapper">
<resultMap type="URoleMenu" id="URoleMenuResult">
<result property="roleId" column="role_id" />
<result property="menuId" column="menu_id" />
</resultMap>
<select id="checkMenuExistRole" resultType="Integer">
select count(1) from u_role_menu where menu_id = #{menuId}
</select>
<delete id="deleteRoleMenuByRoleId" parameterType="Long">
delete from u_role_menu where role_id=#{roleId}
</delete>
<delete id="deleteRoleMenu" parameterType="Long">
delete from u_role_menu where role_id in
<foreach collection="array" item="roleId" open="(" separator="," close=")">
#{roleId}
</foreach>
</delete>
<insert id="batchRoleMenu">
insert into u_role_menu(role_id, menu_id) values
<foreach item="item" index="index" collection="list" separator=",">
(#{item.roleId},#{item.menuId})
</foreach>
</insert>
</mapper>

View File

@@ -1,130 +1,221 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.wfc.user.mapper.UUserMapper">
<resultMap type="UUser" id="UUserResult">
<result property="userId" column="user_id" />
<result property="userName" column="user_name" />
<result property="nickName" column="nick_name" />
<result property="age" column="age" />
<result property="sex" column="sex" />
<result property="email" column="email" />
<result property="phone" column="phone" />
<result property="address" column="address" />
<result property="password" column="password" />
<result property="status" column="status" />
<result property="delFlag" column="del_flag" />
<result property="loginIp" column="login_ip" />
<result property="loginDate" column="login_date" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectUUserVo">
select user_id, user_name, nick_name, age, sex, email, phone, address, password, status, del_flag, login_ip, login_date, create_by, create_time, update_by, update_time, remark from u_user
</sql>
<select id="selectUUserList" parameterType="UUser" resultMap="UUserResult">
<include refid="selectUUserVo"/>
<where>
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
<if test="nickName != null and nickName != ''"> and nick_name like concat('%', #{nickName}, '%')</if>
<if test="age != null and age != ''"> and age = #{age}</if>
<if test="sex != null and sex != ''"> and sex = #{sex}</if>
<if test="email != null and email != ''"> and email = #{email}</if>
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
<if test="address != null and address != ''"> and address = #{address}</if>
<if test="password != null and password != ''"> and password = #{password}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="loginIp != null and loginIp != ''"> and login_ip = #{loginIp}</if>
<if test="loginDate != null "> and login_date = #{loginDate}</if>
</where>
<resultMap type="UUser" id="UUserResult">
<id property="userId" column="user_id" />
<result property="deptId" column="dept_id" />
<result property="userName" column="user_name" />
<result property="nickName" column="nick_name" />
<result property="email" column="email" />
<result property="phonenumber" column="phonenumber" />
<result property="sex" column="sex" />
<result property="avatar" column="avatar" />
<result property="password" column="password" />
<result property="status" column="status" />
<result property="delFlag" column="del_flag" />
<result property="loginIp" column="login_ip" />
<result property="loginDate" column="login_date" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<association property="dept" javaType="UDept" resultMap="deptResult" />
<collection property="roles" javaType="java.util.List" resultMap="RoleResult" />
</resultMap>
<resultMap id="deptResult" type="UDept">
<id property="deptId" column="dept_id" />
<result property="parentId" column="parent_id" />
<result property="deptName" column="dept_name" />
<result property="ancestors" column="ancestors" />
<result property="orderNum" column="order_num" />
<result property="leader" column="leader" />
<result property="status" column="dept_status" />
</resultMap>
<resultMap id="RoleResult" type="URole">
<id property="roleId" column="role_id" />
<result property="roleName" column="role_name" />
<result property="roleKey" column="role_key" />
<result property="roleSort" column="role_sort" />
<result property="dataScope" column="data_scope" />
<result property="status" column="role_status" />
</resultMap>
<sql id="selectUserVo">
select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status,
r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
from u_user u
left join u_dept d on u.dept_id = d.dept_id
left join u_user_role ur on u.user_id = ur.user_id
left join u_role r on r.role_id = ur.role_id
</sql>
<select id="selectUserList" parameterType="UUser" resultMap="UUserResult">
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from u_user u
left join u_dept d on u.dept_id = d.dept_id
where u.del_flag = '0'
<if test="userId != null and userId != 0">
AND u.user_id = #{userId}
</if>
<if test="userName != null and userName != ''">
AND u.user_name like concat('%', #{userName}, '%')
</if>
<if test="status != null and status != ''">
AND u.status = #{status}
</if>
<if test="phonenumber != null and phonenumber != ''">
AND u.phonenumber like concat('%', #{phonenumber}, '%')
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
AND date_format(u.create_time,'%Y%m%d') &gt;= date_format(#{params.beginTime},'%Y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
AND date_format(u.create_time,'%Y%m%d') &lt;= date_format(#{params.endTime},'%Y%m%d')
</if>
<if test="deptId != null and deptId != 0">
AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM u_dept t WHERE find_in_set(#{deptId}, ancestors) ))
</if>
<!-- 数据范围过滤 -->
-- ${params.dataScope}
</select>
<select id="selectUUserByUserId" parameterType="Long" resultMap="UUserResult">
<include refid="selectUUserVo"/>
where user_id = #{userId}
<select id="selectAllocatedList" parameterType="UUser" resultMap="UUserResult">
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
from u_user u
left join u_dept d on u.dept_id = d.dept_id
left join u_user_role ur on u.user_id = ur.user_id
left join u_role r on r.role_id = ur.role_id
where u.del_flag = '0' and r.role_id = #{roleId}
<if test="userName != null and userName != ''">
AND u.user_name like concat('%', #{userName}, '%')
</if>
<if test="phonenumber != null and phonenumber != ''">
AND u.phonenumber like concat('%', #{phonenumber}, '%')
</if>
<!-- 数据范围过滤 -->
${params.dataScope}
</select>
<insert id="insertUUser" parameterType="UUser" useGeneratedKeys="true" keyProperty="userId">
insert into u_user
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userName != null and userName != ''">user_name,</if>
<if test="nickName != null and nickName != ''">nick_name,</if>
<if test="age != null">age,</if>
<if test="sex != null">sex,</if>
<if test="email != null">email,</if>
<if test="phone != null">phone,</if>
<if test="address != null">address,</if>
<if test="password != null">password,</if>
<if test="status != null">status,</if>
<if test="delFlag != null">del_flag,</if>
<if test="loginIp != null">login_ip,</if>
<if test="loginDate != null">login_date,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userName != null and userName != ''">#{userName},</if>
<if test="nickName != null and nickName != ''">#{nickName},</if>
<if test="age != null">#{age},</if>
<if test="sex != null">#{sex},</if>
<if test="email != null">#{email},</if>
<if test="phone != null">#{phone},</if>
<if test="address != null">#{address},</if>
<if test="password != null">#{password},</if>
<if test="status != null">#{status},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="loginIp != null">#{loginIp},</if>
<if test="loginDate != null">#{loginDate},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
<select id="selectUnallocatedList" parameterType="UUser" resultMap="UUserResult">
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
from u_user u
left join u_dept d on u.dept_id = d.dept_id
left join u_user_role ur on u.user_id = ur.user_id
left join u_role r on r.role_id = ur.role_id
where u.del_flag = '0' and (r.role_id != #{roleId} or r.role_id IS NULL)
and u.user_id not in (select u.user_id from u_user u inner join u_user_role ur on u.user_id = ur.user_id and ur.role_id = #{roleId})
<if test="userName != null and userName != ''">
AND u.user_name like concat('%', #{userName}, '%')
</if>
<if test="phonenumber != null and phonenumber != ''">
AND u.phonenumber like concat('%', #{phonenumber}, '%')
</if>
<!-- 数据范围过滤 -->
${params.dataScope}
</select>
<select id="selectUserByUserName" parameterType="String" resultMap="UUserResult">
<include refid="selectUserVo"/>
where u.user_name = #{userName} and u.del_flag = '0'
</select>
<select id="selectUserById" parameterType="Long" resultMap="UUserResult">
<include refid="selectUserVo"/>
where u.user_id = #{userId}
</select>
<select id="checkUserNameUnique" parameterType="String" resultMap="UUserResult">
select user_id, user_name from u_user where user_name = #{userName} and del_flag = '0' limit 1
</select>
<select id="checkPhoneUnique" parameterType="String" resultMap="UUserResult">
select user_id, phonenumber from u_user where phonenumber = #{phonenumber} and del_flag = '0' limit 1
</select>
<select id="checkEmailUnique" parameterType="String" resultMap="UUserResult">
select user_id, email from u_user where email = #{email} and del_flag = '0' limit 1
</select>
<insert id="insertUser" parameterType="UUser" useGeneratedKeys="true" keyProperty="userId">
insert into u_user(
<if test="userId != null and userId != 0">user_id,</if>
<if test="deptId != null and deptId != 0">dept_id,</if>
<if test="userName != null and userName != ''">user_name,</if>
<if test="nickName != null and nickName != ''">nick_name,</if>
<if test="email != null and email != ''">email,</if>
<if test="avatar != null and avatar != ''">avatar,</if>
<if test="phonenumber != null and phonenumber != ''">phonenumber,</if>
<if test="sex != null and sex != ''">sex,</if>
<if test="password != null and password != ''">password,</if>
<if test="status != null and status != ''">status,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="remark != null and remark != ''">remark,</if>
create_time
)values(
<if test="userId != null and userId != ''">#{userId},</if>
<if test="deptId != null and deptId != ''">#{deptId},</if>
<if test="userName != null and userName != ''">#{userName},</if>
<if test="nickName != null and nickName != ''">#{nickName},</if>
<if test="email != null and email != ''">#{email},</if>
<if test="avatar != null and avatar != ''">#{avatar},</if>
<if test="phonenumber != null and phonenumber != ''">#{phonenumber},</if>
<if test="sex != null and sex != ''">#{sex},</if>
<if test="password != null and password != ''">#{password},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="remark != null and remark != ''">#{remark},</if>
sysdate()
)
</insert>
<update id="updateUUser" parameterType="UUser">
update u_user
<trim prefix="SET" suffixOverrides=",">
<if test="userName != null and userName != ''">user_name = #{userName},</if>
<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
<if test="age != null">age = #{age},</if>
<if test="sex != null">sex = #{sex},</if>
<if test="email != null">email = #{email},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="address != null">address = #{address},</if>
<if test="password != null">password = #{password},</if>
<if test="status != null">status = #{status},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="loginIp != null">login_ip = #{loginIp},</if>
<if test="loginDate != null">login_date = #{loginDate},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where user_id = #{userId}
<update id="updateUser" parameterType="UUser">
update u_user
<set>
<if test="deptId != null and deptId != 0">dept_id = #{deptId},</if>
<if test="userName != null and userName != ''">user_name = #{userName},</if>
<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
<if test="email != null ">email = #{email},</if>
<if test="phonenumber != null ">phonenumber = #{phonenumber},</if>
<if test="sex != null and sex != ''">sex = #{sex},</if>
<if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
<if test="password != null and password != ''">password = #{password},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="loginIp != null and loginIp != ''">login_ip = #{loginIp},</if>
<if test="loginDate != null">login_date = #{loginDate},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if>
update_time = sysdate()
</set>
where user_id = #{userId}
</update>
<delete id="deleteUUserByUserId" parameterType="Long">
delete from u_user where user_id = #{userId}
</delete>
<delete id="deleteUUserByUserIds" parameterType="String">
delete from u_user where user_id in
<foreach item="userId" collection="array" open="(" separator="," close=")">
#{userId}
</foreach>
</delete>
</mapper>
<update id="updateUserStatus" parameterType="UUser">
update u_user set status = #{status} where user_id = #{userId}
</update>
<update id="updateUserAvatar" parameterType="UUser">
update u_user set avatar = #{avatar} where user_name = #{userName}
</update>
<update id="resetUserPwd" parameterType="UUser">
update u_user set password = #{password} where user_name = #{userName}
</update>
<delete id="deleteUserById" parameterType="Long">
update u_user set del_flag = '2' where user_id = #{userId}
</delete>
<delete id="deleteUserByIds" parameterType="Long">
update u_user set del_flag = '2' where user_id in
<foreach collection="array" item="userId" open="(" separator="," close=")">
#{userId}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.wfc.user.mapper.UUserPostMapper">
<resultMap type="UUserPost" id="UUserPostResult">
<result property="userId" column="user_id" />
<result property="postId" column="post_id" />
</resultMap>
<delete id="deleteUserPostByUserId" parameterType="Long">
delete from u_user_post where user_id=#{userId}
</delete>
<select id="countUserPostById" resultType="Integer">
select count(1) from u_user_post where post_id=#{postId}
</select>
<delete id="deleteUserPost" parameterType="Long">
delete from u_user_post where user_id in
<foreach collection="array" item="userId" open="(" separator="," close=")">
#{userId}
</foreach>
</delete>
<insert id="batchUserPost">
insert into u_user_post(user_id, post_id) values
<foreach item="item" index="index" collection="list" separator=",">
(#{item.userId},#{item.postId})
</foreach>
</insert>
</mapper>

View File

@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.wfc.user.mapper.UUserRoleMapper">
<resultMap type="UUserRole" id="UUserRoleResult">
<result property="userId" column="user_id" />
<result property="roleId" column="role_id" />
</resultMap>
<delete id="deleteUserRoleByUserId" parameterType="Long">
delete from u_user_role where user_id=#{userId}
</delete>
<select id="countUserRoleByRoleId" resultType="Integer">
select count(1) from u_user_role where role_id=#{roleId}
</select>
<delete id="deleteUserRole" parameterType="Long">
delete from u_user_role where user_id in
<foreach collection="array" item="userId" open="(" separator="," close=")">
#{userId}
</foreach>
</delete>
<insert id="batchUserRole">
insert into u_user_role(user_id, role_id) values
<foreach item="item" index="index" collection="list" separator=",">
(#{item.userId},#{item.roleId})
</foreach>
</insert>
<delete id="deleteUserRoleInfo" parameterType="UUserRole">
delete from u_user_role where user_id=#{userId} and role_id=#{roleId}
</delete>
<delete id="deleteUserRoleInfos">
delete from u_user_role where role_id=#{roleId} and user_id in
<foreach collection="userIds" item="userId" open="(" separator="," close=")">
#{userId}
</foreach>
</delete>
</mapper>