From b4c8d0cdd1526edb8ee3d5ea16508a3e665a36dc Mon Sep 17 00:00:00 2001 From: ruying408 <1877972603@qq.com> Date: Wed, 24 Jul 2024 22:21:34 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81mybatis-flex.ext=20=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8D=87=E7=BA=A7=202=E3=80=81=E7=B3=BB=E7=BB=9F=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E5=8F=82=E6=95=B0=E5=86=99=E5=85=A5=E5=A4=A7=E5=B0=8F?= =?UTF-8?q?=E6=8E=A7=E5=88=B6=203=E3=80=81=E8=A6=86=E7=9B=96=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E6=97=B6=EF=BC=8C=E5=88=A0=E9=99=A4=E5=8E=9F=E5=9B=A0?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- src/main/java/com/cool/core/base/BaseEntity.java | 8 +++++--- .../com/cool/core/plugin/service/CoolPluginService.java | 6 +++++- .../base/service/sys/impl/BaseSysLogServiceImpl.java | 9 ++++++++- src/main/resources/application.yml | 4 +++- 5 files changed, 22 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index f480991..5f8cc0f 100644 --- a/pom.xml +++ b/pom.xml @@ -19,7 +19,7 @@ 17 1.18.34 1.9.3 - 1.9.3.021-beta + 1.9.3.030-beta 5.8.26 3.3.2 2.0.51 diff --git a/src/main/java/com/cool/core/base/BaseEntity.java b/src/main/java/com/cool/core/base/BaseEntity.java index 978b74e..72366a3 100644 --- a/src/main/java/com/cool/core/base/BaseEntity.java +++ b/src/main/java/com/cool/core/base/BaseEntity.java @@ -1,5 +1,6 @@ package com.cool.core.base; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.mybatisflex.annotation.Column; import com.mybatisflex.annotation.Id; import com.mybatisflex.annotation.KeyType; @@ -20,17 +21,18 @@ import lombok.Setter; public abstract class BaseEntity> extends Model implements Serializable { @Id(keyType = KeyType.Auto, comment = "ID") - private Long id; + protected Long id; @Column(onInsertValue = "now()") @ColumnDefine(comment = "创建时间") - private Date createTime; + protected Date createTime; @Column(onInsertValue = "now()", onUpdateValue = "now()") @ColumnDefine(comment = "更新时间") - private Date updateTime; + protected Date updateTime; @Ignore @Column(ignore = true) + @JsonIgnore private QueryWrapper queryWrapper; } \ No newline at end of file diff --git a/src/main/java/com/cool/core/plugin/service/CoolPluginService.java b/src/main/java/com/cool/core/plugin/service/CoolPluginService.java index a0e4de4..8b1fe0c 100644 --- a/src/main/java/com/cool/core/plugin/service/CoolPluginService.java +++ b/src/main/java/com/cool/core/plugin/service/CoolPluginService.java @@ -184,6 +184,7 @@ public class CoolPluginService { // 通过key 找到id PluginInfoEntity one = pluginInfoService.getByKeyNoJarFile(pluginJson.getKey()); if (ObjUtil.isNotEmpty(one)) { + String oldJarPath = one.getPluginJson().getJarPath(); // 重新加载配置不更新 pluginInfo.setConfig(one.getConfig()); pluginInfo.getPluginJson().setConfig(one.getConfig()); @@ -191,7 +192,10 @@ public class CoolPluginService { // 忽略无变更,无需更新的字段 ignoreNoChange(pluginInfo, one); BeanUtil.copyProperties(pluginInfo, one, options); - one.updateById(); + if (one.updateById()) { + // 覆盖时删除旧版本插件 + FileUtil.del(oldJarPath); + } } } diff --git a/src/main/java/com/cool/modules/base/service/sys/impl/BaseSysLogServiceImpl.java b/src/main/java/com/cool/modules/base/service/sys/impl/BaseSysLogServiceImpl.java index 9e4796c..4979c20 100644 --- a/src/main/java/com/cool/modules/base/service/sys/impl/BaseSysLogServiceImpl.java +++ b/src/main/java/com/cool/modules/base/service/sys/impl/BaseSysLogServiceImpl.java @@ -19,6 +19,7 @@ import com.mybatisflex.core.query.QueryWrapper; import jakarta.servlet.http.HttpServletRequest; import java.util.Date; import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Value; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; @@ -36,6 +37,9 @@ public class BaseSysLogServiceImpl extends BaseServiceImpl page, QueryWrapper queryWrapper) { @@ -76,7 +80,10 @@ public class BaseSysLogServiceImpl extends BaseServiceImpl maxJsonLength) { + // 超过指定 + newJSONObject.clear(); + } recordAsync(requestURI, ipAddr, userId, newJSONObject); } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index ef0ec9b..f63156a 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -127,7 +127,9 @@ cool: local: # 文件访问地址 base-url: http://127.0.0.1:${server.port}/upload - + # 系统日志请求参数超过1024字节 就不记录,避免日志过大 + log: + maxJsonLength: 1024 # AutoTable配置,根据实体类自动生成表 auto-table: show-banner: false