From 0427d362d9b465cbaa0c48561ebed70e69b96ddf 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, 24 Nov 2022 15:26:03 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E5=90=8C=E6=AD=A5=20ruoyi=20=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E6=8F=90=E4=BA=A4=20*=20fix=20=E4=BF=AE=E5=A4=8DLog?= =?UTF-8?q?=E6=B3=A8=E8=A7=A3GET=E8=AF=B7=E6=B1=82=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E4=B8=8D=E5=88=B0=E5=8F=82=E6=95=B0=E9=97=AE=E9=A2=98=20*=20fi?= =?UTF-8?q?x=20=E4=BF=AE=E5=A4=8D=E6=9F=90=E4=BA=9B=E7=89=B9=E6=80=A7?= =?UTF-8?q?=E7=9A=84=E7=8E=AF=E5=A2=83=E7=94=9F=E6=88=90=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E5=8F=98=E4=B9=B1=E7=A0=81TXT=E6=96=87=E4=BB=B6=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20*=20update=20=E6=B6=88=E9=99=A4Vue3=E6=8E=A7?= =?UTF-8?q?=E5=88=B6=E5=8F=B0=E5=87=BA=E7=8E=B0=E7=9A=84=E8=AD=A6=E5=91=8A?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=20*=20fix=20=E5=BC=80=E5=90=AFTopNav?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E5=AD=90=E8=8F=9C=E5=8D=95=E9=9A=90=E8=97=8F?= =?UTF-8?q?=E4=BE=A7=E8=BE=B9=E6=A0=8F=20*=20fix=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=9B=9E=E6=98=BE=E6=95=B0=E6=8D=AE=E5=AD=97=E5=85=B8=E6=95=B0?= =?UTF-8?q?=E7=BB=84=E5=BC=82=E5=B8=B8=E9=97=AE=E9=A2=98(I60UYQ)=20*=20upd?= =?UTF-8?q?ate=20=E5=BF=BD=E7=95=A5=E4=B8=8D=E5=BF=85=E8=A6=81=E7=9A=84?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E6=95=B0=E6=8D=AE=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/common/core/utils/ServletUtils.java | 28 +++++++++++++ .../common/core/web/domain/BaseEntity.java | 4 ++ .../ruoyi/common/log/aspect/LogAspect.java | 5 ++- .../resources/vm/vue/v3/index-tree.vue.vm | 25 +++-------- .../src/main/resources/vm/vue/v3/index.vue.vm | 18 ++------ ruoyi-ui/src/components/TopNav/index.vue | 6 ++- ruoyi-ui/src/utils/request.js | 41 +++++-------------- ruoyi-ui/src/utils/ruoyi.js | 9 ++-- ruoyi-ui/src/views/tool/gen/index.vue | 2 +- 9 files changed, 68 insertions(+), 70 deletions(-) diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/ServletUtils.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/ServletUtils.java index 967f67dc..4ae00a29 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/ServletUtils.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/ServletUtils.java @@ -12,6 +12,7 @@ import org.springframework.web.context.request.RequestAttributes; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; +import javax.servlet.ServletRequest; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; @@ -20,7 +21,9 @@ import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; +import java.util.Collections; import java.util.Enumeration; +import java.util.HashMap; import java.util.Map; /** @@ -73,6 +76,31 @@ public class ServletUtils extends ServletUtil { return Convert.toBool(getRequest().getParameter(name), defaultValue); } + /** + * 获得所有请求参数 + * + * @param request 请求对象{@link ServletRequest} + * @return Map + */ + public static Map getParams(ServletRequest request) { + final Map map = request.getParameterMap(); + return Collections.unmodifiableMap(map); + } + + /** + * 获得所有请求参数 + * + * @param request 请求对象{@link ServletRequest} + * @return Map + */ + public static Map getParamMap(ServletRequest request) { + Map params = new HashMap<>(); + for (Map.Entry entry : getParams(request).entrySet()) { + params.put(entry.getKey(), StringUtils.join(entry.getValue(), ",")); + } + return params; + } + /** * 获取request */ diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/domain/BaseEntity.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/domain/BaseEntity.java index 8f464e3e..c0a3a0ff 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/domain/BaseEntity.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/domain/BaseEntity.java @@ -2,6 +2,8 @@ package com.ruoyi.common.core.web.domain; import com.baomidou.mybatisplus.annotation.FieldFill; import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; import lombok.Data; import java.io.Serializable; @@ -23,6 +25,7 @@ public class BaseEntity implements Serializable { /** * 搜索值 */ + @JsonIgnore @TableField(exist = false) private String searchValue; @@ -53,6 +56,7 @@ public class BaseEntity implements Serializable { /** * 请求参数 */ + @JsonInclude(JsonInclude.Include.NON_EMPTY) @TableField(exist = false) private Map params = new HashMap<>(); diff --git a/ruoyi-common/ruoyi-common-log/src/main/java/com/ruoyi/common/log/aspect/LogAspect.java b/ruoyi-common/ruoyi-common-log/src/main/java/com/ruoyi/common/log/aspect/LogAspect.java index d29bb623..8661e5fd 100644 --- a/ruoyi-common/ruoyi-common-log/src/main/java/com/ruoyi/common/log/aspect/LogAspect.java +++ b/ruoyi-common/ruoyi-common-log/src/main/java/com/ruoyi/common/log/aspect/LogAspect.java @@ -95,7 +95,6 @@ public class LogAspect { asyncLogService.saveSysLog(operLog); } catch (Exception exp) { // 记录本地异常日志 - log.error("==前置通知异常=="); log.error("异常信息:{}", exp.getMessage()); exp.printStackTrace(); } @@ -137,6 +136,10 @@ public class LogAspect { if (HttpMethod.PUT.name().equals(requestMethod) || HttpMethod.POST.name().equals(requestMethod)) { String params = argsArrayToString(joinPoint.getArgs()); operLog.setOperParam(StringUtils.substring(params, 0, 2000)); + } else { + Map paramsMap = ServletUtils.getParamMap(ServletUtils.getRequest()); + MapUtil.removeAny(paramsMap, EXCLUDE_PROPERTIES); + operLog.setOperParam(StringUtils.substring(JsonUtils.toJsonString(paramsMap), 0, 2000)); } } diff --git a/ruoyi-modules/ruoyi-gen/src/main/resources/vm/vue/v3/index-tree.vue.vm b/ruoyi-modules/ruoyi-gen/src/main/resources/vm/vue/v3/index-tree.vue.vm index d44e082f..9af8ff66 100644 --- a/ruoyi-modules/ruoyi-gen/src/main/resources/vm/vue/v3/index-tree.vue.vm +++ b/ruoyi-modules/ruoyi-gen/src/main/resources/vm/vue/v3/index-tree.vue.vm @@ -135,26 +135,11 @@ #end #end - + diff --git a/ruoyi-modules/ruoyi-gen/src/main/resources/vm/vue/v3/index.vue.vm b/ruoyi-modules/ruoyi-gen/src/main/resources/vm/vue/v3/index.vue.vm index f7c1bd02..4ab01450 100644 --- a/ruoyi-modules/ruoyi-gen/src/main/resources/vm/vue/v3/index.vue.vm +++ b/ruoyi-modules/ruoyi-gen/src/main/resources/vm/vue/v3/index.vue.vm @@ -147,20 +147,10 @@ #end #end - + diff --git a/ruoyi-ui/src/components/TopNav/index.vue b/ruoyi-ui/src/components/TopNav/index.vue index 0cc24dba..5f0edbef 100644 --- a/ruoyi-ui/src/components/TopNav/index.vue +++ b/ruoyi-ui/src/components/TopNav/index.vue @@ -92,7 +92,9 @@ export default { if (path !== undefined && path.lastIndexOf("/") > 0 && hideList.indexOf(path) === -1) { const tmpPath = path.substring(1, path.length); activePath = "/" + tmpPath.substring(0, tmpPath.indexOf("/")); - this.$store.dispatch('app/toggleSideBarHide', false); + if (!this.$route.meta.link) { + this.$store.dispatch('app/toggleSideBarHide', false); + } } else if(!this.$route.children) { activePath = path; this.$store.dispatch('app/toggleSideBarHide', true); @@ -145,6 +147,8 @@ export default { } if(routes.length > 0) { this.$store.commit("SET_SIDEBAR_ROUTERS", routes); + } else { + this.$store.dispatch('app/toggleSideBarHide', true); } }, ishttp(url) { diff --git a/ruoyi-ui/src/utils/request.js b/ruoyi-ui/src/utils/request.js index 39d5c26d..f94fa0e5 100644 --- a/ruoyi-ui/src/utils/request.js +++ b/ruoyi-ui/src/utils/request.js @@ -80,37 +80,24 @@ service.interceptors.response.use(res => { if (code === 401) { if (!isRelogin.show) { isRelogin.show = true; - MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { - confirmButtonText: '重新登录', - cancelButtonText: '取消', - type: 'warning' - } - ).then(() => { - isRelogin.show = false; - store.dispatch('LogOut').then(() => { - location.href = process.env.VUE_APP_CONTEXT_PATH + "index"; - }) + MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { confirmButtonText: '重新登录', cancelButtonText: '取消', type: 'warning' }).then(() => { + isRelogin.show = false; + store.dispatch('LogOut').then(() => { + location.href = process.env.VUE_APP_CONTEXT_PATH + "index"; + }) }).catch(() => { isRelogin.show = false; }); } return Promise.reject('无效的会话,或者会话已过期,请重新登录。') } else if (code === 500) { - Message({ - message: msg, - type: 'error' - }) + Message({ message: msg, type: 'error' }) return Promise.reject(new Error(msg)) } else if (code === 601) { - Message({ - message: msg, - type: 'warning' - }) + Message({ message: msg, type: 'warning' }) return Promise.reject('error') } else if (code !== 200) { - Notification.error({ - title: msg - }) + Notification.error({ title: msg }) return Promise.reject('error') } else { return res.data @@ -121,18 +108,12 @@ service.interceptors.response.use(res => { let { message } = error; if (message == "Network Error") { message = "后端接口连接异常"; - } - else if (message.includes("timeout")) { + } else if (message.includes("timeout")) { message = "系统接口请求超时"; - } - else if (message.includes("Request failed with status code")) { + } else if (message.includes("Request failed with status code")) { message = "系统接口" + message.substr(message.length - 3) + "异常"; } - Message({ - message: message, - type: 'error', - duration: 5 * 1000 - }) + Message({ message: message, type: 'error', duration: 5 * 1000 }) return Promise.reject(error) } ) diff --git a/ruoyi-ui/src/utils/ruoyi.js b/ruoyi-ui/src/utils/ruoyi.js index 99cd3143..a2c8e4c4 100644 --- a/ruoyi-ui/src/utils/ruoyi.js +++ b/ruoyi-ui/src/utils/ruoyi.js @@ -86,11 +86,14 @@ export function selectDictLabel(datas, value) { return actions.join(''); } -// 回显数据字典(字符串数组) +// 回显数据字典(字符串、数组) export function selectDictLabels(datas, value, separator) { - if (value === undefined) { + if (value === undefined || value.length ===0) { return ""; } + if (Array.isArray(value)) { + value = value.join(","); + } var actions = []; var currentSeparator = undefined === separator ? "," : separator; var temp = value.split(currentSeparator); @@ -233,4 +236,4 @@ export async function blobValidate(data) { } catch (error) { return true; } -} \ No newline at end of file +} diff --git a/ruoyi-ui/src/views/tool/gen/index.vue b/ruoyi-ui/src/views/tool/gen/index.vue index eeb9efe5..36838108 100644 --- a/ruoyi-ui/src/views/tool/gen/index.vue +++ b/ruoyi-ui/src/views/tool/gen/index.vue @@ -267,7 +267,7 @@ export default { this.$modal.msgSuccess("成功生成到自定义路径:" + row.genPath); }); } else { - this.$download.zip("/code/gen/batchGenCode?tables=" + tableNames, "ruoyi"); + this.$download.zip("/code/gen/batchGenCode?tables=" + tableNames, "ruoyi.zip"); } }, /** 同步数据库操作 */