This commit is contained in:
2023-06-21 17:16:46 +08:00
parent 44fb832e64
commit 48001595d2
28 changed files with 201 additions and 79 deletions

View File

@ -11,7 +11,7 @@
Target Server Version : 50742
File Encoding : 65001
Date: 20/06/2023 21:37:10
Date: 21/06/2023 17:15:47
*/
SET NAMES utf8mb4;
@ -110,7 +110,6 @@ CREATE TABLE `sys_dict_data` (
-- ----------------------------
-- Records of sys_dict_data
-- ----------------------------
INSERT INTO `sys_dict_data` VALUES (1665587419228155906, 0, '2', '2', 'test', NULL, 'default', '1', 'admin', '2023-06-05 13:12:41', '', NULL, NULL, 1);
-- ----------------------------
-- Table structure for sys_dict_type
@ -134,8 +133,6 @@ CREATE TABLE `sys_dict_type` (
-- ----------------------------
-- Records of sys_dict_type
-- ----------------------------
INSERT INTO `sys_dict_type` VALUES (1665578778676703234, '测试', 'test', '1', 'admin', '2023-06-05 12:38:20', '', NULL, NULL, 1);
INSERT INTO `sys_dict_type` VALUES (1665587609699889154, '测试2', '测试2', '1', 'admin', '2023-06-05 13:13:26', '', NULL, NULL, 1);
-- ----------------------------
-- Table structure for sys_login_log
@ -165,7 +162,24 @@ CREATE TABLE `sys_login_log` (
-- ----------------------------
INSERT INTO `sys_login_log` VALUES (1670722570643869697, '34ca854d3c1549318b9f7b2923faf4f7', 'admin', '小王', '192.168.0.201', '0|0|0|内网IP|内网IP', 'Chrome|114.0.0.0', 'Windows 10 or Windows Server 2016', '2023-06-19 17:17:56', '', NULL, '', NULL, NULL, 1);
INSERT INTO `sys_login_log` VALUES (1670723605751959554, 'b9c055b82943483799feab5a1c0e0f46', 'admin', '小王', '192.168.0.201', '0|0|0|内网IP|内网IP', 'Chrome|114.0.0.0', 'Windows 10 or Windows Server 2016', '2023-06-19 17:22:03', '', NULL, '', NULL, NULL, 1);
INSERT INTO `sys_login_log` VALUES (1671141614265823233, '2df9958531324b25a6edcd43ec3028fc', 'admin', '小王', '127.0.0.1', '0|0|0|内网IP|内网IP', 'Chrome|108.0.0.0', 'Windows 10 or Windows Server 2016', '2023-06-20 21:03:04', '', NULL, '', NULL, NULL, 1);
INSERT INTO `sys_login_log` VALUES (1671343831271133185, '33a81da4b73c41fca53c48a96c7efa9a', 'admin', '小王', '192.168.0.201', '0|0|0|内网IP|内网IP', 'Chrome|114.0.0.0', 'Windows 10 or Windows Server 2016', '2023-06-21 10:26:36', '', NULL, '', NULL, NULL, 1);
INSERT INTO `sys_login_log` VALUES (1671345257183481858, 'b6c9b691220945a6b60e57552f1d38db', 'admin', '小王', '192.168.0.201', '0|0|0|内网IP|内网IP', 'Chrome|114.0.0.0', 'Windows 10 or Windows Server 2016', '2023-06-21 10:32:16', '', NULL, '', NULL, NULL, 1);
INSERT INTO `sys_login_log` VALUES (1671351311367794689, 'b8e80e8e5be94951ada9722879593e97', 'admin', '小王', '192.168.0.201', '0|0|0|内网IP|内网IP', 'Chrome|114.0.0.0', 'Windows 10 or Windows Server 2016', '2023-06-21 10:56:19', '', NULL, '', NULL, NULL, 1);
INSERT INTO `sys_login_log` VALUES (1671354103641796610, '8d5611fb9ed743d4b9c8dd1fa97762ef', 'admin', '小王', '192.168.0.201', '0|0|0|内网IP|内网IP', 'Chrome|114.0.0.0', 'Windows 10 or Windows Server 2016', '2023-06-21 11:07:25', '', NULL, '', NULL, NULL, 1);
INSERT INTO `sys_login_log` VALUES (1671354965323804673, '42bcaebb0f0a4f52ac46b4c994f8b106', 'admin', '小王', '192.168.0.201', '0|0|0|内网IP|内网IP', 'Chrome|114.0.0.0', 'Windows 10 or Windows Server 2016', '2023-06-21 11:10:51', '', NULL, '', NULL, NULL, 1);
INSERT INTO `sys_login_log` VALUES (1671360756479029250, '50061c2cbe424ddfad428fc1d824ed38', 'admin', '小王', '192.168.0.200', '0|0|0|内网IP|内网IP', 'Firefox|114.0', 'OSX', '2023-06-21 11:33:51', '', NULL, '', NULL, NULL, 1);
INSERT INTO `sys_login_log` VALUES (1671392710658224129, '645c7db45998449b92ca05ec1929a431', 'admin', '小王', '192.168.0.201', '0|0|0|内网IP|内网IP', 'Chrome|114.0.0.0', 'Windows 10 or Windows Server 2016', '2023-06-21 13:40:50', '', NULL, '', NULL, NULL, 1);
INSERT INTO `sys_login_log` VALUES (1671400214419021825, '18547633b2a44b6988cb0273d891711e', 'admin', '小王', '192.168.0.201', '0|0|0|内网IP|内网IP', 'Chrome|114.0.0.0', 'Windows 10 or Windows Server 2016', '2023-06-21 14:10:39', '', NULL, '', NULL, NULL, 1);
INSERT INTO `sys_login_log` VALUES (1671404237511487489, '69b7cdcc4dac4f5499c134d22681d61d', 'admin', '小王', '192.168.0.200', '0|0|0|内网IP|内网IP', 'Firefox|114.0', 'OSX', '2023-06-21 14:26:38', '', NULL, '', NULL, NULL, 1);
INSERT INTO `sys_login_log` VALUES (1671408236826488833, '568f52d5e1aa4db5ab0d239fa3869152', 'admin', '小王', '192.168.0.200', '0|0|0|内网IP|内网IP', 'Chrome|114.0.0.0', 'OSX', '2023-06-21 14:42:32', '', NULL, '', NULL, NULL, 1);
INSERT INTO `sys_login_log` VALUES (1671409521441140738, 'b76bfc803e5348859073d7e154c4a501', 'admin', '小王', '192.168.0.200', '0|0|0|内网IP|内网IP', 'Firefox|114.0', 'OSX', '2023-06-21 14:47:38', '', NULL, '', NULL, NULL, 1);
INSERT INTO `sys_login_log` VALUES (1671411391563853826, 'c8bf796f3ae74d0d8bf70ea781a01bf6', 'admin', '小王', '192.168.0.200', '0|0|0|内网IP|内网IP', 'Firefox|114.0', 'OSX', '2023-06-21 14:55:04', '', NULL, '', NULL, NULL, 1);
INSERT INTO `sys_login_log` VALUES (1671419983864033282, '78ac62045e414ceebb6546240bea4f21', 'admin', '小王', '192.168.0.201', '0|0|0|内网IP|内网IP', 'Chrome|114.0.0.0', 'Windows 10 or Windows Server 2016', '2023-06-21 15:29:12', '', NULL, '', NULL, NULL, 1);
INSERT INTO `sys_login_log` VALUES (1671420293474979842, '11a9a6aa79e94f50a5593d9d3c38c0f5', 'admin', '小王', '192.168.0.201', '0|0|0|内网IP|内网IP', 'Chrome|114.0.0.0', 'Windows 10 or Windows Server 2016', '2023-06-21 15:30:26', '', NULL, '', NULL, NULL, 1);
INSERT INTO `sys_login_log` VALUES (1671420846439436289, 'b29b306d109440d59fd6021771146804', 'admin', '小王', '192.168.0.201', '0|0|0|内网IP|内网IP', 'Chrome|114.0.0.0', 'Windows 10 or Windows Server 2016', '2023-06-21 15:32:38', '', NULL, '', NULL, NULL, 1);
INSERT INTO `sys_login_log` VALUES (1671422073659232257, '9edfad96f8154d9487c741ab7e3fb093', 'admin', '小王', '192.168.0.201', '0|0|0|内网IP|内网IP', 'Chrome|114.0.0.0', 'Windows 10 or Windows Server 2016', '2023-06-21 15:37:31', '', NULL, '', NULL, NULL, 1);
INSERT INTO `sys_login_log` VALUES (1671422330321276929, '7e25b040adb241bdb52f58d1cf04cb8a', 'admin', '小王', '192.168.0.200', '0|0|0|内网IP|内网IP', 'Firefox|114.0', 'OSX', '2023-06-21 15:38:32', '', NULL, '', NULL, NULL, 1);
INSERT INTO `sys_login_log` VALUES (1671424932798828546, '39cab58f1e9144379233c68c94a647d1', 'admin', '小王', '192.168.0.201', '0|0|0|内网IP|内网IP', 'Chrome|114.0.0.0', 'Windows 10 or Windows Server 2016', '2023-06-21 15:48:52', '', NULL, '', NULL, NULL, 1);
-- ----------------------------
-- Table structure for sys_menu
@ -244,7 +258,8 @@ INSERT INTO `sys_menu` VALUES (1033, '参数删除', 106, 4, '#', '', '', 0, 0,
INSERT INTO `sys_menu` VALUES (1046, '在线查询', 109, 1, '#', '', '', 0, 0, 'F', '1', 'monitor:online:query', '#', 'admin', '2023-05-27 22:22:59', '', NULL, '', 1);
INSERT INTO `sys_menu` VALUES (1047, '批量强退', 109, 2, '#', '', '', 0, 0, 'F', '1', 'monitor:online:batchLogout', '#', 'admin', '2023-05-27 22:22:59', '', NULL, '', 1);
INSERT INTO `sys_menu` VALUES (1048, '单条强退', 109, 3, '#', '', '', 0, 0, 'F', '1', 'monitor:online:forceLogout', '#', 'admin', '2023-05-27 22:22:59', '', NULL, '', 1);
INSERT INTO `sys_menu` VALUES (1663431933531869185, '租户管理', 1668543448450719745, 1, 'tenant', 'tenant/index', NULL, 0, 0, 'C', '1', 'tenant:list', 'logininfor', 'admin', '2023-05-30 14:27:33', 'admin', '2023-06-13 17:03:52', '', 1);
INSERT INTO `sys_menu` VALUES (1663431933531869184, '租户管理', 0, 3, 'tenant', NULL, NULL, 0, 0, 'M', '1', NULL, 'component', 'admin', '2023-06-13 16:58:53', 'admin', '2023-06-13 17:03:42', '', 1);
INSERT INTO `sys_menu` VALUES (1663431933531869185, '租户管理', 1663431933531869184, 1, 'tenant', 'tenant/index', NULL, 0, 0, 'C', '1', 'tenant:list', 'logininfor', 'admin', '2023-05-30 14:27:33', 'admin', '2023-06-13 17:03:52', '', 1);
INSERT INTO `sys_menu` VALUES (1663432090671468545, '新建租户', 1663431933531869185, 1, '', NULL, NULL, 0, 0, 'F', '1', 'tenant:add', '#', 'admin', '2023-05-30 14:28:10', '', NULL, '', 1);
INSERT INTO `sys_menu` VALUES (1663432193243172865, '修改租户', 1663431933531869185, 2, '', NULL, NULL, 0, 0, 'F', '1', 'tenant:edit', '#', 'admin', '2023-05-30 14:28:35', '', NULL, '', 1);
INSERT INTO `sys_menu` VALUES (1663446141111689218, '查询详情', 1663431933531869185, 3, '', NULL, NULL, 0, 0, 'F', '1', 'tenant:query', '#', 'admin', '2023-05-30 15:24:00', '', NULL, '', 1);
@ -253,8 +268,7 @@ INSERT INTO `sys_menu` VALUES (1666365690861600770, '修改数据源', 166343193
INSERT INTO `sys_menu` VALUES (1666365815403069442, '删除数据源', 1663431933531869185, 7, '', NULL, NULL, 0, 0, 'F', '1', 'tenant:datasource:remove', '#', 'admin', '2023-06-07 16:45:45', '', NULL, '', 1);
INSERT INTO `sys_menu` VALUES (1666365996601196545, '数据源列表', 1663431933531869185, 8, '', NULL, NULL, 0, 0, 'F', '1', 'tenant:datasource:list', '#', 'admin', '2023-06-07 16:46:28', '', NULL, '', 1);
INSERT INTO `sys_menu` VALUES (1666366412382552066, '删除租户', 1663431933531869185, 4, '', NULL, NULL, 0, 0, 'F', '1', 'tenant:remove', '#', 'admin', '2023-06-07 16:48:07', 'admin', '2023-06-13 16:52:20', '', 1);
INSERT INTO `sys_menu` VALUES (1668543448450719745, '租户管理', 0, 3, 'tenant', NULL, NULL, 0, 0, 'M', '1', NULL, 'component', 'admin', '2023-06-13 16:58:53', 'admin', '2023-06-13 17:03:42', '', 1);
INSERT INTO `sys_menu` VALUES (1668544169384468481, '租户初始化', 1668543448450719745, 2, 'initialize', 'tenant/initialize', NULL, 0, 0, 'C', '0', NULL, '#', 'admin', '2023-06-13 17:01:45', 'admin', '2023-06-13 17:03:49', '', 1);
INSERT INTO `sys_menu` VALUES (1668544169384468481, '租户初始化', 1663431933531869184, 2, 'initialize', 'tenant/initialize', NULL, 0, 0, 'C', '0', NULL, '#', 'admin', '2023-06-13 17:01:45', 'admin', '2023-06-21 15:32:27', '', 1);
INSERT INTO `sys_menu` VALUES (1670708064303742978, '登录日志', 2, 2, 'login-log', 'monitor/login_log/index', NULL, 0, 0, 'C', '1', 'monitor:login-log:list', 'documentation', 'admin', '2023-06-19 16:20:17', 'admin', '2023-06-19 16:21:59', '', 1);
INSERT INTO `sys_menu` VALUES (1670719944372002817, '日志导出', 1670708064303742978, 1, '', NULL, NULL, 0, 0, 'F', '1', 'monitor:login-log:export', '#', 'admin', '2023-06-19 17:07:30', '', NULL, '', 1);
INSERT INTO `sys_menu` VALUES (1670720034851528706, '日志清空', 1670708064303742978, 2, '', NULL, NULL, 0, 0, 'F', '1', 'monitor:login-log:remove', '#', 'admin', '2023-06-19 17:07:51', '', NULL, '', 1);
@ -309,8 +323,8 @@ CREATE TABLE `sys_role` (
-- ----------------------------
-- Records of sys_role
-- ----------------------------
INSERT INTO `sys_role` VALUES (1, '超级管理员', 'admin', 1, '1', '1', 'admin', '2023-04-23 14:35:29', 'admin', '2023-06-19 17:08:04', '超级管理员', 1);
INSERT INTO `sys_role` VALUES (1660535591067213826, '测试', 'test', 1, '4', '1', 'admin', '2023-05-22 14:38:31', 'admin', '2023-06-15 16:05:49', NULL, 1);
INSERT INTO `sys_role` VALUES (1, '超级管理员', 'admin', 1, '1', '1', 'admin', '2023-04-23 14:35:29', 'admin', '2023-06-21 15:32:48', '超级管理员', 1);
INSERT INTO `sys_role` VALUES (1660535591067213826, '测试', 'test', 1, '2', '1', 'admin', '2023-05-22 14:38:31', 'admin', '2023-06-21 15:31:52', NULL, 1);
-- ----------------------------
-- Table structure for sys_role_dept
@ -326,6 +340,9 @@ CREATE TABLE `sys_role_dept` (
-- ----------------------------
-- Records of sys_role_dept
-- ----------------------------
INSERT INTO `sys_role_dept` VALUES (1660535591067213826, 1659442897402212353, 1);
INSERT INTO `sys_role_dept` VALUES (1660535591067213826, 1659443064624918529, 1);
INSERT INTO `sys_role_dept` VALUES (1660535591067213826, 1659443256656932865, 1);
-- ----------------------------
-- Table structure for sys_role_menu
@ -388,6 +405,7 @@ INSERT INTO `sys_role_menu` VALUES (1, 1033, 1);
INSERT INTO `sys_role_menu` VALUES (1, 1046, 1);
INSERT INTO `sys_role_menu` VALUES (1, 1047, 1);
INSERT INTO `sys_role_menu` VALUES (1, 1048, 1);
INSERT INTO `sys_role_menu` VALUES (1, 1663431933531869184, 1);
INSERT INTO `sys_role_menu` VALUES (1, 1663431933531869185, 1);
INSERT INTO `sys_role_menu` VALUES (1, 1663432090671468545, 1);
INSERT INTO `sys_role_menu` VALUES (1, 1663432193243172865, 1);
@ -396,18 +414,12 @@ INSERT INTO `sys_role_menu` VALUES (1, 1666365593968984065, 1);
INSERT INTO `sys_role_menu` VALUES (1, 1666365690861600770, 1);
INSERT INTO `sys_role_menu` VALUES (1, 1666365815403069442, 1);
INSERT INTO `sys_role_menu` VALUES (1, 1666365996601196545, 1);
INSERT INTO `sys_role_menu` VALUES (1, 1666366412382552066, 1);
INSERT INTO `sys_role_menu` VALUES (1, 1668543448450719745, 1);
INSERT INTO `sys_role_menu` VALUES (1, 1668544169384468481, 1);
INSERT INTO `sys_role_menu` VALUES (1, 1670708064303742978, 1);
INSERT INTO `sys_role_menu` VALUES (1, 1670719944372002817, 1);
INSERT INTO `sys_role_menu` VALUES (1, 1670720034851528706, 1);
INSERT INTO `sys_role_menu` VALUES (1660535591067213826, 1, 1);
INSERT INTO `sys_role_menu` VALUES (1660535591067213826, 2, 1);
INSERT INTO `sys_role_menu` VALUES (1660535591067213826, 100, 1);
INSERT INTO `sys_role_menu` VALUES (1660535591067213826, 101, 1);
INSERT INTO `sys_role_menu` VALUES (1660535591067213826, 102, 1);
INSERT INTO `sys_role_menu` VALUES (1660535591067213826, 103, 1);
INSERT INTO `sys_role_menu` VALUES (1660535591067213826, 104, 1);
INSERT INTO `sys_role_menu` VALUES (1660535591067213826, 105, 1);
INSERT INTO `sys_role_menu` VALUES (1660535591067213826, 106, 1);
@ -428,10 +440,6 @@ INSERT INTO `sys_role_menu` VALUES (1660535591067213826, 1012, 1);
INSERT INTO `sys_role_menu` VALUES (1660535591067213826, 1013, 1);
INSERT INTO `sys_role_menu` VALUES (1660535591067213826, 1014, 1);
INSERT INTO `sys_role_menu` VALUES (1660535591067213826, 1015, 1);
INSERT INTO `sys_role_menu` VALUES (1660535591067213826, 1016, 1);
INSERT INTO `sys_role_menu` VALUES (1660535591067213826, 1017, 1);
INSERT INTO `sys_role_menu` VALUES (1660535591067213826, 1018, 1);
INSERT INTO `sys_role_menu` VALUES (1660535591067213826, 1019, 1);
INSERT INTO `sys_role_menu` VALUES (1660535591067213826, 1020, 1);
INSERT INTO `sys_role_menu` VALUES (1660535591067213826, 1021, 1);
INSERT INTO `sys_role_menu` VALUES (1660535591067213826, 1022, 1);
@ -449,17 +457,6 @@ INSERT INTO `sys_role_menu` VALUES (1660535591067213826, 1033, 1);
INSERT INTO `sys_role_menu` VALUES (1660535591067213826, 1046, 1);
INSERT INTO `sys_role_menu` VALUES (1660535591067213826, 1047, 1);
INSERT INTO `sys_role_menu` VALUES (1660535591067213826, 1048, 1);
INSERT INTO `sys_role_menu` VALUES (1660535591067213826, 1663431933531869185, 1);
INSERT INTO `sys_role_menu` VALUES (1660535591067213826, 1663432090671468545, 1);
INSERT INTO `sys_role_menu` VALUES (1660535591067213826, 1663432193243172865, 1);
INSERT INTO `sys_role_menu` VALUES (1660535591067213826, 1663446141111689218, 1);
INSERT INTO `sys_role_menu` VALUES (1660535591067213826, 1666365593968984065, 1);
INSERT INTO `sys_role_menu` VALUES (1660535591067213826, 1666365690861600770, 1);
INSERT INTO `sys_role_menu` VALUES (1660535591067213826, 1666365815403069442, 1);
INSERT INTO `sys_role_menu` VALUES (1660535591067213826, 1666365996601196545, 1);
INSERT INTO `sys_role_menu` VALUES (1660535591067213826, 1666366412382552066, 1);
INSERT INTO `sys_role_menu` VALUES (1660535591067213826, 1668543448450719745, 1);
INSERT INTO `sys_role_menu` VALUES (1660535591067213826, 1668544169384468481, 1);
-- ----------------------------
-- Table structure for sys_tenant
@ -522,8 +519,8 @@ CREATE TABLE `sys_tenant_datasource` (
-- ----------------------------
-- Records of sys_tenant_datasource
-- ----------------------------
INSERT INTO `sys_tenant_datasource` VALUES (166160396877907998, 'MySQL', '192.168.0.202', '3306', 'qiaoba-boot', 'root', 'Root123456789.', 5, 10, 20, '0', 'admin', '2023-06-07 14:36:11', '', NULL, NULL, 2);
INSERT INTO `sys_tenant_datasource` VALUES (166160396877907999, 'Oracle', '101.34.251.155', '1521', 'ORCL', 'ROOT', 'root', 5, 10, 20, '1', 'admin', '2023-06-07 14:36:11', '', NULL, NULL, 2);
INSERT INTO `sys_tenant_datasource` VALUES (166160396877907998, 'MySQL', '192.168.0.202', '3306', 'qiaoba-boot', 'root', 'Root123456789.', 5, 10, 20, '1', 'admin', '2023-06-07 14:36:11', '', NULL, NULL, 2);
INSERT INTO `sys_tenant_datasource` VALUES (166160396877907999, 'Oracle', '101.34.251.155', '1521', 'ORCL', 'ROOT', 'root', 5, 10, 20, '0', 'admin', '2023-06-07 14:36:11', '', NULL, NULL, 2);
INSERT INTO `sys_tenant_datasource` VALUES (166160396877908000, 'PostgreSQL', '192.168.0.202', '5432', 'qiaoba-boot', 'postgres', 'postgres', 5, 10, 20, '0', 'admin', '2023-06-07 14:36:11', '', NULL, NULL, 2);
-- ----------------------------

View File

@ -1,6 +1,7 @@
package com.qiaoba.api.system.entity;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.qiaoba.common.base.entity.BaseEntity;
@ -37,6 +38,18 @@ public class SysRole extends BaseEntity {
@Excel(name = "数据范围", width = 20, replace = {"所有数据权限_1", "自定义数据权限_2", "本部门数据权限_3", "本部门及以下数据权限_4", "仅本人数据权限_5"})
private String dataScope;
/**
* 菜单树选择项是否关联显示( 0父子不互相关联显示 1父子互相关联显示
*/
@TableField(exist = false)
private final boolean menuCheckStrictly = true;
/**
* 部门树选择项是否关联显示0父子不互相关联显示 1父子互相关联显示
*/
@TableField(exist = false)
private final boolean deptCheckStrictly = true;
@Excel(name = "状态", width = 20, replace = {"正常_1", "禁用_0"})
private String status;

View File

@ -33,7 +33,7 @@ mybatis-plus:
# MyBatis 自动映射时未知列或未知属性处理策
# NONE不做处理 WARNING打印相关警告 FAILING抛出异常和详细信息
autoMappingUnknownColumnBehavior: NONE
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
#log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
logging:
level:

View File

@ -54,7 +54,7 @@ qiaoba:
- /swagger-resources
- /v3/api-docs/**
- /druid/**
- /file/**
- /resource/**
- /login
- /register
- /captchaImage

View File

@ -0,0 +1,33 @@
package com.qiaoba.common.base.utils;
import cn.hutool.core.util.ClassUtil;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
/**
* 注解Util
*
* @author ailanyin
* @version 1.0
* @since 2023/6/21 9:53
*/
public class AnnotationUtil extends cn.hutool.core.annotation.AnnotationUtil {
public static boolean hasAnnotation(String referenceMethod, Class<? extends Annotation> annotation) {
// com.qiaoba.common.base.utils.AnnotationUtil.hasAnnotation
StringBuilder sb = new StringBuilder(referenceMethod);
int index = sb.lastIndexOf(".");
// com.qiaoba.common.base.utils.AnnotationUtil
String clazzName = sb.substring(0, index);
// hasAnnotation
String methodName = sb.substring(index + 1, sb.length());
Class<?> clazz = ClassUtil.loadClass(clazzName);
for (Method method : clazz.getDeclaredMethods()) {
if (methodName.equals(method.getName())) {
return hasAnnotation(method, annotation);
}
}
return false;
}
}

View File

@ -0,0 +1,16 @@
package com.qiaoba.common.database.annotations;
import java.lang.annotation.*;
/**
* 只查询一条数据
*
* @author ailanyin
* @version 1.0
* @since 2023/6/21 10:10
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface SelectOneRow {
}

View File

@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerIntercept
import com.baomidou.mybatisplus.extension.plugins.inner.TenantLineInnerInterceptor;
import com.qiaoba.common.base.context.BaseContext;
import com.qiaoba.common.database.interceptors.SchemaInterceptor;
import com.qiaoba.common.database.interceptors.SelectOneRowInterceptor;
import net.sf.jsqlparser.expression.Expression;
import net.sf.jsqlparser.expression.StringValue;
import org.springframework.context.annotation.Bean;
@ -45,6 +46,7 @@ public class MybatisPlusConfig {
return IGNORE_TABLES.contains(tableName);
}
}));
interceptor.addInnerInterceptor(new SelectOneRowInterceptor());
interceptor.addInnerInterceptor(new PaginationInnerInterceptor());
return interceptor;
}

View File

@ -47,12 +47,4 @@ public class PageQuery implements Serializable {
return new Page<>(pageNum, pageSize);
}
/**
* 只查第一条数据
*
* @return page
*/
public static Page limit1() {
return new Page<>(1, 1);
}
}

View File

@ -0,0 +1,53 @@
package com.qiaoba.common.database.interceptors;
import com.baomidou.mybatisplus.core.toolkit.PluginUtils;
import com.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.pagination.DialectFactory;
import com.baomidou.mybatisplus.extension.plugins.pagination.DialectModel;
import com.baomidou.mybatisplus.extension.plugins.pagination.dialects.IDialect;
import com.baomidou.mybatisplus.extension.toolkit.JdbcUtils;
import com.qiaoba.common.base.utils.AnnotationUtil;
import com.qiaoba.common.database.annotations.SelectOneRow;
import org.apache.ibatis.executor.Executor;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.mapping.ParameterMapping;
import org.apache.ibatis.session.Configuration;
import org.apache.ibatis.session.ResultHandler;
import org.apache.ibatis.session.RowBounds;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
/**
* 查询一条
* 因为Oracle 不支持 limit 1 写法, 故调用MP的分页方言处理
*
* @author ailanyin
* @version 1.0
* @since 2023/6/21 8:53
*/
public class SelectOneRowInterceptor implements InnerInterceptor {
@Override
public void beforeQuery(Executor executor, MappedStatement ms, Object parameter, RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql) throws SQLException {
if (AnnotationUtil.hasAnnotation(ms.getId(), SelectOneRow.class)) {
String buildSql = boundSql.getSql();
IDialect dialect = DialectFactory.getDialect(JdbcUtils.getDbType(executor));
DialectModel model = dialect.buildPaginationSql(buildSql, 0, 1);
replaceSql(ms, boundSql, model);
}
}
private void replaceSql(MappedStatement ms, BoundSql boundSql, DialectModel model) {
PluginUtils.MPBoundSql mpBoundSql = PluginUtils.mpBoundSql(boundSql);
final Configuration configuration = ms.getConfiguration();
List<ParameterMapping> mappings = mpBoundSql.parameterMappings();
Map<String, Object> additionalParameter = mpBoundSql.additionalParameters();
model.consumers(mappings, configuration, additionalParameter);
mpBoundSql.sql(model.getDialectSql());
mpBoundSql.parameterMappings(mappings);
}
}

View File

@ -1,9 +1,8 @@
package com.qiaoba.module.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qiaoba.api.system.entity.SysConfig;
import org.apache.ibatis.annotations.Param;
import com.qiaoba.common.database.annotations.SelectOneRow;
import java.util.List;
@ -19,11 +18,11 @@ public interface SysConfigMapper extends BaseMapper<SysConfig> {
/**
* 校验参数键名是否唯一
*
* @param page 分页信息
* @param sysConfig 参数配置信息
* @return 结果
*/
String checkKeyIsExist(Page page, @Param("sysConfig") SysConfig sysConfig);
@SelectOneRow
String checkKeyIsExist(SysConfig sysConfig);
/**
* 通过主键批量查询列表

View File

@ -2,6 +2,7 @@ package com.qiaoba.module.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qiaoba.api.system.entity.SysDept;
import com.qiaoba.common.database.annotations.SelectOneRow;
import java.util.List;
@ -20,6 +21,7 @@ public interface SysDeptMapper extends BaseMapper<SysDept> {
* @param dept 部门信息
* @return 结果
*/
@SelectOneRow
int checkDeptNameUnique(SysDept dept);
/**
@ -36,6 +38,7 @@ public interface SysDeptMapper extends BaseMapper<SysDept> {
* @param deptId deptId
* @return != null -> 是
*/
@SelectOneRow
String existChild(String deptId);
/**
@ -44,6 +47,7 @@ public interface SysDeptMapper extends BaseMapper<SysDept> {
* @param deptId deptId
* @return != null -> 是
*/
@SelectOneRow
String existUsed(String deptId);
}

View File

@ -2,7 +2,15 @@ package com.qiaoba.module.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qiaoba.api.system.entity.SysDictData;
import com.qiaoba.common.database.annotations.SelectOneRow;
/**
* 字典数据管理 数据层
*
* @author ailanyin
* @version 1.0
* @since 2022-09-22 04:20:28
*/
public interface SysDictDataMapper extends BaseMapper<SysDictData> {
/**
@ -11,6 +19,7 @@ public interface SysDictDataMapper extends BaseMapper<SysDictData> {
* @param sysDictData sysDictData
* @return 已存在的值
*/
@SelectOneRow
String checkDictLabelUnique(SysDictData sysDictData);
/**
@ -19,5 +28,6 @@ public interface SysDictDataMapper extends BaseMapper<SysDictData> {
* @param sysDictData sysDictData
* @return 已存在的值
*/
@SelectOneRow
String checkDictValueUnique(SysDictData sysDictData);
}

View File

@ -1,9 +1,8 @@
package com.qiaoba.module.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qiaoba.api.system.entity.SysDictType;
import org.apache.ibatis.annotations.Param;
import com.qiaoba.common.database.annotations.SelectOneRow;
import java.util.List;
@ -19,18 +18,18 @@ public interface SysDictTypeMapper extends BaseMapper<SysDictType> {
/**
* 校验字典类型是否唯一
*
* @param page 分页参数
* @param sysDictType 字典类型
* @return dictType
*/
String checkDictTypeUnique(Page page, @Param("sysDictType") SysDictType sysDictType);
@SelectOneRow
String checkDictTypeUnique(SysDictType sysDictType);
/**
* 校验是否允许删除
*
* @param page 分页参数
* @param ids ids
* @param ids ids
* @return typeName
*/
String checkAllowDelete(Page page, @Param("list") List<String> ids);
@SelectOneRow
String checkAllowDelete(List<String> ids);
}

View File

@ -2,6 +2,7 @@ package com.qiaoba.module.system.mapper;
import com.qiaoba.api.system.entity.SysMenu;
import com.qiaoba.api.system.entity.vo.SysMenuVo;
import com.qiaoba.common.database.annotations.SelectOneRow;
import com.qiaoba.common.database.mapper.BaseMapperPlus;
import java.util.List;
@ -22,6 +23,7 @@ public interface SysMenuMapper extends BaseMapperPlus<SysMenuMapper, SysMenu, Sy
* @param sysMenu 菜单
* @return count
*/
@SelectOneRow
String checkMenuNameUnique(SysMenu sysMenu);
/**
@ -30,6 +32,7 @@ public interface SysMenuMapper extends BaseMapperPlus<SysMenuMapper, SysMenu, Sy
* @param menuId menuId
* @return != null -> 是
*/
@SelectOneRow
String existChild(String menuId);
/**
@ -38,6 +41,7 @@ public interface SysMenuMapper extends BaseMapperPlus<SysMenuMapper, SysMenu, Sy
* @param menuId menuId
* @return 绑定的角色名称
*/
@SelectOneRow
String existUsed(String menuId);
/**

View File

@ -2,6 +2,7 @@ package com.qiaoba.module.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qiaoba.api.system.entity.SysPost;
import com.qiaoba.common.database.annotations.SelectOneRow;
/**
* 岗位管理 数据层
@ -18,6 +19,7 @@ public interface SysPostMapper extends BaseMapper<SysPost> {
* @param sysPost 岗位名称
* @return 结果
*/
@SelectOneRow
String checkPostNameUnique(SysPost sysPost);
/**
@ -26,6 +28,7 @@ public interface SysPostMapper extends BaseMapper<SysPost> {
* @param sysPost 岗位编码
* @return 结果
*/
@SelectOneRow
String checkPostCodeUnique(SysPost sysPost);
}

View File

@ -2,6 +2,7 @@ package com.qiaoba.module.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qiaoba.api.system.entity.SysRole;
import com.qiaoba.common.database.annotations.SelectOneRow;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -21,6 +22,7 @@ public interface SysRoleMapper extends BaseMapper<SysRole> {
* @param role role
* @return != null -> 不唯一
*/
@SelectOneRow
String checkRoleNameUnique(SysRole role);
/**
@ -29,6 +31,7 @@ public interface SysRoleMapper extends BaseMapper<SysRole> {
* @param role role
* @return != null -> 不唯一
*/
@SelectOneRow
String checkRoleKeyUnique(SysRole role);
/**
@ -37,6 +40,7 @@ public interface SysRoleMapper extends BaseMapper<SysRole> {
* @param ids ids
* @return 已绑定的人名
*/
@SelectOneRow
String selectBindUserByRoleId(@Param("list") List<String> ids);
/**

View File

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qiaoba.api.system.entity.SysUser;
import com.qiaoba.api.system.entity.param.SysUserParam;
import com.qiaoba.api.system.entity.vo.SysUserVo;
import com.qiaoba.common.database.annotations.SelectOneRow;
import com.qiaoba.module.system.templates.SysUserExport;
import org.apache.ibatis.annotations.Param;
@ -25,6 +26,7 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
* @param sysUser sysUser
* @return count
*/
@SelectOneRow
int checkUsernameUnique(SysUser sysUser);
/**
@ -33,6 +35,7 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
* @param sysUser sysUser
* @return count
*/
@SelectOneRow
int checkPhoneUnique(SysUser sysUser);
/**
@ -41,6 +44,7 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
* @param sysUser sysUser
* @return count
*/
@SelectOneRow
int checkEmailUnique(SysUser sysUser);
/**

View File

@ -130,7 +130,7 @@ public class SysConfigServiceImpl implements SysConfigService {
}
private void checkKeyIsExist(SysConfig sysConfig) {
if (StrUtil.isNotBlank(sysConfigMapper.checkKeyIsExist(PageQuery.limit1(), sysConfig))) {
if (StrUtil.isNotBlank(sysConfigMapper.checkKeyIsExist(sysConfig))) {
throw new ServiceException(ConfigErrorCode.KEY_EXIST.getCode(), ConfigErrorCode.KEY_EXIST.getMsg());
}
}

View File

@ -69,14 +69,14 @@ public class SysDictTypeServiceImpl implements SysDictTypeService {
private void checkAllowInsertOrUpdate(SysDictType sysDictType) {
String dictType = sysDictTypeMapper.checkDictTypeUnique(PageQuery.limit1(), sysDictType);
String dictType = sysDictTypeMapper.checkDictTypeUnique(sysDictType);
if (StrUtil.isNotBlank(dictType)) {
throw new ServiceException(DictErrorCode.TYPE_EXIST.getCode(), StrUtil.format(DictErrorCode.TYPE_EXIST.getMsg(), dictType));
}
}
private void checkAllowDelete(List<String> ids) {
String typeName = sysDictTypeMapper.checkAllowDelete(PageQuery.limit1(), ids);
String typeName = sysDictTypeMapper.checkAllowDelete(ids);
if (StrUtil.isNotBlank(typeName)) {
throw new ServiceException(DictErrorCode.HAS_DATA.getCode(), StrUtil.format(DictErrorCode.HAS_DATA.getMsg(), typeName));
}

View File

@ -5,9 +5,9 @@
<mapper namespace="com.qiaoba.module.system.mapper.SysConfigMapper">
<select id="checkKeyIsExist" resultType="string">
select config_key from sys_config
where config_key = #{sysConfig.configKey}
<if test="sysConfig.configId !=null">
and config_id != #{sysConfig.configId}
where config_key = #{configKey}
<if test="configId !=null">
and config_id != #{configId}
</if>
</select>

View File

@ -8,7 +8,6 @@
select count(1) from sys_dept
where dept_name = #{deptName} and parent_id = #{parentId}
<if test="deptId != null and deptId != ''">and dept_id != #{deptId}</if>
limit 1
</select>
<select id="selectDeptIdsByRoleId" resultType="string">
@ -20,11 +19,11 @@
</select>
<select id="existChild" resultType="string">
SELECT dept_id FROM sys_dept where parent_id = #{deptId} LIMIT 1
SELECT dept_id FROM sys_dept where parent_id = #{deptId}
</select>
<select id="existUsed" resultType="string">
SELECT nickname from sys_user where dept_id = #{deptId} limit 1
SELECT nickname from sys_user where dept_id = #{deptId}
</select>
</mapper>

View File

@ -9,7 +9,6 @@
<if test="dictCode != null and dictCode != ''">
and dict_code != #{dictCode}
</if>
limit 1
</select>
<select id="checkDictValueUnique" resultType="string">
@ -17,6 +16,5 @@
<if test="dictCode != null and dictCode != ''">
and dict_code != #{dictCode}
</if>
limit 1
</select>
</mapper>

View File

@ -6,9 +6,9 @@
<select id="checkDictTypeUnique" resultType="string">
select dict_type from sys_dict_type
where dict_type = #{sysDictType.dictType}
<if test="sysDictType.dictId != null and sysDictType.dictId != ''">
and dict_id != #{sysDictType.dictId}
where dict_type = #{dictType}
<if test="dictId != null and dictId != ''">
and dict_id != #{dictId}
</if>
</select>

View File

@ -13,7 +13,7 @@
</select>
<select id="existChild" resultType="string">
select menu_id from sys_menu where parent_id = #{menuId} limit 1
select menu_id from sys_menu where parent_id = #{menuId}
</select>
<select id="existUsed" resultType="string">
@ -21,7 +21,7 @@
FROM sys_role_menu t1
left join sys_role t2
on t1.role_id = t2.role_id
where t1.menu_id = #{menuId} limit 1
where t1.menu_id = #{menuId}
</select>
<select id="selectMenuIdsByRoleId" resultType="string">

View File

@ -10,7 +10,6 @@
<if test="postId != null and postId != ''">
and post_id != #{postId}
</if>
limit 1
</select>
<select id="checkPostCodeUnique" resultType="string">
@ -19,7 +18,6 @@
<if test="postId != null and postId != ''">
and post_id != #{postId}
</if>
limit 1
</select>
</mapper>

View File

@ -10,7 +10,6 @@
<if test="roleId != null and roleId != 0">
and role_id != #{roleId}
</if>
limit 1
</select>
<select id="checkRoleKeyUnique" parameterType="String" resultType="string">
@ -19,7 +18,6 @@
<if test="roleId != null and roleId != 0">
and role_id != #{roleId}
</if>
limit 1
</select>
<select id="selectBindUserByRoleId" resultType="string">
@ -31,6 +29,5 @@
<foreach collection="list" item="roleId" open="(" separator="," close=")">
#{roleId}
</foreach>
LIMIT 1
</select>
</mapper>

View File

@ -150,19 +150,16 @@
<select id="checkUsernameUnique" resultType="int">
select count(*) from sys_user where username = #{username}
<if test="userId != null and userId != ''">and user_id != #{userId}</if>
limit 1
</select>
<select id="checkPhoneUnique" resultType="int">
select count(*) from sys_user where phone = #{phone}
<if test="userId != null and userId != ''">and user_id != #{userId}</if>
limit 1
</select>
<select id="checkEmailUnique" resultType="int">
select count(*) from sys_user where email = #{email}
<if test="userId != null and userId != ''">and user_id != #{userId}</if>
limit 1
</select>
</mapper>

View File

@ -44,7 +44,7 @@ public class DynamicDataSourceFilter extends OncePerRequestFilter {
private DynamicDataSourceConfig dynamicDataSourceConfig;
private static final List<String> NOT_NEED_TENANT_URIS = ListUtil.toList("/**/*.html",
"/**/*.css", "/**/*.js", "/swagger-resources", "/v3/api-docs/**", "/favicon.ico");
"/**/*.css", "/**/*.js", "/swagger-resources", "/v3/api-docs/**", "/favicon.ico","/resource/**");
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {