From d2b7843d971e3321348f88434f3420aad640083f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Mon, 29 Nov 2021 16:41:20 +0800 Subject: [PATCH 001/119] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8D=20count=20?= =?UTF-8?q?=E8=AF=AD=E6=B3=95=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ruoyi/system/service/impl/SysUserServiceImpl.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java index 62d497d45..86f4642ba 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java @@ -180,7 +180,6 @@ public String checkUserNameUnique(String userName) { public String checkPhoneUnique(SysUser user) { Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId(); long count = count(new LambdaQueryWrapper() - .select(SysUser::getUserId, SysUser::getPhonenumber) .eq(SysUser::getPhonenumber, user.getPhonenumber()) .ne(SysUser::getUserId, userId)); if (count > 0) { @@ -199,7 +198,6 @@ public String checkPhoneUnique(SysUser user) { public String checkEmailUnique(SysUser user) { Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId(); long count = count(new LambdaQueryWrapper() - .select(SysUser::getUserId, SysUser::getEmail) .eq(SysUser::getEmail, user.getEmail()) .ne(SysUser::getUserId, userId)); if (count > 0) { From 230d19a7aa3880b8afc4521416f7cdf94d49c2a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Mon, 29 Nov 2021 16:46:27 +0800 Subject: [PATCH 002/119] =?UTF-8?q?update=20=E8=B0=83=E6=95=B4=20OSS=20?= =?UTF-8?q?=E8=A1=A8=E5=AD=97=E6=AE=B5=E5=86=85=E5=AE=B9=E9=95=BF=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script/sql/ry_20210908.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/script/sql/ry_20210908.sql b/script/sql/ry_20210908.sql index 4df76f655..428c24a03 100644 --- a/script/sql/ry_20210908.sql +++ b/script/sql/ry_20210908.sql @@ -644,10 +644,10 @@ create table gen_table_column ( drop table if exists sys_oss; create table sys_oss ( oss_id bigint(20) not null auto_increment comment '对象存储主键', - file_name varchar(64) not null default '' comment '文件名', - original_name varchar(64) not null default '' comment '原名', + file_name varchar(255) not null default '' comment '文件名', + original_name varchar(255) not null default '' comment '原名', file_suffix varchar(10) not null default '' comment '文件后缀名', - url varchar(200) not null comment 'URL地址', + url varchar(500) not null comment 'URL地址', create_time datetime default null comment '创建时间', create_by varchar(64) default '' comment '上传人', update_time datetime default null comment '更新时间', From 34f2552cad396ce79a7cf4a50a15ff8bf5d817b6 Mon Sep 17 00:00:00 2001 From: fuzui <73400@163.com> Date: Tue, 30 Nov 2021 00:17:12 +0800 Subject: [PATCH 003/119] =?UTF-8?q?fix:=20crontab=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E4=BA=92=E6=96=A5bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/src/components/Crontab/day.vue | 19 +++++----------- ruoyi-ui/src/components/Crontab/hour.vue | 14 +++--------- ruoyi-ui/src/components/Crontab/index.vue | 7 +++++- ruoyi-ui/src/components/Crontab/min.vue | 4 ---- ruoyi-ui/src/components/Crontab/month.vue | 20 +++-------------- ruoyi-ui/src/components/Crontab/second.vue | 1 - ruoyi-ui/src/components/Crontab/week.vue | 25 +++++----------------- ruoyi-ui/src/components/Crontab/year.vue | 15 ------------- 8 files changed, 22 insertions(+), 83 deletions(-) diff --git a/ruoyi-ui/src/components/Crontab/day.vue b/ruoyi-ui/src/components/Crontab/day.vue index bf9f5664e..bccd1d7a8 100644 --- a/ruoyi-ui/src/components/Crontab/day.vue +++ b/ruoyi-ui/src/components/Crontab/day.vue @@ -72,23 +72,14 @@ export default { // 单选按钮值变化时 radioChange() { ('day rachange'); - if (this.radioValue === 1) { - this.$emit('update', 'day', '*', 'day'); - this.$emit('update', 'week', '?', 'day'); - this.$emit('update', 'month', '*', 'day'); - } else { - if (this.cron.hour === '*') { - this.$emit('update', 'hour', '0', 'day'); - } - if (this.cron.min === '*') { - this.$emit('update', 'min', '0', 'day'); - } - if (this.cron.second === '*') { - this.$emit('update', 'second', '0', 'day'); - } + if (this.radioValue !== 2 && this.cron.week !== '?') { + this.$emit('update', 'week', '?', 'day') } switch (this.radioValue) { + case 1: + this.$emit('update', 'day', '*'); + break; case 2: this.$emit('update', 'day', '?'); break; diff --git a/ruoyi-ui/src/components/Crontab/hour.vue b/ruoyi-ui/src/components/Crontab/hour.vue index 5a1e14678..131edc9ce 100644 --- a/ruoyi-ui/src/components/Crontab/hour.vue +++ b/ruoyi-ui/src/components/Crontab/hour.vue @@ -51,18 +51,10 @@ export default { methods: { // 单选按钮值变化时 radioChange() { - if (this.radioValue === 1) { - this.$emit('update', 'hour', '*', 'hour'); - this.$emit('update', 'day', '*', 'hour'); - } else { - if (this.cron.min === '*') { - this.$emit('update', 'min', '0', 'hour'); - } - if (this.cron.second === '*') { - this.$emit('update', 'second', '0', 'hour'); - } - } switch (this.radioValue) { + case 1: + this.$emit('update', 'hour', '*') + break; case 2: this.$emit('update', 'hour', this.cycle01 + '-' + this.cycle02); break; diff --git a/ruoyi-ui/src/components/Crontab/index.vue b/ruoyi-ui/src/components/Crontab/index.vue index 27b4ab36c..bd863b1b6 100644 --- a/ruoyi-ui/src/components/Crontab/index.vue +++ b/ruoyi-ui/src/components/Crontab/index.vue @@ -2,7 +2,12 @@
- + diff --git a/ruoyi-ui/src/components/Crontab/min.vue b/ruoyi-ui/src/components/Crontab/min.vue index 980c4e768..79e435b0c 100644 --- a/ruoyi-ui/src/components/Crontab/min.vue +++ b/ruoyi-ui/src/components/Crontab/min.vue @@ -52,13 +52,9 @@ export default { methods: { // 单选按钮值变化时 radioChange() { - if (this.radioValue !== 1 && this.cron.second === '*') { - this.$emit('update', 'second', '0', 'min'); - } switch (this.radioValue) { case 1: this.$emit('update', 'min', '*', 'min'); - this.$emit('update', 'hour', '*', 'min'); break; case 2: this.$emit('update', 'min', this.cycle01 + '-' + this.cycle02, 'min'); diff --git a/ruoyi-ui/src/components/Crontab/month.vue b/ruoyi-ui/src/components/Crontab/month.vue index 619d1e791..a7e52e1f8 100644 --- a/ruoyi-ui/src/components/Crontab/month.vue +++ b/ruoyi-ui/src/components/Crontab/month.vue @@ -51,24 +51,10 @@ export default { methods: { // 单选按钮值变化时 radioChange() { - if (this.radioValue === 1) { - this.$emit('update', 'month', '*'); - this.$emit('update', 'year', '*'); - } else { - if (this.cron.day === '*') { - this.$emit('update', 'day', '0', 'month'); - } - if (this.cron.hour === '*') { - this.$emit('update', 'hour', '0', 'month'); - } - if (this.cron.min === '*') { - this.$emit('update', 'min', '0', 'month'); - } - if (this.cron.second === '*') { - this.$emit('update', 'second', '0', 'month'); - } - } switch (this.radioValue) { + case 1: + this.$emit('update', 'month', '*'); + break; case 2: this.$emit('update', 'month', this.cycle01 + '-' + this.cycle02); break; diff --git a/ruoyi-ui/src/components/Crontab/second.vue b/ruoyi-ui/src/components/Crontab/second.vue index 0fdf3386d..40815fb09 100644 --- a/ruoyi-ui/src/components/Crontab/second.vue +++ b/ruoyi-ui/src/components/Crontab/second.vue @@ -54,7 +54,6 @@ export default { switch (this.radioValue) { case 1: this.$emit('update', 'second', '*', 'second'); - this.$emit('update', 'min', '*', 'second'); break; case 2: this.$emit('update', 'second', this.cycle01 + '-' + this.cycle02); diff --git a/ruoyi-ui/src/components/Crontab/week.vue b/ruoyi-ui/src/components/Crontab/week.vue index 5ad949d6b..8cc82e208 100644 --- a/ruoyi-ui/src/components/Crontab/week.vue +++ b/ruoyi-ui/src/components/Crontab/week.vue @@ -67,27 +67,13 @@ export default { methods: { // 单选按钮值变化时 radioChange() { - if (this.radioValue === 1) { - this.$emit('update', 'week', '*'); - this.$emit('update', 'year', '*'); - } else { - if (this.cron.month === '*') { - this.$emit('update', 'month', '0', 'week'); - } - if (this.cron.day === '*') { - this.$emit('update', 'day', '0', 'week'); - } - if (this.cron.hour === '*') { - this.$emit('update', 'hour', '0', 'week'); - } - if (this.cron.min === '*') { - this.$emit('update', 'min', '0', 'week'); - } - if (this.cron.second === '*') { - this.$emit('update', 'second', '0', 'week'); - } + if (this.radioValue !== 2 && this.cron.day !== '?') { + this.$emit('update', 'day', '?', 'week'); } switch (this.radioValue) { + case 1: + this.$emit('update', 'week', '*'); + break; case 2: this.$emit('update', 'week', '?'); break; @@ -105,7 +91,6 @@ export default { break; } }, - // 根据互斥事件,更改radio的值 // 周期两个值变化时 cycleChange() { diff --git a/ruoyi-ui/src/components/Crontab/year.vue b/ruoyi-ui/src/components/Crontab/year.vue index 800dfa522..16a2b04f3 100644 --- a/ruoyi-ui/src/components/Crontab/year.vue +++ b/ruoyi-ui/src/components/Crontab/year.vue @@ -59,21 +59,6 @@ export default { methods: { // 单选按钮值变化时 radioChange() { - if (this.cron.month === '*') { - this.$emit('update', 'month', '0', 'year'); - } - if (this.cron.day === '*') { - this.$emit('update', 'day', '0', 'year'); - } - if (this.cron.hour === '*') { - this.$emit('update', 'hour', '0', 'year'); - } - if (this.cron.min === '*') { - this.$emit('update', 'min', '0', 'year'); - } - if (this.cron.second === '*') { - this.$emit('update', 'second', '0', 'year'); - } switch (this.radioValue) { case 1: this.$emit('update', 'year', ''); From ca285f5e53aea0dae4fb1db8e46a0c0cb70afa29 Mon Sep 17 00:00:00 2001 From: fuzui <73400@163.com> Date: Tue, 30 Nov 2021 00:22:23 +0800 Subject: [PATCH 004/119] =?UTF-8?q?fix:=20crontab=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=91=A8=E6=98=BE=E7=A4=BA=E5=8F=8A=E8=AE=A1=E7=AE=97bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/src/components/Crontab/result.vue | 21 ++---- ruoyi-ui/src/components/Crontab/week.vue | 74 ++++++++++++++++++---- 2 files changed, 69 insertions(+), 26 deletions(-) diff --git a/ruoyi-ui/src/components/Crontab/result.vue b/ruoyi-ui/src/components/Crontab/result.vue index 07b963b79..aea6e0e46 100644 --- a/ruoyi-ui/src/components/Crontab/result.vue +++ b/ruoyi-ui/src/components/Crontab/result.vue @@ -179,7 +179,7 @@ export default { // 获取达到条件的日期是星期X let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + thisDD + ' 00:00:00'), 'week'); // 当星期日时 - if (thisWeek == 0) { + if (thisWeek == 1) { // 先找下一个日,并判断是否为月底 DD++; thisDD = DD < 10 ? '0' + DD : DD; @@ -187,7 +187,7 @@ export default { if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) { DD -= 3; } - } else if (thisWeek == 6) { + } else if (thisWeek == 7) { // 当星期6时只需判断不是1号就可进行操作 if (this.dayRuleSup !== 1) { DD--; @@ -200,7 +200,7 @@ export default { // 获取当前日期是属于星期几 let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + DD + ' 00:00:00'), 'week'); // 校验当前星期是否在星期池(dayRuleSup)中 - if (Array.indexOf(this.dayRuleSup, thisWeek) < 0) { + if (this.dayRuleSup.indexOf(thisWeek) < 0) { // 如果到达最大值时 if (Di == DDate.length - 1) { resetDay(); @@ -385,7 +385,7 @@ export default { } else if (rule.indexOf('#') >= 0) { this.dayRule = 'assWeek'; let matchRule = rule.match(/[0-9]{1}/g); - this.dayRuleSup = [Number(matchRule[0]), Number(matchRule[1])]; + this.dayRuleSup = [Number(matchRule[1]), Number(matchRule[0])]; this.dateArr[3] = [1]; if (this.dayRuleSup[1] == 7) { this.dayRuleSup[1] = 0; @@ -401,14 +401,6 @@ export default { this.dayRule = 'weekDay'; this.dayRuleSup = this.getAssignArr(rule) } - // 如果weekDay时将7调整为0【week值0即是星期日】 - if (this.dayRule == 'weekDay') { - for (let i = 0; i < this.dayRuleSup.length; i++) { - if (this.dayRuleSup[i] == 7) { - this.dayRuleSup[i] = 0; - } - } - } } }, // 获取"日"数组-少量为日期规则 @@ -543,14 +535,15 @@ export default { if (type == undefined) { return Y + '-' + (M < 10 ? '0' + M : M) + '-' + (D < 10 ? '0' + D : D) + ' ' + (h < 10 ? '0' + h : h) + ':' + (m < 10 ? '0' + m : m) + ':' + (s < 10 ? '0' + s : s); } else if (type == 'week') { - return week; + // 在quartz中 1为星期日 + return week + 1; } }, // 检查日期是否存在 checkDate(value) { let time = new Date(value); let format = this.formatDate(time) - return value == format ? true : false; + return value === format; } }, watch: { diff --git a/ruoyi-ui/src/components/Crontab/week.vue b/ruoyi-ui/src/components/Crontab/week.vue index 8cc82e208..4485bc4f6 100644 --- a/ruoyi-ui/src/components/Crontab/week.vue +++ b/ruoyi-ui/src/components/Crontab/week.vue @@ -15,8 +15,25 @@ 周期从星期 - - - + + {{item.value}} + + - + + {{item.value}} + @@ -24,14 +41,18 @@ 周的星期 - + + {{item.value}} + 本月最后一个星期 - + + {{item.value}} + @@ -39,7 +60,7 @@ 指定 - {{item}} + {{item.value}} @@ -52,13 +73,42 @@ export default { data() { return { radioValue: 2, - weekday: 1, - cycle01: 1, - cycle02: 2, + weekday: 2, + cycle01: 2, + cycle02: 3, average01: 1, - average02: 1, + average02: 2, checkboxList: [], - weekList: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'], + weekList: [ + { + key: 2, + value: '星期一' + }, + { + key: 3, + value: '星期二' + }, + { + key: 4, + value: '星期三' + }, + { + key: 5, + value: '星期四' + }, + { + key: 6, + value: '星期五' + }, + { + key: 7, + value: '星期六' + }, + { + key: 1, + value: '星期日' + } + ], checkNum: this.$options.propsData.check } }, @@ -81,7 +131,7 @@ export default { this.$emit('update', 'week', this.cycle01 + '-' + this.cycle02); break; case 4: - this.$emit('update', 'week', this.average01 + '#' + this.average02); + this.$emit('update', 'week', this.average02 + '#' + this.average01); break; case 5: this.$emit('update', 'week', this.weekday + 'L'); @@ -135,7 +185,7 @@ export default { averageTotal: function () { this.average01 = this.checkNum(this.average01, 1, 4) this.average02 = this.checkNum(this.average02, 1, 7) - return this.average01 + '#' + this.average02; + return this.average02 + '#' + this.average01; }, // 最近的工作日(格式) weekdayCheck: function () { From f28a91969acd2c48423acc01973d4cf70e4f8d8c Mon Sep 17 00:00:00 2001 From: fuzui <73400@163.com> Date: Tue, 30 Nov 2021 02:08:08 +0800 Subject: [PATCH 005/119] =?UTF-8?q?fix:=20crontab=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E4=B8=AD=E8=A7=84=E8=8C=83=E6=95=B0=E6=8D=AE=E8=8C=83=E5=9B=B4?= =?UTF-8?q?=E3=80=81=E5=86=97=E4=BD=99=E4=BB=A3=E7=A0=81=E5=8E=BB=E9=99=A4?= =?UTF-8?q?=E4=BB=A5=E5=8F=8A=E9=83=A8=E5=88=86=E9=80=9A=E9=85=8D=E7=AC=A6?= =?UTF-8?q?=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/src/components/Crontab/day.vue | 47 +++++++++------------- ruoyi-ui/src/components/Crontab/hour.vue | 26 ++++++------ ruoyi-ui/src/components/Crontab/min.vue | 26 ++++++------ ruoyi-ui/src/components/Crontab/month.vue | 26 ++++++------ ruoyi-ui/src/components/Crontab/second.vue | 41 ++++++------------- ruoyi-ui/src/components/Crontab/week.vue | 10 ++--- ruoyi-ui/src/components/Crontab/year.vue | 28 +++++++------ 7 files changed, 91 insertions(+), 113 deletions(-) diff --git a/ruoyi-ui/src/components/Crontab/day.vue b/ruoyi-ui/src/components/Crontab/day.vue index bccd1d7a8..fe3eaf0c4 100644 --- a/ruoyi-ui/src/components/Crontab/day.vue +++ b/ruoyi-ui/src/components/Crontab/day.vue @@ -2,7 +2,7 @@ - 日,允许的通配符[, - * / L M] + 日,允许的通配符[, - * ? / L W] @@ -15,23 +15,23 @@ 周期从 - - - 日 + - + 从 - 号开始,每 - 日执行一次 + 号开始,每 + 日执行一次 每月 - 号最近的那个工作日 + 号最近的那个工作日 @@ -84,10 +84,10 @@ export default { this.$emit('update', 'day', '?'); break; case 3: - this.$emit('update', 'day', this.cycle01 + '-' + this.cycle02); + this.$emit('update', 'day', this.cycleTotal); break; case 4: - this.$emit('update', 'day', this.average01 + '/' + this.average02); + this.$emit('update', 'day', this.averageTotal); break; case 5: this.$emit('update', 'day', this.workday + 'W'); @@ -116,7 +116,7 @@ export default { // 最近工作日值变化时 workdayChange() { if (this.radioValue == '5') { - this.$emit('update', 'day', this.workday + 'W'); + this.$emit('update', 'day', this.workdayCheck + 'W'); } }, // checkbox值变化时 @@ -124,19 +124,10 @@ export default { if (this.radioValue == '7') { this.$emit('update', 'day', this.checkboxString); } - }, - // 父组件传递的week发生变化触发 - weekChange() { - //判断week值与day不能同时为“?” - if (this.cron.week == '?' && this.radioValue == '2') { - this.radioValue = '1'; - } else if (this.cron.week !== '?' && this.radioValue != '2') { - this.radioValue = '2'; - } - }, + } }, watch: { - "radioValue": "radioChange", + 'radioValue': 'radioChange', 'cycleTotal': 'cycleChange', 'averageTotal': 'averageChange', 'workdayCheck': 'workdayChange', @@ -145,20 +136,20 @@ export default { computed: { // 计算两个周期值 cycleTotal: function () { - this.cycle01 = this.checkNum(this.cycle01, 1, 31) - this.cycle02 = this.checkNum(this.cycle02, 1, 31) - return this.cycle01 + '-' + this.cycle02; + const cycle01 = this.checkNum(this.cycle01, 1, 30) + const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 2, 31, 31) + return cycle01 + '-' + cycle02; }, // 计算平均用到的值 averageTotal: function () { - this.average01 = this.checkNum(this.average01, 1, 31) - this.average02 = this.checkNum(this.average02, 1, 31) - return this.average01 + '/' + this.average02; + const average01 = this.checkNum(this.average01, 1, 30) + const average02 = this.checkNum(this.average02, 1, 31 - average01 || 0) + return average01 + '/' + average02; }, // 计算工作日格式 workdayCheck: function () { - this.workday = this.checkNum(this.workday, 1, 31) - return this.workday; + const workday = this.checkNum(this.workday, 1, 31) + return workday; }, // 计算勾选的checkbox值合集 checkboxString: function () { diff --git a/ruoyi-ui/src/components/Crontab/hour.vue b/ruoyi-ui/src/components/Crontab/hour.vue index 131edc9ce..29b88919f 100644 --- a/ruoyi-ui/src/components/Crontab/hour.vue +++ b/ruoyi-ui/src/components/Crontab/hour.vue @@ -9,16 +9,16 @@ 周期从 - - - 小时 + - + 小时 从 - 小时开始,每 - 小时执行一次 + 小时开始,每 + 小时执行一次 @@ -56,10 +56,10 @@ export default { this.$emit('update', 'hour', '*') break; case 2: - this.$emit('update', 'hour', this.cycle01 + '-' + this.cycle02); + this.$emit('update', 'hour', this.cycleTotal); break; case 3: - this.$emit('update', 'hour', this.average01 + '/' + this.average02); + this.$emit('update', 'hour', this.averageTotal); break; case 4: this.$emit('update', 'hour', this.checkboxString); @@ -86,7 +86,7 @@ export default { } }, watch: { - "radioValue": "radioChange", + 'radioValue': 'radioChange', 'cycleTotal': 'cycleChange', 'averageTotal': 'averageChange', 'checkboxString': 'checkboxChange' @@ -94,15 +94,15 @@ export default { computed: { // 计算两个周期值 cycleTotal: function () { - this.cycle01 = this.checkNum(this.cycle01, 0, 23) - this.cycle02 = this.checkNum(this.cycle02, 0, 23) - return this.cycle01 + '-' + this.cycle02; + const cycle01 = this.checkNum(this.cycle01, 0, 22) + const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 1, 23) + return cycle01 + '-' + cycle02; }, // 计算平均用到的值 averageTotal: function () { - this.average01 = this.checkNum(this.average01, 0, 23) - this.average02 = this.checkNum(this.average02, 1, 23) - return this.average01 + '/' + this.average02; + const average01 = this.checkNum(this.average01, 0, 22) + const average02 = this.checkNum(this.average02, 1, 23 - average01 || 0) + return average01 + '/' + average02; }, // 计算勾选的checkbox值合集 checkboxString: function () { diff --git a/ruoyi-ui/src/components/Crontab/min.vue b/ruoyi-ui/src/components/Crontab/min.vue index 79e435b0c..0a106ce01 100644 --- a/ruoyi-ui/src/components/Crontab/min.vue +++ b/ruoyi-ui/src/components/Crontab/min.vue @@ -9,16 +9,16 @@ 周期从 - - - 分钟 + - + 分钟 从 - 分钟开始,每 - 分钟执行一次 + 分钟开始,每 + 分钟执行一次 @@ -57,10 +57,10 @@ export default { this.$emit('update', 'min', '*', 'min'); break; case 2: - this.$emit('update', 'min', this.cycle01 + '-' + this.cycle02, 'min'); + this.$emit('update', 'min', this.cycleTotal, 'min'); break; case 3: - this.$emit('update', 'min', this.average01 + '/' + this.average02, 'min'); + this.$emit('update', 'min', this.averageTotal, 'min'); break; case 4: this.$emit('update', 'min', this.checkboxString, 'min'); @@ -88,7 +88,7 @@ export default { }, watch: { - "radioValue": "radioChange", + 'radioValue': 'radioChange', 'cycleTotal': 'cycleChange', 'averageTotal': 'averageChange', 'checkboxString': 'checkboxChange', @@ -96,15 +96,15 @@ export default { computed: { // 计算两个周期值 cycleTotal: function () { - this.cycle01 = this.checkNum(this.cycle01, 0, 59) - this.cycle02 = this.checkNum(this.cycle02, 0, 59) - return this.cycle01 + '-' + this.cycle02; + const cycle01 = this.checkNum(this.cycle01, 0, 58) + const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 1, 59) + return cycle01 + '-' + cycle02; }, // 计算平均用到的值 averageTotal: function () { - this.average01 = this.checkNum(this.average01, 0, 59) - this.average02 = this.checkNum(this.average02, 1, 59) - return this.average01 + '/' + this.average02; + const average01 = this.checkNum(this.average01, 0, 58) + const average02 = this.checkNum(this.average02, 1, 59 - average01 || 0) + return average01 + '/' + average02; }, // 计算勾选的checkbox值合集 checkboxString: function () { diff --git a/ruoyi-ui/src/components/Crontab/month.vue b/ruoyi-ui/src/components/Crontab/month.vue index a7e52e1f8..fd0ac384f 100644 --- a/ruoyi-ui/src/components/Crontab/month.vue +++ b/ruoyi-ui/src/components/Crontab/month.vue @@ -9,16 +9,16 @@ 周期从 - - - 月 + - + 从 - 月开始,每 - 月月执行一次 + 月开始,每 + 月月执行一次 @@ -56,10 +56,10 @@ export default { this.$emit('update', 'month', '*'); break; case 2: - this.$emit('update', 'month', this.cycle01 + '-' + this.cycle02); + this.$emit('update', 'month', this.cycleTotal); break; case 3: - this.$emit('update', 'month', this.average01 + '/' + this.average02); + this.$emit('update', 'month', this.averageTotal); break; case 4: this.$emit('update', 'month', this.checkboxString); @@ -86,7 +86,7 @@ export default { } }, watch: { - "radioValue": "radioChange", + 'radioValue': 'radioChange', 'cycleTotal': 'cycleChange', 'averageTotal': 'averageChange', 'checkboxString': 'checkboxChange' @@ -94,15 +94,15 @@ export default { computed: { // 计算两个周期值 cycleTotal: function () { - this.cycle01 = this.checkNum(this.cycle01, 1, 12) - this.cycle02 = this.checkNum(this.cycle02, 1, 12) - return this.cycle01 + '-' + this.cycle02; + const cycle01 = this.checkNum(this.cycle01, 1, 11) + const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 2, 12) + return cycle01 + '-' + cycle02; }, // 计算平均用到的值 averageTotal: function () { - this.average01 = this.checkNum(this.average01, 1, 12) - this.average02 = this.checkNum(this.average02, 1, 12) - return this.average01 + '/' + this.average02; + const average01 = this.checkNum(this.average01, 1, 11) + const average02 = this.checkNum(this.average02, 1, 12 - average01 || 0) + return average01 + '/' + average02; }, // 计算勾选的checkbox值合集 checkboxString: function () { diff --git a/ruoyi-ui/src/components/Crontab/second.vue b/ruoyi-ui/src/components/Crontab/second.vue index 40815fb09..e7b776171 100644 --- a/ruoyi-ui/src/components/Crontab/second.vue +++ b/ruoyi-ui/src/components/Crontab/second.vue @@ -9,16 +9,16 @@ 周期从 - - - 秒 + - + 从 - 秒开始,每 - 秒执行一次 + 秒开始,每 + 秒执行一次 @@ -56,10 +56,10 @@ export default { this.$emit('update', 'second', '*', 'second'); break; case 2: - this.$emit('update', 'second', this.cycle01 + '-' + this.cycle02); + this.$emit('update', 'second', this.cycleTotal); break; case 3: - this.$emit('update', 'second', this.average01 + '/' + this.average02); + this.$emit('update', 'second', this.averageTotal); break; case 4: this.$emit('update', 'second', this.checkboxString); @@ -83,25 +83,10 @@ export default { if (this.radioValue == '4') { this.$emit('update', 'second', this.checkboxString); } - }, - othChange() { - // 反解析 - let ins = this.cron.second - ('反解析 second', ins); - if (ins === '*') { - this.radioValue = 1; - } else if (ins.indexOf('-') > -1) { - this.radioValue = 2 - } else if (ins.indexOf('/') > -1) { - this.radioValue = 3 - } else { - this.radioValue = 4 - this.checkboxList = ins.split(',') - } } }, watch: { - "radioValue": "radioChange", + 'radioValue': 'radioChange', 'cycleTotal': 'cycleChange', 'averageTotal': 'averageChange', 'checkboxString': 'checkboxChange', @@ -112,15 +97,15 @@ export default { computed: { // 计算两个周期值 cycleTotal: function () { - this.cycle01 = this.checkNum(this.cycle01, 0, 59) - this.cycle02 = this.checkNum(this.cycle02, 0, 59) - return this.cycle01 + '-' + this.cycle02; + const cycle01 = this.checkNum(this.cycle01, 0, 58) + const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 1, 59) + return cycle01 + '-' + cycle02; }, // 计算平均用到的值 averageTotal: function () { - this.average01 = this.checkNum(this.average01, 0, 59) - this.average02 = this.checkNum(this.average02, 1, 59) - return this.average01 + '/' + this.average02; + const average01 = this.checkNum(this.average01, 0, 58) + const average02 = this.checkNum(this.average02, 1, 59 - average01 || 0) + return average01 + '/' + average02; }, // 计算勾选的checkbox值合集 checkboxString: function () { diff --git a/ruoyi-ui/src/components/Crontab/week.vue b/ruoyi-ui/src/components/Crontab/week.vue index 4485bc4f6..ae389a7a5 100644 --- a/ruoyi-ui/src/components/Crontab/week.vue +++ b/ruoyi-ui/src/components/Crontab/week.vue @@ -2,7 +2,7 @@ - 周,允许的通配符[, - * / L #] + 周,允许的通配符[, - * ? / L #] @@ -128,13 +128,13 @@ export default { this.$emit('update', 'week', '?'); break; case 3: - this.$emit('update', 'week', this.cycle01 + '-' + this.cycle02); + this.$emit('update', 'week', this.cycleTotal); break; case 4: - this.$emit('update', 'week', this.average02 + '#' + this.average01); + this.$emit('update', 'week', this.averageTotal); break; case 5: - this.$emit('update', 'week', this.weekday + 'L'); + this.$emit('update', 'week', this.weekdayCheck + 'L'); break; case 6: this.$emit('update', 'week', this.checkboxString); @@ -168,7 +168,7 @@ export default { }, }, watch: { - "radioValue": "radioChange", + 'radioValue': 'radioChange', 'cycleTotal': 'cycleChange', 'averageTotal': 'averageChange', 'weekdayCheck': 'weekdayChange', diff --git a/ruoyi-ui/src/components/Crontab/year.vue b/ruoyi-ui/src/components/Crontab/year.vue index 16a2b04f3..5487a6c7f 100644 --- a/ruoyi-ui/src/components/Crontab/year.vue +++ b/ruoyi-ui/src/components/Crontab/year.vue @@ -15,16 +15,16 @@ 周期从 - - - + - + 从 - 年开始,每 - 年执行一次 + 年开始,每 + 年执行一次 @@ -67,10 +67,10 @@ export default { this.$emit('update', 'year', '*'); break; case 3: - this.$emit('update', 'year', this.cycle01 + '-' + this.cycle02); + this.$emit('update', 'year', this.cycleTotal); break; case 4: - this.$emit('update', 'year', this.average01 + '/' + this.average02); + this.$emit('update', 'year', this.averageTotal); break; case 5: this.$emit('update', 'year', this.checkboxString); @@ -97,7 +97,7 @@ export default { } }, watch: { - "radioValue": "radioChange", + 'radioValue': 'radioChange', 'cycleTotal': 'cycleChange', 'averageTotal': 'averageChange', 'checkboxString': 'checkboxChange' @@ -105,15 +105,15 @@ export default { computed: { // 计算两个周期值 cycleTotal: function () { - this.cycle01 = this.checkNum(this.cycle01, this.fullYear, this.fullYear + 100) - this.cycle02 = this.checkNum(this.cycle02, this.fullYear + 1, this.fullYear + 101) - return this.cycle01 + '-' + this.cycle02; + const cycle01 = this.checkNum(this.cycle01, this.fullYear, 2098) + const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : this.fullYear + 1, 2099) + return cycle01 + '-' + cycle02; }, // 计算平均用到的值 averageTotal: function () { - this.average01 = this.checkNum(this.average01, this.fullYear, this.fullYear + 100) - this.average02 = this.checkNum(this.average02, 1, 10) - return this.average01 + '/' + this.average02; + const average01 = this.checkNum(this.average01, this.fullYear, 2098) + const average02 = this.checkNum(this.average02, 1, 2099 - average01 || this.fullYear) + return average01 + '/' + average02; }, // 计算勾选的checkbox值合集 checkboxString: function () { @@ -124,6 +124,8 @@ export default { mounted: function () { // 仅获取当前年份 this.fullYear = Number(new Date().getFullYear()); + this.cycle01 = this.fullYear + this.average01 = this.fullYear } } From 4f0e73ba97517ff9bbe1ce5e490a03214b3996cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Tue, 30 Nov 2021 10:33:35 +0800 Subject: [PATCH 006/119] =?UTF-8?q?update=20=E4=BD=BF=E7=94=A8=20hutool-jw?= =?UTF-8?q?t=20=E6=9B=BF=E6=8D=A2=E8=80=81=E6=97=A7=20jjwt=20=E4=BE=9D?= =?UTF-8?q?=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 1 - ruoyi-common/pom.xml | 6 ---- .../com/ruoyi/common/constant/Constants.java | 3 +- .../system/service/impl/TokenServiceImpl.java | 28 +++++++++---------- 4 files changed, 14 insertions(+), 24 deletions(-) diff --git a/pom.xml b/pom.xml index 4dd51662f..ad4980fd0 100644 --- a/pom.xml +++ b/pom.xml @@ -25,7 +25,6 @@ 4.1.2 2.2.11 2.3 - 0.9.1 3.4.3.4 3.9.1 5.7.16 diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml index 4a0e1a863..68db4ccba 100644 --- a/ruoyi-common/pom.xml +++ b/ruoyi-common/pom.xml @@ -70,12 +70,6 @@ snakeyaml - - - io.jsonwebtoken - jjwt - - com.sun.xml.bind diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java index 9c91a1a15..88a3c3bc1 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java @@ -1,6 +1,5 @@ package com.ruoyi.common.constant; -import io.jsonwebtoken.Claims; /** * 通用常量信息 @@ -106,7 +105,7 @@ public class Constants { /** * 用户名称 */ - public static final String JWT_USERNAME = Claims.SUBJECT; + public static final String JWT_USERNAME = "sub"; /** * 用户头像 diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TokenServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TokenServiceImpl.java index 15b9759b8..eaf878650 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TokenServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TokenServiceImpl.java @@ -3,6 +3,10 @@ import cn.hutool.core.util.IdUtil; import cn.hutool.http.useragent.UserAgent; import cn.hutool.http.useragent.UserAgentUtil; +import cn.hutool.json.JSONObject; +import cn.hutool.jwt.JWTUtil; +import cn.hutool.jwt.signers.JWTSigner; +import cn.hutool.jwt.signers.JWTSignerUtil; import com.ruoyi.common.constant.Constants; import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.core.service.TokenService; @@ -11,9 +15,6 @@ import com.ruoyi.common.utils.ServletUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.ip.AddressUtils; -import io.jsonwebtoken.Claims; -import io.jsonwebtoken.Jwts; -import io.jsonwebtoken.SignatureAlgorithm; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -50,9 +51,9 @@ public LoginUser getLoginUser(HttpServletRequest request) { String token = getToken(request); if (StringUtils.isNotEmpty(token)) { try { - Claims claims = parseToken(token); + JSONObject claims = parseToken(token); // 解析对应的权限以及用户信息 - String uuid = (String) claims.get(Constants.LOGIN_USER_KEY); + String uuid = claims.getStr(Constants.LOGIN_USER_KEY); String userKey = getTokenKey(uuid); LoginUser user = RedisUtils.getCacheObject(userKey); return user; @@ -153,9 +154,8 @@ public void setUserAgent(LoginUser loginUser) { * @return 令牌 */ private String createToken(Map claims) { - String token = Jwts.builder() - .setClaims(claims) - .signWith(SignatureAlgorithm.HS512, tokenProperties.getSecret()).compact(); + JWTSigner signer = JWTSignerUtil.hs512(tokenProperties.getSecret().getBytes()); + String token = JWTUtil.createToken(claims, signer); return token; } @@ -165,11 +165,9 @@ private String createToken(Map claims) { * @param token 令牌 * @return 数据声明 */ - private Claims parseToken(String token) { - return Jwts.parser() - .setSigningKey(tokenProperties.getSecret()) - .parseClaimsJws(token) - .getBody(); + private JSONObject parseToken(String token) { + JWTSigner signer = JWTSignerUtil.hs512(tokenProperties.getSecret().getBytes()); + return JWTUtil.parseToken(token).setSigner(signer).getPayload().getClaimsJson(); } /** @@ -180,8 +178,8 @@ private Claims parseToken(String token) { */ @Override public String getUsernameFromToken(String token) { - Claims claims = parseToken(token); - return claims.getSubject(); + JSONObject claims = parseToken(token); + return claims.getStr("sub"); } /** From f43a5cb24496e26f9b025dfb782b2186eb96400d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Tue, 30 Nov 2021 11:11:03 +0800 Subject: [PATCH 007/119] =?UTF-8?q?update=20=E6=9B=B4=E6=94=B9=E5=89=8D?= =?UTF-8?q?=E7=AB=AF=E5=B7=A5=E7=A8=8B=E6=96=87=E4=BB=B6=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruoyi-ui/package.json b/ruoyi-ui/package.json index bad8e7723..2784eccb2 100644 --- a/ruoyi-ui/package.json +++ b/ruoyi-ui/package.json @@ -1,6 +1,6 @@ { "name": "ruoyi-vue-plus", - "version": "3.3.0", + "version": "3.4.0", "description": "RuoYi-Vue-Plus后台管理系统", "author": "LionLi", "license": "MIT", From a2d3f987c04a2e5176a8686f1032f7f5bfee4af2 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Tue, 30 Nov 2021 11:15:17 +0800 Subject: [PATCH 008/119] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/system/SysProfileController.java | 2 +- .../system/service/impl/SysMenuServiceImpl.java | 15 +++++++++++++-- ruoyi-ui/src/plugins/modal.js | 8 ++++++++ ruoyi-ui/src/views/monitor/online/index.vue | 2 +- ruoyi-ui/src/views/system/user/index.vue | 2 +- ruoyi-ui/src/views/tool/gen/basicInfoForm.vue | 3 +-- ruoyi-ui/src/views/tool/gen/editTable.vue | 1 + ruoyi-ui/src/views/tool/gen/genInfoForm.vue | 3 +-- 8 files changed, 27 insertions(+), 9 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java index d764651c8..be515fd61 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java @@ -72,7 +72,7 @@ public AjaxResult updateProfile(@RequestBody SysUser user) && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) { return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在"); - } + } user.setUserId(sysUser.getUserId()); user.setPassword(null); if (userService.updateUserProfile(user) > 0) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java index af97f1492..d509da2b6 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java @@ -179,7 +179,7 @@ else if (menu.getParentId().intValue() == 0 && isInnerLink(menu)) router.setPath("/inner"); List childrenList = new ArrayList(); RouterVo children = new RouterVo(); - String routerPath = StringUtils.replaceEach(menu.getPath(), new String[] { Constants.HTTP, Constants.HTTPS }, new String[] { "", "" }); + String routerPath = innerLinkReplaceEach(menu.getPath()); children.setPath(routerPath); children.setComponent(UserConstants.INNER_LINK); children.setName(StringUtils.capitalize(routerPath)); @@ -358,7 +358,7 @@ public String getRouterPath(SysMenu menu) // 内链打开外网方式 if (menu.getParentId().intValue() != 0 && isInnerLink(menu)) { - routerPath = StringUtils.replaceEach(routerPath, new String[] { Constants.HTTP, Constants.HTTPS }, new String[] { "", "" }); + routerPath = innerLinkReplaceEach(routerPath); } // 非外链并且是一级目录(类型为目录) if (0 == menu.getParentId().intValue() && UserConstants.TYPE_DIR.equals(menu.getMenuType()) @@ -500,4 +500,15 @@ private boolean hasChild(List list, SysMenu t) { return getChildList(list, t).size() > 0 ? true : false; } + + /** + * 内链域名特殊字符替换 + * + * @return + */ + public String innerLinkReplaceEach(String path) + { + return StringUtils.replaceEach(path, new String[] { Constants.HTTP, Constants.HTTPS }, + new String[] { "", "" }); + } } diff --git a/ruoyi-ui/src/plugins/modal.js b/ruoyi-ui/src/plugins/modal.js index 7df61a890..503a16f46 100644 --- a/ruoyi-ui/src/plugins/modal.js +++ b/ruoyi-ui/src/plugins/modal.js @@ -59,6 +59,14 @@ export default { type: "warning", }) }, + // 提交内容 + prompt(content) { + return MessageBox.prompt(content, "系统提示", { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: "warning", + }) + }, // 打开遮罩层 loading(content) { loadingInstance = Loading.service({ diff --git a/ruoyi-ui/src/views/monitor/online/index.vue b/ruoyi-ui/src/views/monitor/online/index.vue index ab66827b8..fedf08038 100644 --- a/ruoyi-ui/src/views/monitor/online/index.vue +++ b/ruoyi-ui/src/views/monitor/online/index.vue @@ -111,7 +111,7 @@ export default { }, /** 强退按钮操作 */ handleForceLogout(row) { - this.$modal.confirm('是否确认强退名称为"' + row.userName + '"的数据项?').then(function() { + this.$modal.confirm('是否确认强退名称为"' + row.userName + '"的用户?').then(function() { return forceLogout(row.tokenId); }).then(() => { this.getList(); diff --git a/ruoyi-ui/src/views/system/user/index.vue b/ruoyi-ui/src/views/system/user/index.vue index 3525c9b3f..c538a6984 100644 --- a/ruoyi-ui/src/views/system/user/index.vue +++ b/ruoyi-ui/src/views/system/user/index.vue @@ -596,7 +596,7 @@ export default { cancelButtonText: "取消", closeOnClickModal: false, inputPattern: /^.{5,20}$/, - inputErrorMessage: "用户密码长度必须介于 5 和 20 之间", + inputErrorMessage: "用户密码长度必须介于 5 和 20 之间" }).then(({ value }) => { resetUserPwd(row.userId, value).then(response => { this.$modal.msgSuccess("修改成功,新密码是:" + value); diff --git a/ruoyi-ui/src/views/tool/gen/basicInfoForm.vue b/ruoyi-ui/src/views/tool/gen/basicInfoForm.vue index f3e87172b..75dc3bf3b 100644 --- a/ruoyi-ui/src/views/tool/gen/basicInfoForm.vue +++ b/ruoyi-ui/src/views/tool/gen/basicInfoForm.vue @@ -11,7 +11,6 @@ - @@ -30,9 +29,9 @@ + diff --git a/ruoyi-generator/src/main/resources/vm/vue/v3/index.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/v3/index.vue.vm new file mode 100644 index 000000000..6e7b41f1e --- /dev/null +++ b/ruoyi-generator/src/main/resources/vm/vue/v3/index.vue.vm @@ -0,0 +1,567 @@ + + + diff --git a/ruoyi-generator/src/main/resources/vm/vue/v3/readme.txt b/ruoyi-generator/src/main/resources/vm/vue/v3/readme.txt new file mode 100644 index 000000000..99239bb53 --- /dev/null +++ b/ruoyi-generator/src/main/resources/vm/vue/v3/readme.txt @@ -0,0 +1 @@ +ʹõRuoYi-Vue3ǰˣôҪһ´Ŀ¼ģindex.vue.vmindex-tree.vue.vmļϼvueĿ¼ \ No newline at end of file From c2e28b5d94914426ca2d4dd9c4002b23c7db1295 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Thu, 16 Dec 2021 10:54:26 +0800 Subject: [PATCH 079/119] =?UTF-8?q?update=20=E4=BF=AE=E6=94=B9=20=E5=9F=BA?= =?UTF-8?q?=E7=A1=80=E6=96=B9=E6=B3=95=E8=BF=94=E5=9B=9E=E7=A9=BA=E5=88=A4?= =?UTF-8?q?=E6=96=AD=20=E4=BC=98=E5=8C=96=E8=BF=94=E5=9B=9E=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/mybatisplus/core/BaseMapperPlus.java | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/mybatisplus/core/BaseMapperPlus.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/mybatisplus/core/BaseMapperPlus.java index 9d51d243f..e11ec94ec 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/mybatisplus/core/BaseMapperPlus.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/mybatisplus/core/BaseMapperPlus.java @@ -1,5 +1,7 @@ package com.ruoyi.common.core.mybatisplus.core; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -30,6 +32,9 @@ public interface BaseMapperPlus extends BaseMapper { */ default V selectVoById(Serializable id, Class voClass){ T obj = this.selectById(id); + if (ObjectUtil.isNull(obj)) { + return null; + } return BeanCopyUtils.copy(obj, voClass); } @@ -38,8 +43,8 @@ default V selectVoById(Serializable id, Class voClass){ */ default List selectVoBatchIds(Collection idList, Class voClass){ List list = this.selectBatchIds(idList); - if (list == null) { - return null; + if (CollUtil.isEmpty(list)) { + return CollUtil.newArrayList(); } return BeanCopyUtils.copyList(list, voClass); } @@ -49,8 +54,8 @@ default List selectVoBatchIds(Collection idList, */ default List selectVoByMap(Map map, Class voClass){ List list = this.selectByMap(map); - if (list == null) { - return null; + if (CollUtil.isEmpty(list)) { + return CollUtil.newArrayList(); } return BeanCopyUtils.copyList(list, voClass); } @@ -60,6 +65,9 @@ default List selectVoByMap(Map map, Class voClass){ */ default V selectVoOne(Wrapper wrapper, Class voClass) { T obj = this.selectOne(wrapper); + if (ObjectUtil.isNull(obj)) { + return null; + } return BeanCopyUtils.copy(obj, voClass); } @@ -68,8 +76,8 @@ default V selectVoOne(Wrapper wrapper, Class voClass) { */ default List selectVoList(Wrapper wrapper, Class voClass) { List list = this.selectList(wrapper); - if (list == null) { - return null; + if (CollUtil.isEmpty(list)) { + return CollUtil.newArrayList(); } return BeanCopyUtils.copyList(list, voClass); } @@ -80,6 +88,9 @@ default List selectVoList(Wrapper wrapper, Class voClass) { default > P selectVoPage(IPage page, Wrapper wrapper, Class voClass) { IPage pageData = this.selectPage(page, wrapper); IPage voPage = new Page<>(pageData.getCurrent(), pageData.getSize(), pageData.getTotal()); + if (CollUtil.isEmpty(pageData.getRecords())) { + return (P) voPage; + } voPage.setRecords(BeanCopyUtils.copyList(pageData.getRecords(), voClass)); return (P) voPage; } From e6b45d4cdbab85f26514911090420f1f39474b92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Thu, 16 Dec 2021 10:54:44 +0800 Subject: [PATCH 080/119] =?UTF-8?q?update=20=E6=95=B0=E6=8D=AE=E6=9D=83?= =?UTF-8?q?=E9=99=90=E6=B3=A8=E8=A7=A3=E6=94=AF=E6=8C=81=E7=B1=BB=E6=A0=87?= =?UTF-8?q?=E6=B3=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/annotation/DataPermission.java | 2 +- .../com/ruoyi/demo/mapper/TestTreeMapper.java | 31 +++---------------- .../handler/PlusDataPermissionHandler.java | 13 ++++++-- 3 files changed, 16 insertions(+), 30 deletions(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataPermission.java b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataPermission.java index e04b23696..128a1f4e9 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataPermission.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataPermission.java @@ -7,7 +7,7 @@ * * @author Lion Li */ -@Target(ElementType.METHOD) +@Target({ElementType.METHOD, ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface DataPermission { diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/mapper/TestTreeMapper.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/mapper/TestTreeMapper.java index 388095009..0a7936cfe 100644 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/mapper/TestTreeMapper.java +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/mapper/TestTreeMapper.java @@ -1,16 +1,9 @@ package com.ruoyi.demo.mapper; -import com.baomidou.mybatisplus.core.conditions.Wrapper; -import com.baomidou.mybatisplus.core.toolkit.Constants; import com.ruoyi.common.annotation.DataColumn; import com.ruoyi.common.annotation.DataPermission; import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus; import com.ruoyi.demo.domain.TestTree; -import org.apache.ibatis.annotations.Param; - -import java.io.Serializable; -import java.util.Collection; -import java.util.List; /** * 测试树表Mapper接口 @@ -18,26 +11,10 @@ * @author Lion Li * @date 2021-07-26 */ +@DataPermission({ + @DataColumn(key = "deptName", value = "dept_id"), + @DataColumn(key = "userName", value = "user_id") +}) public interface TestTreeMapper extends BaseMapperPlus { - @Override - @DataPermission({ - @DataColumn(key = "deptName", value = "dept_id"), - @DataColumn(key = "userName", value = "user_id") - }) - List selectList(@Param(Constants.WRAPPER) Wrapper queryWrapper); - - @Override - @DataPermission({ - @DataColumn(key = "deptName", value = "dept_id"), - @DataColumn(key = "userName", value = "user_id") - }) - int updateById(@Param(Constants.ENTITY) TestTree entity); - - @Override - @DataPermission({ - @DataColumn(key = "deptName", value = "dept_id"), - @DataColumn(key = "userName", value = "user_id") - }) - int deleteBatchIds(@Param(Constants.COLLECTION) Collection idList); } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/handler/PlusDataPermissionHandler.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/handler/PlusDataPermissionHandler.java index f3e32078d..5bcb86898 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/handler/PlusDataPermissionHandler.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/handler/PlusDataPermissionHandler.java @@ -17,6 +17,7 @@ import lombok.extern.slf4j.Slf4j; import net.sf.jsqlparser.JSQLParserException; import net.sf.jsqlparser.expression.Expression; +import net.sf.jsqlparser.expression.Parenthesis; import net.sf.jsqlparser.expression.operators.conditional.AndExpression; import net.sf.jsqlparser.parser.CCJSqlParserUtil; import org.springframework.context.expression.BeanFactoryResolver; @@ -60,10 +61,12 @@ public Expression getSqlSegment(Expression where, String mappedStatementId, bool } try { Expression expression = CCJSqlParserUtil.parseExpression(dataFilterSql); + // 数据权限使用单独的括号 防止与其他条件冲突 + Parenthesis parenthesis = new Parenthesis(expression); if (ObjectUtil.isNotNull(where)) { - return new AndExpression(where, expression); + return new AndExpression(where, parenthesis); } else { - return expression; + return parenthesis; } } catch (JSQLParserException e) { throw new ServiceException("数据权限解析异常 => " + e.getMessage()); @@ -126,12 +129,18 @@ private DataColumn[] findAnnotation(String mappedStatementId) { List methods = Arrays.stream(ClassUtil.getDeclaredMethods(clazz)) .filter(method -> method.getName().equals(methodName)).collect(Collectors.toList()); DataPermission dataPermission; + // 获取方法注解 for (Method method : methods) { if (AnnotationUtil.hasAnnotation(method, DataPermission.class)) { dataPermission = AnnotationUtil.getAnnotation(method, DataPermission.class); return dataPermission.value(); } } + // 获取类注解 + if (AnnotationUtil.hasAnnotation(clazz, DataPermission.class)) { + dataPermission = AnnotationUtil.getAnnotation(clazz, DataPermission.class); + return dataPermission.value(); + } return null; } } From 9d81d95700b8cc2914ca0080732eb064db172185 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Thu, 16 Dec 2021 11:45:58 +0800 Subject: [PATCH 081/119] =?UTF-8?q?update=20=E4=BB=A3=E7=A0=81=E7=94=9F?= =?UTF-8?q?=E6=88=90=20=E6=95=B0=E6=8D=AE=E5=BA=93=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=20mapper=20=E6=93=8D=E4=BD=9C=20=E8=A7=84?= =?UTF-8?q?=E8=8C=83=E7=94=A8=E6=B3=95=E9=81=BF=E5=85=8D=E6=BB=A5=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/vm/java/serviceImpl.java.vm | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm b/ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm index ad19c77a7..06c4f6b11 100644 --- a/ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm +++ b/ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm @@ -31,14 +31,14 @@ public class ${ClassName}ServiceImpl extends ServicePlusImpl<${ClassName}Mapper, @Override public ${ClassName}Vo queryById(${pkColumn.javaType} ${pkColumn.javaField}){ - return getVoById(${pkColumn.javaField}); + return baseMapper.selectVoById(${pkColumn.javaField}); } #if($table.crud || $table.sub) @Override public TableDataInfo<${ClassName}Vo> queryPageList(${ClassName}Bo bo, PageQuery pageQuery) { LambdaQueryWrapper<${ClassName}> lqw = buildQueryWrapper(bo); - Page<${ClassName}Vo> result = pageVo(pageQuery.build(), lqw); + Page<${ClassName}Vo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); return TableDataInfo.build(result); } #end @@ -46,7 +46,7 @@ public class ${ClassName}ServiceImpl extends ServicePlusImpl<${ClassName}Mapper, @Override public List<${ClassName}Vo> queryList(${ClassName}Bo bo) { LambdaQueryWrapper<${ClassName}> lqw = buildQueryWrapper(bo); - return listVo(lqw); + return baseMapper.selectVoList(lqw); } private LambdaQueryWrapper<${ClassName}> buildQueryWrapper(${ClassName}Bo bo) { @@ -80,19 +80,19 @@ public class ${ClassName}ServiceImpl extends ServicePlusImpl<${ClassName}Mapper, public Boolean insertByBo(${ClassName}Bo bo) { ${ClassName} add = BeanUtil.toBean(bo, ${ClassName}.class); validEntityBeforeSave(add); - boolean flag = save(add); + int rows = baseMapper.insert(add); #set($pk=$pkColumn.javaField.substring(0,1).toUpperCase() + ${pkColumn.javaField.substring(1)}) - if (flag) { + if (rows > 0) { bo.set$pk(add.get$pk()); } - return flag; + return rows > 0; } @Override public Boolean updateByBo(${ClassName}Bo bo) { ${ClassName} update = BeanUtil.toBean(bo, ${ClassName}.class); validEntityBeforeSave(update); - return updateById(update); + return baseMapper.updateById(update) > 0; } /** @@ -109,6 +109,6 @@ public class ${ClassName}ServiceImpl extends ServicePlusImpl<${ClassName}Mapper, if(isValid){ //TODO 做一些业务上的校验,判断是否需要校验 } - return removeByIds(ids); + return baseMapper.deleteBatchIds(ids) > 0; } } From 30483dacfb18edea1054139343aacad478567df5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Thu, 16 Dec 2021 11:52:55 +0800 Subject: [PATCH 082/119] =?UTF-8?q?update=20=E5=9B=9E=E6=BB=9A=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/vm/java/serviceImpl.java.vm | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm b/ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm index 06c4f6b11..ad19c77a7 100644 --- a/ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm +++ b/ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm @@ -31,14 +31,14 @@ public class ${ClassName}ServiceImpl extends ServicePlusImpl<${ClassName}Mapper, @Override public ${ClassName}Vo queryById(${pkColumn.javaType} ${pkColumn.javaField}){ - return baseMapper.selectVoById(${pkColumn.javaField}); + return getVoById(${pkColumn.javaField}); } #if($table.crud || $table.sub) @Override public TableDataInfo<${ClassName}Vo> queryPageList(${ClassName}Bo bo, PageQuery pageQuery) { LambdaQueryWrapper<${ClassName}> lqw = buildQueryWrapper(bo); - Page<${ClassName}Vo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); + Page<${ClassName}Vo> result = pageVo(pageQuery.build(), lqw); return TableDataInfo.build(result); } #end @@ -46,7 +46,7 @@ public class ${ClassName}ServiceImpl extends ServicePlusImpl<${ClassName}Mapper, @Override public List<${ClassName}Vo> queryList(${ClassName}Bo bo) { LambdaQueryWrapper<${ClassName}> lqw = buildQueryWrapper(bo); - return baseMapper.selectVoList(lqw); + return listVo(lqw); } private LambdaQueryWrapper<${ClassName}> buildQueryWrapper(${ClassName}Bo bo) { @@ -80,19 +80,19 @@ public class ${ClassName}ServiceImpl extends ServicePlusImpl<${ClassName}Mapper, public Boolean insertByBo(${ClassName}Bo bo) { ${ClassName} add = BeanUtil.toBean(bo, ${ClassName}.class); validEntityBeforeSave(add); - int rows = baseMapper.insert(add); + boolean flag = save(add); #set($pk=$pkColumn.javaField.substring(0,1).toUpperCase() + ${pkColumn.javaField.substring(1)}) - if (rows > 0) { + if (flag) { bo.set$pk(add.get$pk()); } - return rows > 0; + return flag; } @Override public Boolean updateByBo(${ClassName}Bo bo) { ${ClassName} update = BeanUtil.toBean(bo, ${ClassName}.class); validEntityBeforeSave(update); - return baseMapper.updateById(update) > 0; + return updateById(update); } /** @@ -109,6 +109,6 @@ public class ${ClassName}ServiceImpl extends ServicePlusImpl<${ClassName}Mapper, if(isValid){ //TODO 做一些业务上的校验,判断是否需要校验 } - return baseMapper.deleteBatchIds(ids) > 0; + return removeByIds(ids); } } From 44e8a012e2281978d6ca7c3675b0a80720c17947 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Thu, 16 Dec 2021 12:10:42 +0800 Subject: [PATCH 083/119] =?UTF-8?q?update=20=E5=8E=BB=E9=99=A4=20jdk17=20?= =?UTF-8?q?=E6=A0=87=E7=AD=BE=20=E7=94=B1=E4=BA=8E=E5=BE=88=E5=A4=9A?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E8=BF=98=E6=9C=AA=E9=80=82=E9=85=8D=20?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E4=B8=80=E4=BA=9B=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 91a2b296e..2df9d65bd 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,6 @@ [![Spring Boot](https://img.shields.io/badge/Spring%20Boot-2.5-blue.svg)]() [![JDK-8+](https://img.shields.io/badge/JDK-8-green.svg)]() [![JDK-11](https://img.shields.io/badge/JDK-11-green.svg)]() -[![JDK-17](https://img.shields.io/badge/JDK-17-green.svg)]() > RuoYi-Vue-Plus 是基于 RuoYi-Vue 针对 `分布式集群` 场景升级(不兼容原框架) From d81056cbe7aba6702ba048501346c56475a00d7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Thu, 16 Dec 2021 13:55:14 +0800 Subject: [PATCH 084/119] =?UTF-8?q?update=20=E4=BF=AE=E6=94=B9=20=E7=BC=93?= =?UTF-8?q?=E5=AD=98=E6=87=92=E5=8A=A0=E8=BD=BD=20=E4=B8=BA=20false=20?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E5=90=AF=E5=8A=A8=E9=A2=84=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-admin/src/main/resources/application.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index abaf6d610..5f83cf16d 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -11,7 +11,7 @@ ruoyi: # 获取ip地址开关 addressEnabled: true # 缓存懒加载 - cacheLazy: true + cacheLazy: false captcha: # 页面 <参数设置> 可开启关闭 验证码校验 From 8041ced02d3dbe4fbaea8f928356c43fbd9410a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Thu, 16 Dec 2021 13:58:52 +0800 Subject: [PATCH 085/119] =?UTF-8?q?update=20=E6=95=B0=E6=8D=AE=E6=9D=83?= =?UTF-8?q?=E9=99=90=E5=A2=9E=E5=8A=A0=E5=85=A8=E5=B1=80=E7=BC=93=E5=AD=98?= =?UTF-8?q?=20=E6=8F=90=E9=AB=98=E5=A4=84=E7=90=86=E6=80=A7=E8=83=BD=20?= =?UTF-8?q?=E5=87=8F=E5=B0=91=E9=87=8D=E5=A4=8D=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../handler/PlusDataPermissionHandler.java | 40 +++++++++++++++++++ .../PlusDataPermissionInterceptor.java | 6 +++ 2 files changed, 46 insertions(+) diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/handler/PlusDataPermissionHandler.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/handler/PlusDataPermissionHandler.java index 5bcb86898..c1ac605bc 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/handler/PlusDataPermissionHandler.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/handler/PlusDataPermissionHandler.java @@ -1,6 +1,7 @@ package com.ruoyi.framework.handler; import cn.hutool.core.annotation.AnnotationUtil; +import cn.hutool.core.collection.ConcurrentHashSet; import cn.hutool.core.util.ArrayUtil; import cn.hutool.core.util.ClassUtil; import cn.hutool.core.util.ObjectUtil; @@ -31,6 +32,9 @@ import java.lang.reflect.Method; import java.util.Arrays; import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Collectors; /** @@ -41,13 +45,32 @@ @Slf4j public class PlusDataPermissionHandler { + /** + * 方法或类 与 注解的映射关系缓存 + */ + private final Map methodCacheMap = new ConcurrentHashMap<>(); + private final Map, DataPermission> classCacheMap = new ConcurrentHashMap<>(); + + /** + * 无效注解方法缓存用于快速返回 + */ + private final Set inavlidCacheSet = new ConcurrentHashSet<>(); + + /** + * spel 解析器 + */ private final ExpressionParser parser = new SpelExpressionParser(); private final ParserContext parserContext = new TemplateParserContext(); + /** + * bean解析器 用于处理 spel 表达式中对 bean 的调用 + */ private final BeanResolver beanResolver = new BeanFactoryResolver(SpringUtils.getBeanFactory()); + public Expression getSqlSegment(Expression where, String mappedStatementId, boolean isSelect) { DataColumn[] dataColumns = findAnnotation(mappedStatementId); if (ArrayUtil.isEmpty(dataColumns)) { + inavlidCacheSet.add(mappedStatementId); return where; } SysUser currentUser = SpringUtils.getBean(UserService.class).selectUserById(SecurityUtils.getUserId()); @@ -131,16 +154,33 @@ private DataColumn[] findAnnotation(String mappedStatementId) { DataPermission dataPermission; // 获取方法注解 for (Method method : methods) { + dataPermission = methodCacheMap.get(method); + if (ObjectUtil.isNotNull(dataPermission)) { + return dataPermission.value(); + } if (AnnotationUtil.hasAnnotation(method, DataPermission.class)) { dataPermission = AnnotationUtil.getAnnotation(method, DataPermission.class); + methodCacheMap.put(method, dataPermission); return dataPermission.value(); } } + dataPermission = classCacheMap.get(clazz); + if (ObjectUtil.isNotNull(dataPermission)) { + return dataPermission.value(); + } // 获取类注解 if (AnnotationUtil.hasAnnotation(clazz, DataPermission.class)) { dataPermission = AnnotationUtil.getAnnotation(clazz, DataPermission.class); + classCacheMap.put(clazz, dataPermission); return dataPermission.value(); } return null; } + + /** + * 是否为无效方法 无数据权限 + */ + public boolean isInvalid(String mappedStatementId) { + return inavlidCacheSet.contains(mappedStatementId); + } } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/PlusDataPermissionInterceptor.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/PlusDataPermissionInterceptor.java index a1d90ff6c..6f4d4b7b3 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/PlusDataPermissionInterceptor.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/PlusDataPermissionInterceptor.java @@ -30,9 +30,15 @@ public class PlusDataPermissionInterceptor extends JsqlParserSupport implements @Override public void beforeQuery(Executor executor, MappedStatement ms, Object parameter, RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql) throws SQLException { + // 检查忽略注解 if (InterceptorIgnoreHelper.willIgnoreDataPermission(ms.getId())) { return; } + // 检查是否无效 无数据权限注解 + if (dataPermissionHandler.isInvalid(ms.getId())) { + return; + } + // 解析 sql 分配对应方法 PluginUtils.MPBoundSql mpBs = PluginUtils.mpBoundSql(boundSql); mpBs.sql(parserSingle(mpBs.sql(), ms.getId())); } From d600cdd8a0a590d43c141c36f5ba7077fc81c420 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Thu, 16 Dec 2021 15:09:35 +0800 Subject: [PATCH 086/119] =?UTF-8?q?add=20=E4=BB=A3=E7=A0=81=E7=94=9F?= =?UTF-8?q?=E6=88=90=E5=A2=9E=E5=8A=A0=20vue3=20=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/vm/vue/v3/index-tree.vue.vm | 31 ++++++++++------ .../src/main/resources/vm/vue/v3/index.vue.vm | 36 ++++++++++++------- 2 files changed, 44 insertions(+), 23 deletions(-) diff --git a/ruoyi-generator/src/main/resources/vm/vue/v3/index-tree.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/v3/index-tree.vue.vm index 62fe2f11f..55ddca5b0 100644 --- a/ruoyi-generator/src/main/resources/vm/vue/v3/index-tree.vue.vm +++ b/ruoyi-generator/src/main/resources/vm/vue/v3/index-tree.vue.vm @@ -11,7 +11,7 @@ #else #set($comment=$column.columnComment) #end -#if($column.htmlType == "input") +#if($column.htmlType == "input" || $column.htmlType == "textarea") {{ parseTime(scope.row.${javaField}, '{y}-{m}-{d}') }} -#elseif($column.list && "" != $column.dictType) +#elseif($column.list && $column.dictType && "" != $column.dictType)