From f3fd539491f26dfb495a08068f22141c70d3edb1 Mon Sep 17 00:00:00 2001 From: Charles7c Date: Sun, 3 Dec 2023 13:35:08 +0800 Subject: [PATCH 01/49] =?UTF-8?q?chore:=20=E6=9B=B4=E6=96=B0=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- continew-admin-ui/package.json | 2 +- continew-admin-webapi/src/main/resources/config/application.yml | 2 +- pom.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index fb59c8bc..bb186a66 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ License -Release +Release GitHub stars diff --git a/continew-admin-ui/package.json b/continew-admin-ui/package.json index b334e460..15189f14 100644 --- a/continew-admin-ui/package.json +++ b/continew-admin-ui/package.json @@ -1,7 +1,7 @@ { "name": "continew-admin-ui", "description": "ContiNew Admin 中后台管理框架,Continue New Admin,持续以最新流行技术栈构建,拥抱变化,迭代优化。", - "version": "2.1.0", + "version": "2.2.0-SNAPSHOT", "private": true, "author": "Charles7c", "license": "Apache-2.0", diff --git a/continew-admin-webapi/src/main/resources/config/application.yml b/continew-admin-webapi/src/main/resources/config/application.yml index 2d05eddc..794a77ea 100644 --- a/continew-admin-webapi/src/main/resources/config/application.yml +++ b/continew-admin-webapi/src/main/resources/config/application.yml @@ -5,7 +5,7 @@ project: # 应用名称 app-name: continew-admin # 版本 - version: 2.1.0 + version: 2.2.0-SNAPSHOT # 描述 description: ContiNew Admin 中后台管理框架/脚手架,Continue New Admin,持续以最新流行技术栈构建,拥抱变化,迭代优化。 # 基本包 diff --git a/pom.xml b/pom.xml index cd5ba4c0..c34eced1 100644 --- a/pom.xml +++ b/pom.xml @@ -33,7 +33,7 @@ - 2.1.0 + 2.2.0-SNAPSHOT 2.40.0 From 6035a7b40be1ff4a18e6667d056e9abbd0d5f9e2 Mon Sep 17 00:00:00 2001 From: Charles7c Date: Tue, 5 Dec 2023 21:18:01 +0800 Subject: [PATCH 02/49] build: continew-starter 1.0.0 => 1.0.1-SNAPSHOT --- .../config/easyexcel/ExcelBaseEnumConverter.java | 2 +- .../common/config/jackson/BaseEnumDeserializer.java | 2 +- .../common/config/jackson/BaseEnumSerializer.java | 2 +- .../common/config/jackson/JacksonConfiguration.java | 2 +- .../config/mybatis/MyBatisPlusMetaObjectHandler.java | 2 +- .../continew/admin/common/enums/DataScopeEnum.java | 2 +- .../admin/common/enums/DisEnableStatusEnum.java | 2 +- .../continew/admin/common/enums/GenderEnum.java | 2 +- .../continew/admin/common/enums/MenuTypeEnum.java | 2 +- .../continew/admin/common/enums/MessageTypeEnum.java | 2 +- .../admin/common/enums/SuccessFailureStatusEnum.java | 2 +- .../admin/common/handler/GlobalExceptionHandler.java | 4 ++-- .../continew/admin/common/util/SecureUtils.java | 2 +- .../continew/admin/monitor/enums/LogStatusEnum.java | 2 +- .../admin/monitor/model/query/LoginLogQuery.java | 4 ++-- .../admin/monitor/model/query/OperationLogQuery.java | 4 ++-- .../admin/monitor/model/query/SystemLogQuery.java | 4 ++-- .../admin/monitor/service/impl/LogServiceImpl.java | 6 +++--- .../admin/auth/service/impl/LoginServiceImpl.java | 2 +- .../admin/system/enums/AnnouncementStatusEnum.java | 2 +- .../admin/system/model/query/AnnouncementQuery.java | 4 ++-- .../continew/admin/system/model/query/DeptQuery.java | 4 ++-- .../admin/system/model/query/DictItemQuery.java | 2 +- .../continew/admin/system/model/query/DictQuery.java | 2 +- .../continew/admin/system/model/query/MenuQuery.java | 4 ++-- .../admin/system/model/query/MessageQuery.java | 4 ++-- .../admin/system/model/query/OptionQuery.java | 4 ++-- .../continew/admin/system/model/query/RoleQuery.java | 2 +- .../continew/admin/system/model/query/UserQuery.java | 4 ++-- .../admin/system/service/impl/DeptServiceImpl.java | 2 +- .../system/service/impl/DictItemServiceImpl.java | 2 +- .../admin/system/service/impl/DictServiceImpl.java | 2 +- .../admin/system/service/impl/MenuServiceImpl.java | 2 +- .../admin/system/service/impl/MessageServiceImpl.java | 4 ++-- .../system/service/impl/MessageUserServiceImpl.java | 2 +- .../admin/system/service/impl/OptionServiceImpl.java | 2 +- .../admin/system/service/impl/RoleServiceImpl.java | 2 +- .../admin/system/service/impl/UserServiceImpl.java | 2 +- .../system/service/impl/UserSocialServiceImpl.java | 2 +- .../continew/admin/tool/enums/FormTypeEnum.java | 2 +- .../admin/tool/model/entity/FieldConfigDO.java | 2 +- .../admin/tool/service/impl/GeneratorServiceImpl.java | 6 +++--- .../src/main/resources/templates/generator/Query.ftl | 4 ++-- .../continew/admin/webapi/auth/AuthController.java | 2 +- .../admin/webapi/auth/SocialAuthController.java | 4 ++-- .../admin/webapi/common/CaptchaController.java | 2 +- .../admin/webapi/common/CommonController.java | 6 +++--- .../admin/webapi/common/DashboardController.java | 2 +- .../admin/webapi/monitor/OnlineUserController.java | 2 +- .../admin/webapi/system/AnnouncementController.java | 2 +- .../continew/admin/webapi/system/MenuController.java | 2 +- .../admin/webapi/system/UserCenterController.java | 2 +- .../admin/webapi/tool/GeneratorController.java | 2 +- pom.xml | 11 ++++++++++- 54 files changed, 82 insertions(+), 73 deletions(-) diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/easyexcel/ExcelBaseEnumConverter.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/easyexcel/ExcelBaseEnumConverter.java index 01f76607..ea62314a 100644 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/easyexcel/ExcelBaseEnumConverter.java +++ b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/easyexcel/ExcelBaseEnumConverter.java @@ -27,7 +27,7 @@ import cn.hutool.core.util.ClassUtil; import top.charles7c.continew.starter.core.constant.StringConstants; -import top.charles7c.continew.starter.extension.crud.base.IBaseEnum; +import top.charles7c.continew.starter.data.mybatis.plus.enums.IBaseEnum; /** * Easy Excel 枚举基类转换器 diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/BaseEnumDeserializer.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/BaseEnumDeserializer.java index 048fe641..111c1481 100644 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/BaseEnumDeserializer.java +++ b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/BaseEnumDeserializer.java @@ -27,7 +27,7 @@ import cn.hutool.core.util.ClassUtil; import cn.hutool.core.util.ReflectUtil; -import top.charles7c.continew.starter.extension.crud.base.IBaseEnum; +import top.charles7c.continew.starter.data.mybatis.plus.enums.IBaseEnum; /** * 通用枚举基类 BaseEnum 反序列化器 diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/BaseEnumSerializer.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/BaseEnumSerializer.java index 17471857..21f37f0f 100644 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/BaseEnumSerializer.java +++ b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/BaseEnumSerializer.java @@ -23,7 +23,7 @@ import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.annotation.JacksonStdImpl; -import top.charles7c.continew.starter.extension.crud.base.IBaseEnum; +import top.charles7c.continew.starter.data.mybatis.plus.enums.IBaseEnum; /** * 通用枚举接口 BaseEnum 序列化器 diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/JacksonConfiguration.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/JacksonConfiguration.java index cf3e8278..8ed8c7f9 100644 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/JacksonConfiguration.java +++ b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/JacksonConfiguration.java @@ -25,7 +25,7 @@ import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.module.SimpleModule; -import top.charles7c.continew.starter.extension.crud.base.IBaseEnum; +import top.charles7c.continew.starter.data.mybatis.plus.enums.IBaseEnum; /** * Jackson 配置 diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/mybatis/MyBatisPlusMetaObjectHandler.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/mybatis/MyBatisPlusMetaObjectHandler.java index 6075d32e..1109ab91 100644 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/mybatis/MyBatisPlusMetaObjectHandler.java +++ b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/mybatis/MyBatisPlusMetaObjectHandler.java @@ -25,8 +25,8 @@ import cn.hutool.core.util.ObjectUtil; import top.charles7c.continew.admin.common.util.helper.LoginHelper; +import top.charles7c.continew.starter.core.exception.BusinessException; import top.charles7c.continew.starter.extension.crud.base.BaseDO; -import top.charles7c.continew.starter.extension.crud.exception.BusinessException; /** * MyBatis Plus 元对象处理器配置(插入或修改时自动填充) diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/DataScopeEnum.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/DataScopeEnum.java index 15d5a297..c9081d37 100644 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/DataScopeEnum.java +++ b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/DataScopeEnum.java @@ -19,7 +19,7 @@ import lombok.Getter; import lombok.RequiredArgsConstructor; -import top.charles7c.continew.starter.extension.crud.base.IBaseEnum; +import top.charles7c.continew.starter.data.mybatis.plus.enums.IBaseEnum; /** * 数据权限枚举 diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/DisEnableStatusEnum.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/DisEnableStatusEnum.java index 87ad7480..6946f5e3 100644 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/DisEnableStatusEnum.java +++ b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/DisEnableStatusEnum.java @@ -20,7 +20,7 @@ import lombok.RequiredArgsConstructor; import top.charles7c.continew.admin.common.constant.UIConstants; -import top.charles7c.continew.starter.extension.crud.base.IBaseEnum; +import top.charles7c.continew.starter.data.mybatis.plus.enums.IBaseEnum; /** * 启用/禁用状态枚举 diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/GenderEnum.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/GenderEnum.java index db6068a4..345e2a2e 100644 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/GenderEnum.java +++ b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/GenderEnum.java @@ -19,7 +19,7 @@ import lombok.Getter; import lombok.RequiredArgsConstructor; -import top.charles7c.continew.starter.extension.crud.base.IBaseEnum; +import top.charles7c.continew.starter.data.mybatis.plus.enums.IBaseEnum; /** * 性别枚举 diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/MenuTypeEnum.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/MenuTypeEnum.java index 2d5fe3e3..19655d57 100644 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/MenuTypeEnum.java +++ b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/MenuTypeEnum.java @@ -19,7 +19,7 @@ import lombok.Getter; import lombok.RequiredArgsConstructor; -import top.charles7c.continew.starter.extension.crud.base.IBaseEnum; +import top.charles7c.continew.starter.data.mybatis.plus.enums.IBaseEnum; /** * 菜单类型枚举 diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/MessageTypeEnum.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/MessageTypeEnum.java index ca21ba03..46ff50de 100644 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/MessageTypeEnum.java +++ b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/MessageTypeEnum.java @@ -20,7 +20,7 @@ import lombok.RequiredArgsConstructor; import top.charles7c.continew.admin.common.constant.UIConstants; -import top.charles7c.continew.starter.extension.crud.base.IBaseEnum; +import top.charles7c.continew.starter.data.mybatis.plus.enums.IBaseEnum; /** * 消息类型枚举 diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/SuccessFailureStatusEnum.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/SuccessFailureStatusEnum.java index 6b2e0adb..1ddeed6e 100644 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/SuccessFailureStatusEnum.java +++ b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/SuccessFailureStatusEnum.java @@ -20,7 +20,7 @@ import lombok.RequiredArgsConstructor; import top.charles7c.continew.admin.common.constant.UIConstants; -import top.charles7c.continew.starter.extension.crud.base.IBaseEnum; +import top.charles7c.continew.starter.data.mybatis.plus.enums.IBaseEnum; /** * 成功/失败状态枚举 diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/handler/GlobalExceptionHandler.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/handler/GlobalExceptionHandler.java index 7fbfce75..1ba2b4ad 100644 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/handler/GlobalExceptionHandler.java +++ b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/handler/GlobalExceptionHandler.java @@ -43,9 +43,9 @@ import top.charles7c.continew.admin.common.util.holder.LogContextHolder; import top.charles7c.continew.starter.core.constant.StringConstants; +import top.charles7c.continew.starter.core.exception.BadRequestException; +import top.charles7c.continew.starter.core.exception.BusinessException; import top.charles7c.continew.starter.core.util.ExceptionUtils; -import top.charles7c.continew.starter.extension.crud.exception.BadRequestException; -import top.charles7c.continew.starter.extension.crud.exception.BusinessException; import top.charles7c.continew.starter.extension.crud.model.resp.R; /** diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/util/SecureUtils.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/util/SecureUtils.java index 4279b83a..121e3d79 100644 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/util/SecureUtils.java +++ b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/util/SecureUtils.java @@ -24,7 +24,7 @@ import cn.hutool.crypto.asymmetric.KeyType; import top.charles7c.continew.admin.common.config.properties.RsaProperties; -import top.charles7c.continew.starter.extension.crud.util.validate.ValidationUtils; +import top.charles7c.continew.starter.core.util.validate.ValidationUtils; /** * 加密/解密工具类 diff --git a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/enums/LogStatusEnum.java b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/enums/LogStatusEnum.java index 090d68ad..d64aac00 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/enums/LogStatusEnum.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/enums/LogStatusEnum.java @@ -19,7 +19,7 @@ import lombok.Getter; import lombok.RequiredArgsConstructor; -import top.charles7c.continew.starter.extension.crud.base.IBaseEnum; +import top.charles7c.continew.starter.data.mybatis.plus.enums.IBaseEnum; /** * 操作状态枚举 diff --git a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/query/LoginLogQuery.java b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/query/LoginLogQuery.java index 62d0d100..8df9eafd 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/query/LoginLogQuery.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/query/LoginLogQuery.java @@ -29,8 +29,8 @@ import cn.hutool.core.date.DatePattern; -import top.charles7c.continew.starter.extension.crud.annotation.Query; -import top.charles7c.continew.starter.extension.crud.enums.QueryTypeEnum; +import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; +import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryTypeEnum; /** * 登录日志查询条件 diff --git a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/query/OperationLogQuery.java b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/query/OperationLogQuery.java index 53cb330f..df57dd10 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/query/OperationLogQuery.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/query/OperationLogQuery.java @@ -29,8 +29,8 @@ import cn.hutool.core.date.DatePattern; -import top.charles7c.continew.starter.extension.crud.annotation.Query; -import top.charles7c.continew.starter.extension.crud.enums.QueryTypeEnum; +import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; +import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryTypeEnum; /** * 操作日志查询条件 diff --git a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/query/SystemLogQuery.java b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/query/SystemLogQuery.java index 0240ca4e..c3fcbef0 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/query/SystemLogQuery.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/query/SystemLogQuery.java @@ -29,8 +29,8 @@ import cn.hutool.core.date.DatePattern; -import top.charles7c.continew.starter.extension.crud.annotation.Query; -import top.charles7c.continew.starter.extension.crud.enums.QueryTypeEnum; +import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; +import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryTypeEnum; /** * 系统日志查询条件 diff --git a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/service/impl/LogServiceImpl.java b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/service/impl/LogServiceImpl.java index fe7cef22..e0b96b59 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/service/impl/LogServiceImpl.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/service/impl/LogServiceImpl.java @@ -42,12 +42,12 @@ import top.charles7c.continew.admin.monitor.model.resp.*; import top.charles7c.continew.admin.monitor.service.LogService; import top.charles7c.continew.starter.core.util.ExceptionUtils; +import top.charles7c.continew.starter.core.util.ReflectUtils; +import top.charles7c.continew.starter.core.util.validate.CheckUtils; +import top.charles7c.continew.starter.data.mybatis.plus.util.QueryHelper; import top.charles7c.continew.starter.extension.crud.base.CommonUserService; import top.charles7c.continew.starter.extension.crud.model.query.PageQuery; import top.charles7c.continew.starter.extension.crud.model.resp.PageDataResp; -import top.charles7c.continew.starter.extension.crud.util.QueryHelper; -import top.charles7c.continew.starter.extension.crud.util.ReflectUtils; -import top.charles7c.continew.starter.extension.crud.util.validate.CheckUtils; /** * 系统日志业务实现 diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/auth/service/impl/LoginServiceImpl.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/auth/service/impl/LoginServiceImpl.java index 344766e9..7b1189c1 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/auth/service/impl/LoginServiceImpl.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/auth/service/impl/LoginServiceImpl.java @@ -56,9 +56,9 @@ import top.charles7c.continew.admin.system.model.resp.MenuResp; import top.charles7c.continew.admin.system.service.*; import top.charles7c.continew.starter.core.autoconfigure.project.ProjectProperties; +import top.charles7c.continew.starter.core.util.validate.CheckUtils; import top.charles7c.continew.starter.extension.crud.annotation.TreeField; import top.charles7c.continew.starter.extension.crud.util.TreeUtils; -import top.charles7c.continew.starter.extension.crud.util.validate.CheckUtils; import me.zhyd.oauth.model.AuthUser; diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/enums/AnnouncementStatusEnum.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/enums/AnnouncementStatusEnum.java index 5e31fa18..3fb4e3f0 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/enums/AnnouncementStatusEnum.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/enums/AnnouncementStatusEnum.java @@ -20,7 +20,7 @@ import lombok.RequiredArgsConstructor; import top.charles7c.continew.admin.common.constant.UIConstants; -import top.charles7c.continew.starter.extension.crud.base.IBaseEnum; +import top.charles7c.continew.starter.data.mybatis.plus.enums.IBaseEnum; /** * 公告状态枚举 diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/AnnouncementQuery.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/AnnouncementQuery.java index 5f08cbb1..f44eeefc 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/AnnouncementQuery.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/AnnouncementQuery.java @@ -23,8 +23,8 @@ import io.swagger.v3.oas.annotations.media.Schema; -import top.charles7c.continew.starter.extension.crud.annotation.Query; -import top.charles7c.continew.starter.extension.crud.enums.QueryTypeEnum; +import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; +import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryTypeEnum; /** * 公告查询条件 diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/DeptQuery.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/DeptQuery.java index 75d184ed..21d8e3bb 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/DeptQuery.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/DeptQuery.java @@ -23,8 +23,8 @@ import io.swagger.v3.oas.annotations.media.Schema; -import top.charles7c.continew.starter.extension.crud.annotation.Query; -import top.charles7c.continew.starter.extension.crud.enums.QueryTypeEnum; +import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; +import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryTypeEnum; /** * 部门查询条件 diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/DictItemQuery.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/DictItemQuery.java index 525bae84..1b9a5ce9 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/DictItemQuery.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/DictItemQuery.java @@ -23,7 +23,7 @@ import io.swagger.v3.oas.annotations.media.Schema; -import top.charles7c.continew.starter.extension.crud.annotation.Query; +import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; /** * 字典项查询条件 diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/DictQuery.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/DictQuery.java index 0808f7e4..4a335f35 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/DictQuery.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/DictQuery.java @@ -23,7 +23,7 @@ import io.swagger.v3.oas.annotations.media.Schema; -import top.charles7c.continew.starter.extension.crud.annotation.Query; +import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; /** * 字典查询条件 diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/MenuQuery.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/MenuQuery.java index bdb1ef47..5009a436 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/MenuQuery.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/MenuQuery.java @@ -23,8 +23,8 @@ import io.swagger.v3.oas.annotations.media.Schema; -import top.charles7c.continew.starter.extension.crud.annotation.Query; -import top.charles7c.continew.starter.extension.crud.enums.QueryTypeEnum; +import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; +import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryTypeEnum; /** * 菜单查询条件 diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/MessageQuery.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/MessageQuery.java index 91a4c7ce..02313673 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/MessageQuery.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/MessageQuery.java @@ -22,8 +22,8 @@ import io.swagger.v3.oas.annotations.media.Schema; -import top.charles7c.continew.starter.extension.crud.annotation.Query; -import top.charles7c.continew.starter.extension.crud.enums.QueryTypeEnum; +import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; +import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryTypeEnum; /** * 消息查询条件 diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/OptionQuery.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/OptionQuery.java index 699a5dc0..c13f0dba 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/OptionQuery.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/OptionQuery.java @@ -26,8 +26,8 @@ import io.swagger.v3.oas.annotations.media.Schema; -import top.charles7c.continew.starter.extension.crud.annotation.Query; -import top.charles7c.continew.starter.extension.crud.enums.QueryTypeEnum; +import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; +import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryTypeEnum; /** * 参数查询条件 diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/RoleQuery.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/RoleQuery.java index 006d86e0..8ce3b9fb 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/RoleQuery.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/RoleQuery.java @@ -23,7 +23,7 @@ import io.swagger.v3.oas.annotations.media.Schema; -import top.charles7c.continew.starter.extension.crud.annotation.Query; +import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; /** * 角色查询条件 diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/UserQuery.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/UserQuery.java index db28d625..ca71c1c8 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/UserQuery.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/UserQuery.java @@ -29,8 +29,8 @@ import cn.hutool.core.date.DatePattern; -import top.charles7c.continew.starter.extension.crud.annotation.Query; -import top.charles7c.continew.starter.extension.crud.enums.QueryTypeEnum; +import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; +import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryTypeEnum; /** * 用户查询条件 diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/DeptServiceImpl.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/DeptServiceImpl.java index d939cbfc..60c87cca 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/DeptServiceImpl.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/DeptServiceImpl.java @@ -43,8 +43,8 @@ import top.charles7c.continew.admin.system.service.RoleDeptService; import top.charles7c.continew.admin.system.service.UserService; import top.charles7c.continew.starter.core.util.ExceptionUtils; +import top.charles7c.continew.starter.core.util.validate.CheckUtils; import top.charles7c.continew.starter.extension.crud.base.BaseServiceImpl; -import top.charles7c.continew.starter.extension.crud.util.validate.CheckUtils; /** * 部门业务实现 diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/DictItemServiceImpl.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/DictItemServiceImpl.java index 0201a2e0..e9e940fe 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/DictItemServiceImpl.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/DictItemServiceImpl.java @@ -34,9 +34,9 @@ import top.charles7c.continew.admin.system.model.resp.DictItemDetailResp; import top.charles7c.continew.admin.system.model.resp.DictItemResp; import top.charles7c.continew.admin.system.service.DictItemService; +import top.charles7c.continew.starter.core.util.validate.CheckUtils; import top.charles7c.continew.starter.extension.crud.base.BaseServiceImpl; import top.charles7c.continew.starter.extension.crud.model.query.SortQuery; -import top.charles7c.continew.starter.extension.crud.util.validate.CheckUtils; /** * 字典项业务实现 diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/DictServiceImpl.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/DictServiceImpl.java index f4e646f3..d26c418f 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/DictServiceImpl.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/DictServiceImpl.java @@ -36,9 +36,9 @@ import top.charles7c.continew.admin.system.model.resp.DictResp; import top.charles7c.continew.admin.system.service.DictItemService; import top.charles7c.continew.admin.system.service.DictService; +import top.charles7c.continew.starter.core.util.validate.CheckUtils; import top.charles7c.continew.starter.extension.crud.base.BaseServiceImpl; import top.charles7c.continew.starter.extension.crud.model.query.SortQuery; -import top.charles7c.continew.starter.extension.crud.util.validate.CheckUtils; import top.charles7c.continew.starter.file.excel.util.ExcelUtils; /** diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/MenuServiceImpl.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/MenuServiceImpl.java index ad5e72ce..c3e81b5e 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/MenuServiceImpl.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/MenuServiceImpl.java @@ -36,8 +36,8 @@ import top.charles7c.continew.admin.system.model.req.MenuReq; import top.charles7c.continew.admin.system.model.resp.MenuResp; import top.charles7c.continew.admin.system.service.MenuService; +import top.charles7c.continew.starter.core.util.validate.CheckUtils; import top.charles7c.continew.starter.extension.crud.base.BaseServiceImpl; -import top.charles7c.continew.starter.extension.crud.util.validate.CheckUtils; /** * 菜单业务实现 diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/MessageServiceImpl.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/MessageServiceImpl.java index 633eb655..3ba6dbbd 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/MessageServiceImpl.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/MessageServiceImpl.java @@ -38,11 +38,11 @@ import top.charles7c.continew.admin.system.service.MessageService; import top.charles7c.continew.admin.system.service.MessageUserService; import top.charles7c.continew.starter.core.util.ExceptionUtils; +import top.charles7c.continew.starter.core.util.validate.CheckUtils; +import top.charles7c.continew.starter.data.mybatis.plus.util.QueryHelper; import top.charles7c.continew.starter.extension.crud.base.CommonUserService; import top.charles7c.continew.starter.extension.crud.model.query.PageQuery; import top.charles7c.continew.starter.extension.crud.model.resp.PageDataResp; -import top.charles7c.continew.starter.extension.crud.util.QueryHelper; -import top.charles7c.continew.starter.extension.crud.util.validate.CheckUtils; /** * 消息业务实现 diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/MessageUserServiceImpl.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/MessageUserServiceImpl.java index 95ffe966..847d3935 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/MessageUserServiceImpl.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/MessageUserServiceImpl.java @@ -33,7 +33,7 @@ import top.charles7c.continew.admin.system.model.resp.MessageTypeUnreadResp; import top.charles7c.continew.admin.system.model.resp.MessageUnreadResp; import top.charles7c.continew.admin.system.service.MessageUserService; -import top.charles7c.continew.starter.extension.crud.util.validate.CheckUtils; +import top.charles7c.continew.starter.core.util.validate.CheckUtils; /** * 消息和用户关联业务实现 diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/OptionServiceImpl.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/OptionServiceImpl.java index dffa8dc6..30cd9b6c 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/OptionServiceImpl.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/OptionServiceImpl.java @@ -34,7 +34,7 @@ import top.charles7c.continew.admin.system.model.req.OptionResetValueReq; import top.charles7c.continew.admin.system.model.resp.OptionResp; import top.charles7c.continew.admin.system.service.OptionService; -import top.charles7c.continew.starter.extension.crud.util.QueryHelper; +import top.charles7c.continew.starter.data.mybatis.plus.util.QueryHelper; /** * 参数业务实现 diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/RoleServiceImpl.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/RoleServiceImpl.java index 8dc45ec1..bbc56148 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/RoleServiceImpl.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/RoleServiceImpl.java @@ -44,8 +44,8 @@ import top.charles7c.continew.admin.system.model.resp.RoleDetailResp; import top.charles7c.continew.admin.system.model.resp.RoleResp; import top.charles7c.continew.admin.system.service.*; +import top.charles7c.continew.starter.core.util.validate.CheckUtils; import top.charles7c.continew.starter.extension.crud.base.BaseServiceImpl; -import top.charles7c.continew.starter.extension.crud.util.validate.CheckUtils; /** * 角色业务实现 diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/UserServiceImpl.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/UserServiceImpl.java index c2cf4800..11186ac0 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/UserServiceImpl.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/UserServiceImpl.java @@ -58,9 +58,9 @@ import top.charles7c.continew.starter.core.constant.StringConstants; import top.charles7c.continew.starter.core.util.ExceptionUtils; import top.charles7c.continew.starter.core.util.FileUploadUtils; +import top.charles7c.continew.starter.core.util.validate.CheckUtils; import top.charles7c.continew.starter.extension.crud.base.BaseServiceImpl; import top.charles7c.continew.starter.extension.crud.base.CommonUserService; -import top.charles7c.continew.starter.extension.crud.util.validate.CheckUtils; /** * 用户业务实现 diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/UserSocialServiceImpl.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/UserSocialServiceImpl.java index 8330e8da..98370197 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/UserSocialServiceImpl.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/UserSocialServiceImpl.java @@ -32,7 +32,7 @@ import top.charles7c.continew.admin.system.mapper.UserSocialMapper; import top.charles7c.continew.admin.system.model.entity.UserSocialDO; import top.charles7c.continew.admin.system.service.UserSocialService; -import top.charles7c.continew.starter.extension.crud.util.validate.CheckUtils; +import top.charles7c.continew.starter.core.util.validate.CheckUtils; import me.zhyd.oauth.model.AuthUser; diff --git a/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/enums/FormTypeEnum.java b/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/enums/FormTypeEnum.java index 1094c0b2..7a71451c 100644 --- a/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/enums/FormTypeEnum.java +++ b/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/enums/FormTypeEnum.java @@ -19,7 +19,7 @@ import lombok.Getter; import lombok.RequiredArgsConstructor; -import top.charles7c.continew.starter.extension.crud.base.IBaseEnum; +import top.charles7c.continew.starter.data.mybatis.plus.enums.IBaseEnum; /** * 表单类型枚举 diff --git a/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/model/entity/FieldConfigDO.java b/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/model/entity/FieldConfigDO.java index 0064bbe7..48d570fd 100644 --- a/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/model/entity/FieldConfigDO.java +++ b/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/model/entity/FieldConfigDO.java @@ -39,7 +39,7 @@ import top.charles7c.continew.admin.tool.enums.FormTypeEnum; import top.charles7c.continew.starter.core.constant.StringConstants; -import top.charles7c.continew.starter.extension.crud.enums.QueryTypeEnum; +import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryTypeEnum; /** * 字段配置实体 diff --git a/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/service/impl/GeneratorServiceImpl.java b/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/service/impl/GeneratorServiceImpl.java index 9b36898f..deca76e7 100644 --- a/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/service/impl/GeneratorServiceImpl.java +++ b/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/service/impl/GeneratorServiceImpl.java @@ -53,14 +53,14 @@ import top.charles7c.continew.admin.tool.model.resp.TableResp; import top.charles7c.continew.admin.tool.service.GeneratorService; import top.charles7c.continew.starter.core.constant.StringConstants; +import top.charles7c.continew.starter.core.exception.BusinessException; import top.charles7c.continew.starter.core.util.TemplateUtils; import top.charles7c.continew.starter.core.util.db.MetaUtils; import top.charles7c.continew.starter.core.util.db.Table; -import top.charles7c.continew.starter.extension.crud.enums.QueryTypeEnum; -import top.charles7c.continew.starter.extension.crud.exception.BusinessException; +import top.charles7c.continew.starter.core.util.validate.CheckUtils; +import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryTypeEnum; import top.charles7c.continew.starter.extension.crud.model.query.PageQuery; import top.charles7c.continew.starter.extension.crud.model.resp.PageDataResp; -import top.charles7c.continew.starter.extension.crud.util.validate.CheckUtils; /** * 代码生成业务实现 diff --git a/continew-admin-tool/src/main/resources/templates/generator/Query.ftl b/continew-admin-tool/src/main/resources/templates/generator/Query.ftl index dd2f2ba4..62fcc04b 100644 --- a/continew-admin-tool/src/main/resources/templates/generator/Query.ftl +++ b/continew-admin-tool/src/main/resources/templates/generator/Query.ftl @@ -32,8 +32,8 @@ import lombok.Data; import io.swagger.v3.oas.annotations.media.Schema; -import top.charles7c.continew.starter.extension.crud.annotation.Query; -import top.charles7c.continew.starter.extension.crud.enums.QueryTypeEnum; +import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; +import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryTypeEnum; /** * ${businessName}查询条件 diff --git a/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/auth/AuthController.java b/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/auth/AuthController.java index cdab84cd..78df08c8 100644 --- a/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/auth/AuthController.java +++ b/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/auth/AuthController.java @@ -48,8 +48,8 @@ import top.charles7c.continew.admin.system.service.UserService; import top.charles7c.continew.starter.cache.redisson.util.RedisUtils; import top.charles7c.continew.starter.core.util.ExceptionUtils; +import top.charles7c.continew.starter.core.util.validate.ValidationUtils; import top.charles7c.continew.starter.extension.crud.model.resp.R; -import top.charles7c.continew.starter.extension.crud.util.validate.ValidationUtils; /** * 认证 API diff --git a/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/auth/SocialAuthController.java b/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/auth/SocialAuthController.java index 95bc7cac..9e1b2a66 100644 --- a/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/auth/SocialAuthController.java +++ b/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/auth/SocialAuthController.java @@ -33,9 +33,9 @@ import top.charles7c.continew.admin.auth.model.resp.LoginResp; import top.charles7c.continew.admin.auth.service.LoginService; import top.charles7c.continew.admin.monitor.annotation.Log; -import top.charles7c.continew.starter.extension.crud.exception.BadRequestException; +import top.charles7c.continew.starter.core.exception.BadRequestException; +import top.charles7c.continew.starter.core.util.validate.ValidationUtils; import top.charles7c.continew.starter.extension.crud.model.resp.R; -import top.charles7c.continew.starter.extension.crud.util.validate.ValidationUtils; import me.zhyd.oauth.model.AuthCallback; import me.zhyd.oauth.model.AuthResponse; diff --git a/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/common/CaptchaController.java b/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/common/CaptchaController.java index 92ad1918..b4c207e7 100644 --- a/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/common/CaptchaController.java +++ b/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/common/CaptchaController.java @@ -54,8 +54,8 @@ import top.charles7c.continew.starter.captcha.graphic.autoconfigure.GraphicCaptchaProperties; import top.charles7c.continew.starter.core.autoconfigure.project.ProjectProperties; import top.charles7c.continew.starter.core.util.TemplateUtils; +import top.charles7c.continew.starter.core.util.validate.CheckUtils; import top.charles7c.continew.starter.extension.crud.model.resp.R; -import top.charles7c.continew.starter.extension.crud.util.validate.CheckUtils; import top.charles7c.continew.starter.messaging.mail.util.MailUtils; /** diff --git a/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/common/CommonController.java b/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/common/CommonController.java index 9a394b11..f032101b 100644 --- a/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/common/CommonController.java +++ b/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/common/CommonController.java @@ -54,11 +54,11 @@ import top.charles7c.continew.admin.system.service.*; import top.charles7c.continew.starter.core.autoconfigure.project.ProjectProperties; import top.charles7c.continew.starter.core.util.FileUploadUtils; -import top.charles7c.continew.starter.extension.crud.base.IBaseEnum; +import top.charles7c.continew.starter.core.util.validate.CheckUtils; +import top.charles7c.continew.starter.core.util.validate.ValidationUtils; +import top.charles7c.continew.starter.data.mybatis.plus.enums.IBaseEnum; import top.charles7c.continew.starter.extension.crud.model.query.SortQuery; import top.charles7c.continew.starter.extension.crud.model.resp.R; -import top.charles7c.continew.starter.extension.crud.util.validate.CheckUtils; -import top.charles7c.continew.starter.extension.crud.util.validate.ValidationUtils; /** * 公共 API diff --git a/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/common/DashboardController.java b/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/common/DashboardController.java index ea3bc90c..92aa4b6d 100644 --- a/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/common/DashboardController.java +++ b/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/common/DashboardController.java @@ -38,8 +38,8 @@ import top.charles7c.continew.admin.monitor.model.resp.DashboardTotalResp; import top.charles7c.continew.admin.monitor.service.DashboardService; import top.charles7c.continew.admin.system.model.resp.DashboardAnnouncementResp; +import top.charles7c.continew.starter.core.util.validate.ValidationUtils; import top.charles7c.continew.starter.extension.crud.model.resp.R; -import top.charles7c.continew.starter.extension.crud.util.validate.ValidationUtils; /** * 仪表盘 API diff --git a/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/monitor/OnlineUserController.java b/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/monitor/OnlineUserController.java index 442756f0..ea5ae035 100644 --- a/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/monitor/OnlineUserController.java +++ b/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/monitor/OnlineUserController.java @@ -32,10 +32,10 @@ import top.charles7c.continew.admin.auth.model.query.OnlineUserQuery; import top.charles7c.continew.admin.auth.model.resp.OnlineUserResp; import top.charles7c.continew.admin.auth.service.OnlineUserService; +import top.charles7c.continew.starter.core.util.validate.CheckUtils; import top.charles7c.continew.starter.extension.crud.model.query.PageQuery; import top.charles7c.continew.starter.extension.crud.model.resp.PageDataResp; import top.charles7c.continew.starter.extension.crud.model.resp.R; -import top.charles7c.continew.starter.extension.crud.util.validate.CheckUtils; /** * 在线用户 API diff --git a/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/system/AnnouncementController.java b/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/system/AnnouncementController.java index b211a107..2f57ae71 100644 --- a/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/system/AnnouncementController.java +++ b/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/system/AnnouncementController.java @@ -30,11 +30,11 @@ import top.charles7c.continew.admin.system.model.resp.AnnouncementDetailResp; import top.charles7c.continew.admin.system.model.resp.AnnouncementResp; import top.charles7c.continew.admin.system.service.AnnouncementService; +import top.charles7c.continew.starter.core.util.validate.ValidationUtils; import top.charles7c.continew.starter.extension.crud.annotation.CrudRequestMapping; import top.charles7c.continew.starter.extension.crud.base.BaseController; import top.charles7c.continew.starter.extension.crud.base.ValidateGroup; import top.charles7c.continew.starter.extension.crud.model.resp.R; -import top.charles7c.continew.starter.extension.crud.util.validate.ValidationUtils; /** * 公告管理 API diff --git a/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/system/MenuController.java b/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/system/MenuController.java index 212a863f..595d2049 100644 --- a/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/system/MenuController.java +++ b/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/system/MenuController.java @@ -31,12 +31,12 @@ import top.charles7c.continew.admin.system.model.resp.MenuResp; import top.charles7c.continew.admin.system.service.MenuService; import top.charles7c.continew.starter.core.util.URLUtils; +import top.charles7c.continew.starter.core.util.validate.ValidationUtils; import top.charles7c.continew.starter.extension.crud.annotation.CrudRequestMapping; import top.charles7c.continew.starter.extension.crud.base.BaseController; import top.charles7c.continew.starter.extension.crud.base.ValidateGroup; import top.charles7c.continew.starter.extension.crud.enums.Api; import top.charles7c.continew.starter.extension.crud.model.resp.R; -import top.charles7c.continew.starter.extension.crud.util.validate.ValidationUtils; /** * 菜单管理 API diff --git a/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/system/UserCenterController.java b/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/system/UserCenterController.java index 109faa4c..dc42ed9c 100644 --- a/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/system/UserCenterController.java +++ b/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/system/UserCenterController.java @@ -52,8 +52,8 @@ import top.charles7c.continew.admin.system.service.UserSocialService; import top.charles7c.continew.starter.cache.redisson.util.RedisUtils; import top.charles7c.continew.starter.core.util.ExceptionUtils; +import top.charles7c.continew.starter.core.util.validate.ValidationUtils; import top.charles7c.continew.starter.extension.crud.model.resp.R; -import top.charles7c.continew.starter.extension.crud.util.validate.ValidationUtils; import me.zhyd.oauth.model.AuthCallback; import me.zhyd.oauth.model.AuthResponse; diff --git a/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/tool/GeneratorController.java b/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/tool/GeneratorController.java index 720dd699..369742e9 100644 --- a/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/tool/GeneratorController.java +++ b/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/tool/GeneratorController.java @@ -38,10 +38,10 @@ import top.charles7c.continew.admin.tool.model.resp.TableResp; import top.charles7c.continew.admin.tool.service.GeneratorService; import top.charles7c.continew.starter.core.autoconfigure.project.ProjectProperties; +import top.charles7c.continew.starter.core.util.validate.ValidationUtils; import top.charles7c.continew.starter.extension.crud.model.query.PageQuery; import top.charles7c.continew.starter.extension.crud.model.resp.PageDataResp; import top.charles7c.continew.starter.extension.crud.model.resp.R; -import top.charles7c.continew.starter.extension.crud.util.validate.ValidationUtils; /** * 代码生成 API diff --git a/pom.xml b/pom.xml index c34eced1..0ddfb66c 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ top.charles7c.continew continew-starter - 1.0.0 + 1.0.1-SNAPSHOT top.charles7c.continew @@ -130,6 +130,15 @@ true + + sonatype-nexus-snapshots + Sonatype Nexus Snapshots + https://s01.oss.sonatype.org/content/repositories/snapshots/ + + always + true + + From 8914b8d9e9765729cd7e2a5f7a3b00e045d0fe24 Mon Sep 17 00:00:00 2001 From: Charles7c Date: Fri, 8 Dec 2023 19:59:31 +0800 Subject: [PATCH 03/49] =?UTF-8?q?docs:=20=E6=9B=B4=E6=96=B0=20README=20?= =?UTF-8?q?=E6=96=87=E6=A1=A3=E9=83=A8=E5=88=86=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 12 ++++++------ docker/docker-compose.yml | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index bb186a66..6dbc376a 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Release -📚 [在线文档](https://doc.charles7c.top) | ✨ [提交需求](https://doc.charles7c.top/require.html) | 🚀 [演示地址](https://cnadmin.charles7c.top)(账号/密码:admin/admin123) +📚 [在线文档](https://doc.charles7c.top) | 🚀 [演示地址](https://cnadmin.charles7c.top)(账号/密码:admin/admin123) ## 简介 @@ -152,7 +152,7 @@ ContiNew Admin (Continue New Admin)中后台管理框架/脚手架,持续 ## 快速开始 > **Note** -> 下方步骤有重叠部分,无需重复执行。 +> 更详细的流程,请查看在线文档[《快速开始》](https://doc.charles7c.top/guide/intro/quick-start.html)。 ### 后端 @@ -201,7 +201,7 @@ pnpm dev # 6.部署 # 6.1 Docker 部署 # 6.1.1 服务器安装好 docker 及 docker-compose(参考:https://blog.charles7c.top/categories/fragments/2022/10/31/CentOS%E5%AE%89%E8%A3%85Docker) -# 6.1.2 执行 pnpm build 进行项目打包,将 dist 目录下的所有文件放到 /docker/continew-admin/web 目录下 +# 6.1.2 执行 pnpm build 进行项目打包,将 dist 目录下的所有文件放到 /docker/continew-admin/html 目录下 # 6.1.3 将 docker 目录上传到服务器 / 目录下,并授权(chmod -R 777 /docker) # 6.1.4 修改 docker-compose.yml 中的 MySQL 配置、Redis 配置、continew-admin-server 配置、Nginx 配置 # 6.1.5 执行 docker-compose up -d 创建并后台运行所有容器 @@ -443,7 +443,7 @@ ContiNew Admin 致力于持续以最新流行技术栈构建,拥抱变化, ### 分支说明 -ContiNew Admin 的分支目前分为下个大版本的开发分支和上个大版本的维护分支,PR 前请注意对应分支是否处于维护状态,版本支持情况请查看 [更新日志/版本支持](https://doc.charles7c.top/other/changelog.html#%E7%89%88%E6%9C%AC%E6%94%AF%E6%8C%81)。 +ContiNew Admin 的分支目前分为下个大版本的开发分支和上个大版本的维护分支,PR 前请注意对应分支是否处于维护状态,版本支持情况请查看 [更新日志/版本支持](https://doc.charles7c.top/changelog.html#%E7%89%88%E6%9C%AC%E6%94%AF%E6%8C%81)。 | 分支 | 说明 | | ----- | ------------------------------------------------------------ | @@ -472,7 +472,7 @@ ContiNew Admin 的分支目前分为下个大版本的开发分支和上个大 ## 反馈交流 -💬 欢迎各位小伙伴儿扫描下方二维码加好友,备注 `cnadmin`,拉你进群,探讨技术、提提需求~ +欢迎各位小伙伴儿扫描下方二维码加好友,备注 `cnadmin`,拉你进群,探讨技术、提提需求~ 加入交流群后,你将会: @@ -486,7 +486,7 @@ ContiNew Admin 的分支目前分为下个大版本的开发分支和上个大
无加群意愿 -💬 如无加群意愿,欢迎在 Issues 中反馈交流~ 🍻 +如无加群意愿,欢迎在 Issues 中反馈交流~ 🍻
## 鸣谢 diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 628b04bf..41bf3a13 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -51,7 +51,7 @@ services: REDIS_HOST: 172.17.0.1 REDIS_PORT: 6379 REDIS_PWD: 你的 Redis 密码 - REDIS_DB: 你的 Redis 数据库索引 + REDIS_DB: 0 volumes: - /docker/continew-admin/config/:/app/config/ - /docker/continew-admin/data/file/:/app/data/file/ From 108f1c4ae7b855ac0bab2d3fe028270472a8be71 Mon Sep 17 00:00:00 2001 From: Charles7c Date: Tue, 12 Dec 2023 20:36:46 +0800 Subject: [PATCH 04/49] =?UTF-8?q?refactor:=20=E4=BC=98=E5=8C=96=20API=20?= =?UTF-8?q?=E6=96=87=E6=A1=A3=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/config/application.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/continew-admin-webapi/src/main/resources/config/application.yml b/continew-admin-webapi/src/main/resources/config/application.yml index 794a77ea..f2a576ec 100644 --- a/continew-admin-webapi/src/main/resources/config/application.yml +++ b/continew-admin-webapi/src/main/resources/config/application.yml @@ -44,6 +44,7 @@ springdoc: # 设置对象型参数的展示形式(设为 true 表示将对象型参数平展开,即对象内的属性直接作为参数展示而不是嵌套在对象内,默认为 false) # 如果不添加该全局配置,可以在需要如此处理的对象参数类上使用 @ParameterObject default-flat-param-object: true + # 分组配置 group-configs: - group: 'all' paths-to-match: '/**' @@ -72,6 +73,15 @@ springdoc: display-name: '系统监控' paths-to-match: '/monitor/**' packages-to-scan: ${project.base-package}.webapi.monitor + ## 组件配置 + components: + # 鉴权配置 + security-schemes: + Authorization: + type: HTTP + in: HEADER + name: ${sa-token.token-name} + scheme: ${sa-token.token-prefix} ## 接口文档增强配置 knife4j: enable: true From 3ece42b94e071ece87e6b4616f7817bf851ba28f Mon Sep 17 00:00:00 2001 From: Charles7c Date: Tue, 12 Dec 2023 20:39:33 +0800 Subject: [PATCH 05/49] =?UTF-8?q?style:=20=E8=B0=83=E6=95=B4=E6=9E=9A?= =?UTF-8?q?=E4=B8=BE=E9=85=8D=E7=BD=AE=E5=80=BC=E4=B8=BA=E5=A4=A7=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/config/application-dev.yml | 6 +++--- .../src/main/resources/config/application-prod.yml | 6 +++--- .../src/main/resources/config/application.yml | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/continew-admin-webapi/src/main/resources/config/application-dev.yml b/continew-admin-webapi/src/main/resources/config/application-dev.yml index 6c914846..76b02669 100644 --- a/continew-admin-webapi/src/main/resources/config/application-dev.yml +++ b/continew-admin-webapi/src/main/resources/config/application-dev.yml @@ -73,7 +73,7 @@ spring.data: enabled: false redisson: enabled: true - mode: single + mode: SINGLE --- ### Spring Cache 配置 spring.cache: @@ -118,7 +118,7 @@ captcha: --- ### 短信配置 sms: # 从 YAML 读取配置 - config-type: yaml + config-type: YAML is-print: false blends: cloopen: @@ -174,7 +174,7 @@ justauth: client-secret: 1f7d08**********5b7**********29e redirect-uri: ${project.url}/social/callback?source=github cache: - type: redis + type: REDIS --- ### Sa-Token 扩展配置 sa-token.extension: diff --git a/continew-admin-webapi/src/main/resources/config/application-prod.yml b/continew-admin-webapi/src/main/resources/config/application-prod.yml index a10d820c..bf48ae8e 100644 --- a/continew-admin-webapi/src/main/resources/config/application-prod.yml +++ b/continew-admin-webapi/src/main/resources/config/application-prod.yml @@ -75,7 +75,7 @@ spring.data: enabled: false redisson: enabled: true - mode: single + mode: SINGLE --- ### Spring Cache 配置 spring.cache: @@ -120,7 +120,7 @@ captcha: --- ### 短信配置 sms: # 从 YAML 读取配置 - config-type: yaml + config-type: YAML is-print: false blends: cloopen: @@ -180,7 +180,7 @@ justauth: client-secret: 1f7d08**********5b7**********29e redirect-uri: ${project.url}/social/callback?source=github cache: - type: redis + type: REDIS --- ### Sa-Token 扩展配置 sa-token.extension: diff --git a/continew-admin-webapi/src/main/resources/config/application.yml b/continew-admin-webapi/src/main/resources/config/application.yml index f2a576ec..9a6a554f 100644 --- a/continew-admin-webapi/src/main/resources/config/application.yml +++ b/continew-admin-webapi/src/main/resources/config/application.yml @@ -117,7 +117,7 @@ sa-token: # 权限认证实现 permission-impl: top.charles7c.continew.admin.auth.config.satoken.SaTokenPermissionImpl # 持久层配置 - dao.type: redis + dao.type: REDIS --- ### MyBatis Plus 配置 mybatis-plus: @@ -151,7 +151,7 @@ mybatis-plus: # 分页插件配置 pagination: enabled: true - db-type: mysql + db-type: MYSQL --- ### 服务器配置 server: From 3fdc50d78ec50a878cec2b35c7d5028e741c42d7 Mon Sep 17 00:00:00 2001 From: Charles7c Date: Tue, 12 Dec 2023 22:38:35 +0800 Subject: [PATCH 06/49] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E7=94=9F=E6=88=90=E7=9B=B8=E5=85=B3=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1.通用枚举查询无法扫描到 QueryTypeEnum 2.前端路径校验错误 3.部分命名格式修复 --- .../admin/tool/enums/QueryTypeEnum.java | 93 +++++++++++++++++++ .../tool/model/entity/FieldConfigDO.java | 2 +- .../admin/tool/model/entity/GenConfigDO.java | 1 - .../service/impl/GeneratorServiceImpl.java | 2 +- .../src/views/tool/generator/index.vue | 6 +- 5 files changed, 98 insertions(+), 6 deletions(-) create mode 100644 continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/enums/QueryTypeEnum.java diff --git a/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/enums/QueryTypeEnum.java b/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/enums/QueryTypeEnum.java new file mode 100644 index 00000000..0ab47508 --- /dev/null +++ b/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/enums/QueryTypeEnum.java @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package top.charles7c.continew.admin.tool.enums; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +import top.charles7c.continew.starter.data.mybatis.plus.enums.IBaseEnum; + +/** + * 查询类型枚举 + * + * @author Charles7c + * @since 2023/8/6 10:49 + */ +@Getter +@RequiredArgsConstructor +public enum QueryTypeEnum implements IBaseEnum { + + /** + * 等值查询,例如:WHERE `age` = 18 + */ + EQUAL(1, "="), + /** + * 非等值查询,例如:WHERE `age` != 18 + */ + NOT_EQUAL(2, "!="), + /** + * 大于查询,例如:WHERE `age` > 18 + */ + GREATER_THAN(3, ">"), + /** + * 小于查询,例如:WHERE `age` < 18 + */ + LESS_THAN(4, "<"), + /** + * 大于等于查询,例如:WHERE `age` >= 18 + */ + GREATER_THAN_OR_EQUAL(5, ">="), + /** + * 小于等于查询,例如:WHERE `age` <= 18 + */ + LESS_THAN_OR_EQUAL(6, "<="), + /** + * 范围查询,例如:WHERE `age` BETWEEN 10 AND 18 + */ + BETWEEN(7, "BETWEEN"), + /** + * 左模糊查询,例如:WHERE `nickname` LIKE '%s' + */ + LEFT_LIKE(8, "LIKE '%s'"), + /** + * 中模糊查询,例如:WHERE `nickname` LIKE '%s%' + */ + INNER_LIKE(9, "LIKE '%s%'"), + /** + * 右模糊查询,例如:WHERE `nickname` LIKE 's%' + */ + RIGHT_LIKE(10, "LIKE 's%'"), + /** + * 包含查询,例如:WHERE `age` IN (10, 20, 30) + */ + IN(11, "IN"), + /** + * 不包含查询,例如:WHERE `age` NOT IN (20, 30) + */ + NOT_IN(12, "NOT IN"), + /** + * 空查询,例如:WHERE `email` IS NULL + */ + IS_NULL(13, "IS NULL"), + /** + * 非空查询,例如:WHERE `email` IS NOT NULL + */ + IS_NOT_NULL(14, "IS NOT NULL"),; + + private final Integer value; + private final String description; +} diff --git a/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/model/entity/FieldConfigDO.java b/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/model/entity/FieldConfigDO.java index 48d570fd..01f4a846 100644 --- a/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/model/entity/FieldConfigDO.java +++ b/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/model/entity/FieldConfigDO.java @@ -38,8 +38,8 @@ import cn.hutool.setting.dialect.PropsUtil; import top.charles7c.continew.admin.tool.enums.FormTypeEnum; +import top.charles7c.continew.admin.tool.enums.QueryTypeEnum; import top.charles7c.continew.starter.core.constant.StringConstants; -import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryTypeEnum; /** * 字段配置实体 diff --git a/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/model/entity/GenConfigDO.java b/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/model/entity/GenConfigDO.java index b8750fe0..19eb1033 100644 --- a/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/model/entity/GenConfigDO.java +++ b/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/model/entity/GenConfigDO.java @@ -85,7 +85,6 @@ public class GenConfigDO implements Serializable { */ @Schema(description = "前端路径", example = "D:/continew-admin/continew-admin-ui/src/views/system/user") @Length(max = 255, message = "前端路径不能超过 {max} 个字符") - @Pattern(regexp = "^$|^(?=.*src\\/views)(?!.*\\/views\\/?$).*", message = "前端路径配置错误") private String frontendPath; /** diff --git a/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/service/impl/GeneratorServiceImpl.java b/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/service/impl/GeneratorServiceImpl.java index deca76e7..1882beb1 100644 --- a/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/service/impl/GeneratorServiceImpl.java +++ b/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/service/impl/GeneratorServiceImpl.java @@ -44,6 +44,7 @@ import top.charles7c.continew.admin.tool.config.properties.GeneratorProperties; import top.charles7c.continew.admin.tool.config.properties.GeneratorProperties.TemplateConfig; +import top.charles7c.continew.admin.tool.enums.QueryTypeEnum; import top.charles7c.continew.admin.tool.mapper.FieldConfigMapper; import top.charles7c.continew.admin.tool.mapper.GenConfigMapper; import top.charles7c.continew.admin.tool.model.entity.FieldConfigDO; @@ -58,7 +59,6 @@ import top.charles7c.continew.starter.core.util.db.MetaUtils; import top.charles7c.continew.starter.core.util.db.Table; import top.charles7c.continew.starter.core.util.validate.CheckUtils; -import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryTypeEnum; import top.charles7c.continew.starter.extension.crud.model.query.PageQuery; import top.charles7c.continew.starter.extension.crud.model.resp.PageDataResp; diff --git a/continew-admin-ui/src/views/tool/generator/index.vue b/continew-admin-ui/src/views/tool/generator/index.vue index 2618ecdd..a1e9ccf4 100644 --- a/continew-admin-ui/src/views/tool/generator/index.vue +++ b/continew-admin-ui/src/views/tool/generator/index.vue @@ -202,7 +202,7 @@ 无需设置 @@ -281,9 +281,9 @@ } from '@/api/tool/generator'; const { proxy } = getCurrentInstance() as any; - const { form_type_enum, query_type_Enum } = proxy.useDict( + const { form_type_enum, query_type_enum } = proxy.useDict( 'form_type_enum', - 'query_type_Enum', + 'query_type_enum', ); const tableList = ref([]); From 97c273f99ecb038e041e3d39dbfacf326d49cc1b Mon Sep 17 00:00:00 2001 From: Charles7c Date: Wed, 13 Dec 2023 23:45:46 +0800 Subject: [PATCH 07/49] =?UTF-8?q?style:=20=E9=80=82=E9=85=8D=20ContiNew=20?= =?UTF-8?q?Starter=20QueryTypeEnum=20=E5=91=BD=E5=90=8D=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../continew/admin/monitor/model/query/LoginLogQuery.java | 4 ++-- .../admin/monitor/model/query/OperationLogQuery.java | 6 +++--- .../continew/admin/monitor/model/query/SystemLogQuery.java | 4 ++-- .../admin/system/model/query/AnnouncementQuery.java | 6 +++--- .../continew/admin/system/model/query/DeptQuery.java | 4 ++-- .../continew/admin/system/model/query/MenuQuery.java | 4 ++-- .../continew/admin/system/model/query/MessageQuery.java | 4 ++-- .../continew/admin/system/model/query/OptionQuery.java | 4 ++-- .../continew/admin/system/model/query/UserQuery.java | 4 ++-- .../src/main/resources/templates/generator/Query.ftl | 4 ++-- 10 files changed, 22 insertions(+), 22 deletions(-) diff --git a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/query/LoginLogQuery.java b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/query/LoginLogQuery.java index 8df9eafd..1cd08e24 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/query/LoginLogQuery.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/query/LoginLogQuery.java @@ -30,7 +30,7 @@ import cn.hutool.core.date.DatePattern; import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; -import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryTypeEnum; +import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryType; /** * 登录日志查询条件 @@ -56,7 +56,7 @@ public class LoginLogQuery implements Serializable { * 登录时间 */ @Schema(description = "登录时间", example = "2023-08-08 00:00:00,2023-08-08 23:59:59") - @Query(type = QueryTypeEnum.BETWEEN) + @Query(type = QueryType.BETWEEN) @DateTimeFormat(pattern = DatePattern.NORM_DATETIME_PATTERN) private List createTime; } diff --git a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/query/OperationLogQuery.java b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/query/OperationLogQuery.java index df57dd10..51d24a25 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/query/OperationLogQuery.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/query/OperationLogQuery.java @@ -30,7 +30,7 @@ import cn.hutool.core.date.DatePattern; import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; -import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryTypeEnum; +import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryType; /** * 操作日志查询条件 @@ -49,7 +49,7 @@ public class OperationLogQuery implements Serializable { * 操作内容 */ @Schema(description = "操作内容", example = "新增数据") - @Query(type = QueryTypeEnum.INNER_LIKE) + @Query(type = QueryType.INNER_LIKE) private String description; /** @@ -63,7 +63,7 @@ public class OperationLogQuery implements Serializable { * 操作时间 */ @Schema(description = "操作时间", example = "2023-08-08 00:00:00,2023-08-08 23:59:59") - @Query(type = QueryTypeEnum.BETWEEN) + @Query(type = QueryType.BETWEEN) @DateTimeFormat(pattern = DatePattern.NORM_DATETIME_PATTERN) private List createTime; diff --git a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/query/SystemLogQuery.java b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/query/SystemLogQuery.java index c3fcbef0..663755e3 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/query/SystemLogQuery.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/query/SystemLogQuery.java @@ -30,7 +30,7 @@ import cn.hutool.core.date.DatePattern; import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; -import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryTypeEnum; +import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryType; /** * 系统日志查询条件 @@ -49,7 +49,7 @@ public class SystemLogQuery implements Serializable { * 创建时间 */ @Schema(description = "创建时间", example = "2023-08-08 00:00:00,2023-08-08 23:59:59") - @Query(type = QueryTypeEnum.BETWEEN) + @Query(type = QueryType.BETWEEN) @DateTimeFormat(pattern = DatePattern.NORM_DATETIME_PATTERN) private List createTime; } diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/AnnouncementQuery.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/AnnouncementQuery.java index f44eeefc..4a5a3b89 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/AnnouncementQuery.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/AnnouncementQuery.java @@ -24,7 +24,7 @@ import io.swagger.v3.oas.annotations.media.Schema; import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; -import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryTypeEnum; +import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryType; /** * 公告查询条件 @@ -43,13 +43,13 @@ public class AnnouncementQuery implements Serializable { * 标题 */ @Schema(description = "标题", example = "这是公告标题") - @Query(type = QueryTypeEnum.INNER_LIKE) + @Query(type = QueryType.INNER_LIKE) private String title; /** * 类型 */ @Schema(description = "类型", example = "1") - @Query(type = QueryTypeEnum.EQUAL) + @Query(type = QueryType.EQUAL) private String type; } \ No newline at end of file diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/DeptQuery.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/DeptQuery.java index 21d8e3bb..0426e5be 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/DeptQuery.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/DeptQuery.java @@ -24,7 +24,7 @@ import io.swagger.v3.oas.annotations.media.Schema; import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; -import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryTypeEnum; +import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryType; /** * 部门查询条件 @@ -43,7 +43,7 @@ public class DeptQuery implements Serializable { * 部门名称 */ @Schema(description = "部门名称", example = "测试部") - @Query(type = QueryTypeEnum.INNER_LIKE) + @Query(type = QueryType.INNER_LIKE) private String name; /** diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/MenuQuery.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/MenuQuery.java index 5009a436..7ff6b609 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/MenuQuery.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/MenuQuery.java @@ -24,7 +24,7 @@ import io.swagger.v3.oas.annotations.media.Schema; import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; -import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryTypeEnum; +import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryType; /** * 菜单查询条件 @@ -43,7 +43,7 @@ public class MenuQuery implements Serializable { * 菜单标题 */ @Schema(description = "菜单标题", example = "用户管理") - @Query(type = QueryTypeEnum.INNER_LIKE) + @Query(type = QueryType.INNER_LIKE) private String title; /** diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/MessageQuery.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/MessageQuery.java index 02313673..d5299181 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/MessageQuery.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/MessageQuery.java @@ -23,7 +23,7 @@ import io.swagger.v3.oas.annotations.media.Schema; import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; -import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryTypeEnum; +import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryType; /** * 消息查询条件 @@ -48,7 +48,7 @@ public class MessageQuery implements Serializable { * 标题 */ @Schema(description = "标题", example = "欢迎注册 xxx") - @Query(type = QueryTypeEnum.INNER_LIKE) + @Query(type = QueryType.INNER_LIKE) private String title; /** diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/OptionQuery.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/OptionQuery.java index c13f0dba..aa4a70e8 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/OptionQuery.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/OptionQuery.java @@ -27,7 +27,7 @@ import io.swagger.v3.oas.annotations.media.Schema; import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; -import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryTypeEnum; +import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryType; /** * 参数查询条件 @@ -47,6 +47,6 @@ public class OptionQuery implements Serializable { */ @Schema(description = "参数键列表", example = "site_title,site_copyright") @NotEmpty(message = "参数键不能为空") - @Query(type = QueryTypeEnum.IN) + @Query(type = QueryType.IN) private List code; } \ No newline at end of file diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/UserQuery.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/UserQuery.java index ca71c1c8..25eed4ce 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/UserQuery.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/UserQuery.java @@ -30,7 +30,7 @@ import cn.hutool.core.date.DatePattern; import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; -import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryTypeEnum; +import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryType; /** * 用户查询条件 @@ -63,7 +63,7 @@ public class UserQuery implements Serializable { * 创建时间 */ @Schema(description = "创建时间", example = "2023-08-08 00:00:00,2023-08-08 23:59:59") - @Query(type = QueryTypeEnum.BETWEEN) + @Query(type = QueryType.BETWEEN) @DateTimeFormat(pattern = DatePattern.NORM_DATETIME_PATTERN) private List createTime; diff --git a/continew-admin-tool/src/main/resources/templates/generator/Query.ftl b/continew-admin-tool/src/main/resources/templates/generator/Query.ftl index 62fcc04b..eb6671cd 100644 --- a/continew-admin-tool/src/main/resources/templates/generator/Query.ftl +++ b/continew-admin-tool/src/main/resources/templates/generator/Query.ftl @@ -33,7 +33,7 @@ import lombok.Data; import io.swagger.v3.oas.annotations.media.Schema; import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; -import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryTypeEnum; +import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryType; /** * ${businessName}查询条件 @@ -55,7 +55,7 @@ public class ${className} implements Serializable { * ${fieldConfig.comment} */ @Schema(description = "${fieldConfig.comment}") - @Query(type = QueryTypeEnum.${fieldConfig.queryType}) + @Query(type = QueryType.${fieldConfig.queryType}) <#if fieldConfig.queryType = 'IN' || fieldConfig.queryType = 'NOT_IN' || fieldConfig.queryType = 'BETWEEN'> private List<${fieldConfig.fieldType}> ${fieldConfig.fieldName}; <#else> From 349899b4fc9572450ca31d9a5e19268ce0b868a8 Mon Sep 17 00:00:00 2001 From: Charles7c Date: Thu, 14 Dec 2023 20:36:50 +0800 Subject: [PATCH 08/49] =?UTF-8?q?style:=20=E4=BC=98=E5=8C=96=E7=94=B1?= =?UTF-8?q?=E4=BA=8E=20Mock=20=E5=BC=95=E8=B5=B7=E7=9A=84=E5=AF=BC?= =?UTF-8?q?=E5=87=BA=E6=8A=A5=E9=94=99=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- continew-admin-ui/src/components/crud/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/continew-admin-ui/src/components/crud/index.ts b/continew-admin-ui/src/components/crud/index.ts index f6cd2aef..f4c2988a 100644 --- a/continew-admin-ui/src/components/crud/index.ts +++ b/continew-admin-ui/src/components/crud/index.ts @@ -57,7 +57,7 @@ export default function download( Notification.warning({ title: '警告', content: - "如果您正在访问演示环境,点击导出会报错。这是由于演示环境开启了 Mock.js,而 Mock.js 会将 responseType 设置为 '',这不仅会导致关键判断出错,也会导致导出的文件无法打开。", + "由于部分模拟数据需要,前端默认启用了 Mock.js,而 Mock.js 会将 responseType 设置为 '',这不仅会导致关键判断出错,也会导致导出的文件无法打开,实际开发时自行关闭 Mock 即可。", duration: 10000, closable: true, }); From 9bf015059b96f41c29f05ecbf7612d611b3a98c3 Mon Sep 17 00:00:00 2001 From: Charles7c Date: Sun, 17 Dec 2023 14:07:44 +0800 Subject: [PATCH 09/49] =?UTF-8?q?refactor:=20:boom:=20=E9=80=82=E9=85=8D?= =?UTF-8?q?=20ContiNew=20Starter=20Log=EF=BC=88=E6=97=A5=E5=BF=97=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1.continew-starter 1.0.1-SNAPSHOT => 1.1.0-SNAPSHOT 2.日志表结构及相关管理 UI 变更 --- .../admin/common/constant/SysConstants.java | 4 +- .../handler/GlobalExceptionHandler.java | 12 - .../admin/common/model/dto/LoginUser.java | 13 +- .../admin/common/util/helper/LoginHelper.java | 11 +- .../common/util/holder/LogContextHolder.java | 87 ---- continew-admin-monitor/pom.xml | 6 + .../admin/monitor/annotation/Log.java | 57 --- ...nfiguration.java => LogConfiguration.java} | 29 +- .../admin/monitor/config/LogDaoLocalImpl.java | 121 ++++++ .../config/properties/LogProperties.java | 57 --- .../admin/monitor/filter/LogFilter.java | 81 ---- .../monitor/interceptor/LogInterceptor.java | 380 ------------------ .../admin/monitor/model/entity/LogDO.java | 28 +- .../monitor/model/resp/LoginLogResp.java | 10 +- .../monitor/model/resp/OperationLogResp.java | 20 +- .../model/resp/SystemLogDetailResp.java | 26 +- .../monitor/model/resp/SystemLogResp.java | 30 +- .../monitor/service/impl/LogServiceImpl.java | 17 - .../admin/auth/model/resp/OnlineUserResp.java | 10 +- continew-admin-ui/src/api/monitor/log.ts | 10 +- continew-admin-ui/src/api/monitor/online.ts | 5 +- .../src/views/monitor/log/login/index.vue | 5 +- .../src/views/monitor/log/operation/index.vue | 4 +- .../src/views/monitor/log/system/index.vue | 106 ++--- .../src/views/monitor/online/index.vue | 5 +- .../user/center/components/operation-log.vue | 4 +- .../admin/webapi/auth/AuthController.java | 7 +- .../webapi/auth/SocialAuthController.java | 2 +- .../admin/webapi/common/CommonController.java | 2 +- .../webapi/common/DashboardController.java | 2 +- .../admin/webapi/monitor/LogController.java | 2 +- .../webapi/system/MessageController.java | 2 +- .../src/main/resources/config/application.yml | 26 +- .../changelog/v1.0.0/continew-admin_table.sql | 12 +- pom.xml | 2 +- 35 files changed, 305 insertions(+), 890 deletions(-) delete mode 100644 continew-admin-common/src/main/java/top/charles7c/continew/admin/common/util/holder/LogContextHolder.java delete mode 100644 continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/annotation/Log.java rename continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/config/{WebMvcMonitorConfiguration.java => LogConfiguration.java} (56%) create mode 100644 continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/config/LogDaoLocalImpl.java delete mode 100644 continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/config/properties/LogProperties.java delete mode 100644 continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/filter/LogFilter.java delete mode 100644 continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/interceptor/LogInterceptor.java diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/constant/SysConstants.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/constant/SysConstants.java index 3ca7f6fe..347d5cb8 100644 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/constant/SysConstants.java +++ b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/constant/SysConstants.java @@ -56,9 +56,9 @@ public class SysConstants { public static final String DEFAULT_PASSWORD = "123456"; /** - * 登录 URI + * 账号登录 URI */ - public static final String LOGIN_URI = "/auth/login"; + public static final String LOGIN_URI = "/auth/account"; /** * 退出 URI diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/handler/GlobalExceptionHandler.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/handler/GlobalExceptionHandler.java index 1ba2b4ad..49c610d0 100644 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/handler/GlobalExceptionHandler.java +++ b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/handler/GlobalExceptionHandler.java @@ -41,7 +41,6 @@ import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.StrUtil; -import top.charles7c.continew.admin.common.util.holder.LogContextHolder; import top.charles7c.continew.starter.core.constant.StringConstants; import top.charles7c.continew.starter.core.exception.BadRequestException; import top.charles7c.continew.starter.core.exception.BusinessException; @@ -65,7 +64,6 @@ public class GlobalExceptionHandler { @ExceptionHandler(BadRequestException.class) public R handleBadRequestException(BadRequestException e, HttpServletRequest request) { log.warn("请求地址 [{}],自定义验证失败。", request.getRequestURI(), e); - LogContextHolder.setErrorMsg(e.getMessage()); return R.fail(HttpStatus.BAD_REQUEST.value(), e.getMessage()); } @@ -77,7 +75,6 @@ public R constraintViolationException(ConstraintViolationException e, HttpServle log.warn("请求地址 [{}],参数验证失败。", request.getRequestURI(), e); String errorMsg = CollUtil.join(e.getConstraintViolations(), StringConstants.CHINESE_COMMA, ConstraintViolation::getMessage); - LogContextHolder.setErrorMsg(errorMsg); return R.fail(HttpStatus.BAD_REQUEST.value(), errorMsg); } @@ -89,7 +86,6 @@ public R handleBindException(BindException e, HttpServletRequest request) { log.warn("请求地址 [{}],参数验证失败。", request.getRequestURI(), e); String errorMsg = CollUtil.join(e.getAllErrors(), StringConstants.CHINESE_COMMA, DefaultMessageSourceResolvable::getDefaultMessage); - LogContextHolder.setErrorMsg(errorMsg); return R.fail(HttpStatus.BAD_REQUEST.value(), errorMsg); } @@ -101,7 +97,6 @@ public R handleMethodArgumentNotValidException(MethodArgumentNotValidException e log.warn("请求地址 [{}],参数验证失败。", request.getRequestURI(), e); String errorMsg = ExceptionUtils .exToNull(() -> Objects.requireNonNull(e.getBindingResult().getFieldError()).getDefaultMessage()); - LogContextHolder.setErrorMsg(errorMsg); return R.fail(HttpStatus.BAD_REQUEST.value(), errorMsg); } @@ -113,7 +108,6 @@ public R handleMethodArgumentTypeMismatchException(MethodArgumentTypeMismatchExc HttpServletRequest request) { String errorMsg = StrUtil.format("参数名:[{}],期望参数类型:[{}]", e.getName(), e.getParameter().getParameterType()); log.warn("请求地址 [{}],参数转换失败,{}。", request.getRequestURI(), errorMsg, e); - LogContextHolder.setErrorMsg(errorMsg); return R.fail(HttpStatus.BAD_REQUEST.value(), errorMsg); } @@ -125,7 +119,6 @@ public R handleMaxUploadSizeExceededException(MaxUploadSizeExceededException e, log.warn("请求地址 [{}],上传文件失败,文件大小超过限制。", request.getRequestURI(), e); String sizeLimit = StrUtil.subBetween(e.getMessage(), "The maximum size ", " for"); String errorMsg = String.format("请上传小于 %sMB 的文件", NumberUtil.parseLong(sizeLimit) / 1024 / 1024); - LogContextHolder.setErrorMsg(errorMsg); return R.fail(HttpStatus.BAD_REQUEST.value(), errorMsg); } @@ -140,7 +133,6 @@ public R handleNotLoginException(NotLoginException e, HttpServletRequest request case NotLoginException.BE_REPLACED_MESSAGE -> "您已被顶下线。"; default -> "您的登录状态已过期,请重新登录。"; }; - LogContextHolder.setErrorMsg(errorMsg); return R.fail(HttpStatus.UNAUTHORIZED.value(), errorMsg); } @@ -167,7 +159,6 @@ public R handleNotRoleException(NotRoleException e, HttpServletRequest request) */ @ExceptionHandler(HttpRequestMethodNotSupportedException.class) public R handleHttpRequestMethodNotSupported(HttpRequestMethodNotSupportedException e, HttpServletRequest request) { - LogContextHolder.setErrorMsg(e.getMessage()); log.error("请求地址 [{}],不支持 [{}] 请求。", request.getRequestURI(), e.getMethod()); return R.fail(HttpStatus.METHOD_NOT_ALLOWED.value(), e.getMessage()); } @@ -178,7 +169,6 @@ public R handleHttpRequestMethodNotSupported(HttpRequestMethodNotSupportedExcept @ExceptionHandler(BusinessException.class) public R handleServiceException(BusinessException e, HttpServletRequest request) { log.error("请求地址 [{}],发生业务异常。", request.getRequestURI(), e); - LogContextHolder.setErrorMsg(e.getMessage()); return R.fail(HttpStatus.INTERNAL_SERVER_ERROR.value(), e.getMessage()); } @@ -188,7 +178,6 @@ public R handleServiceException(BusinessException e, HttpServletRequest request) @ExceptionHandler(RuntimeException.class) public R handleRuntimeException(RuntimeException e, HttpServletRequest request) { log.error("请求地址 [{}],发生系统异常。", request.getRequestURI(), e); - LogContextHolder.setException(e); return R.fail(e.getMessage()); } @@ -198,7 +187,6 @@ public R handleRuntimeException(RuntimeException e, HttpServletRequest request) @ExceptionHandler(Throwable.class) public R handleException(Throwable e, HttpServletRequest request) { log.error("请求地址 [{}],发生未知异常。", request.getRequestURI(), e); - LogContextHolder.setException(e); return R.fail(e.getMessage()); } } \ No newline at end of file diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/model/dto/LoginUser.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/model/dto/LoginUser.java index 47a407aa..c7b8da57 100644 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/model/dto/LoginUser.java +++ b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/model/dto/LoginUser.java @@ -75,20 +75,25 @@ public class LoginUser implements Serializable { private String token; /** - * 登录 IP + * IP */ - private String clientIp; + private String ip; /** - * 登录地点 + * IP 归属地 */ - private String location; + private String address; /** * 浏览器 */ private String browser; + /** + * 操作系统 + */ + private String os; + /** * 登录时间 */ diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/util/helper/LoginHelper.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/util/helper/LoginHelper.java index 73662554..91d2a7ae 100644 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/util/helper/LoginHelper.java +++ b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/util/helper/LoginHelper.java @@ -26,13 +26,12 @@ import cn.dev33.satoken.context.SaHolder; import cn.dev33.satoken.session.SaSession; import cn.dev33.satoken.stp.StpUtil; +import cn.hutool.core.util.StrUtil; import cn.hutool.extra.servlet.JakartaServletUtil; import cn.hutool.extra.spring.SpringUtil; import top.charles7c.continew.admin.common.constant.CacheConstants; -import top.charles7c.continew.admin.common.model.dto.LogContext; import top.charles7c.continew.admin.common.model.dto.LoginUser; -import top.charles7c.continew.admin.common.util.holder.LogContextHolder; import top.charles7c.continew.starter.core.util.ExceptionUtils; import top.charles7c.continew.starter.core.util.IpUtils; import top.charles7c.continew.starter.core.util.ServletUtils; @@ -58,11 +57,11 @@ public class LoginHelper { public static String login(LoginUser loginUser) { // 记录登录信息 HttpServletRequest request = ServletUtils.getRequest(); - loginUser.setClientIp(JakartaServletUtil.getClientIP(request)); - loginUser.setLocation(IpUtils.getCityInfo(loginUser.getClientIp())); + loginUser.setIp(JakartaServletUtil.getClientIP(request)); + loginUser.setAddress(IpUtils.getAddress(loginUser.getIp())); loginUser.setBrowser(ServletUtils.getBrowser(request)); - LogContext logContext = LogContextHolder.get(); - loginUser.setLoginTime(null != logContext ? logContext.getCreateTime() : LocalDateTime.now()); + loginUser.setLoginTime(LocalDateTime.now()); + loginUser.setOs(StrUtil.subBefore(ServletUtils.getOs(request), " or", false)); // 登录并缓存用户信息 StpUtil.login(loginUser.getId()); SaHolder.getStorage().set(CacheConstants.LOGIN_USER_KEY, loginUser); diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/util/holder/LogContextHolder.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/util/holder/LogContextHolder.java deleted file mode 100644 index fd8a0453..00000000 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/util/holder/LogContextHolder.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package top.charles7c.continew.admin.common.util.holder; - -import lombok.AccessLevel; -import lombok.NoArgsConstructor; - -import top.charles7c.continew.admin.common.model.dto.LogContext; - -/** - * 系统日志上下文持有者 - * - * @author Charles7c - * @since 2022/12/25 8:55 - */ -@NoArgsConstructor(access = AccessLevel.PRIVATE) -public class LogContextHolder { - - private static final ThreadLocal LOG_THREAD_LOCAL = new ThreadLocal<>(); - - /** - * 存储系统日志上下文 - * - * @param logContext - * 系统日志上下文信息 - */ - public static void set(LogContext logContext) { - LOG_THREAD_LOCAL.set(logContext); - } - - /** - * 获取系统日志上下文 - * - * @return 系统日志上下文信息 - */ - public static LogContext get() { - return LOG_THREAD_LOCAL.get(); - } - - /** - * 移除系统日志上下文 - */ - public static void remove() { - LOG_THREAD_LOCAL.remove(); - } - - /** - * 在系统日志上下文中保存异常信息 - * - * @param e - * 异常信息 - */ - public static void setException(Throwable e) { - LogContext logContext = get(); - if (null != logContext) { - logContext.setErrorMsg(e.getMessage()); - logContext.setException(e); - } - } - - /** - * 在系统日志上下文中保存错误信息(非未知异常不记录异常信息,只记录错误信息) - * - * @param errorMsg - * 错误信息 - */ - public static void setErrorMsg(String errorMsg) { - LogContext logContext = get(); - if (null != logContext) { - logContext.setErrorMsg(errorMsg); - } - } -} diff --git a/continew-admin-monitor/pom.xml b/continew-admin-monitor/pom.xml index 29756b08..bdc88865 100644 --- a/continew-admin-monitor/pom.xml +++ b/continew-admin-monitor/pom.xml @@ -16,6 +16,12 @@ 系统监控模块(存放系统监控模块相关功能,例如:日志管理、服务监控等) + + + top.charles7c.continew + continew-starter-log-httptrace-pro + + top.charles7c.continew diff --git a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/annotation/Log.java b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/annotation/Log.java deleted file mode 100644 index be9f3d66..00000000 --- a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/annotation/Log.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package top.charles7c.continew.admin.monitor.annotation; - -import java.lang.annotation.*; - -/** - * 系统日志注解(用于接口方法或类上,辅助 Spring Doc OpenAPI3 使用效果最佳) - * - * @author Charles7c - * @since 2022/12/23 20:00 - */ -@Documented -@Target({ElementType.METHOD, ElementType.TYPE}) -@Retention(RetentionPolicy.RUNTIME) -public @interface Log { - - /** - * 日志描述(仅用于接口方法上) - *

- * 读取顺序:(越靠后优先级越高)
- * 1、读取对应接口方法上的 @Operation(summary="描述") 内容
- * 2、读取对应接口方法上的 @Log("描述") 内容
- *

- */ - String value() default ""; - - /** - * 所属模块(用于接口方法或类上) - *

- * 读取顺序:(越靠后优先级越高)
- * 1、读取对应接口类上的 @Tag(name = "模块") 内容
- * 2、读取对应接口类上的 @Log(module = "模块") 内容
- * 3、读取对应接口方法上的 @Log(module = "模块") 内容 - *

- */ - String module() default ""; - - /** - * 是否忽略日志记录(用于接口方法或类上) - */ - boolean ignore() default false; -} diff --git a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/config/WebMvcMonitorConfiguration.java b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/config/LogConfiguration.java similarity index 56% rename from continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/config/WebMvcMonitorConfiguration.java rename to continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/config/LogConfiguration.java index 0343cb80..24de8a3d 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/config/WebMvcMonitorConfiguration.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/config/LogConfiguration.java @@ -16,30 +16,29 @@ package top.charles7c.continew.admin.monitor.config; -import lombok.RequiredArgsConstructor; - +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.web.servlet.config.annotation.EnableWebMvc; -import org.springframework.web.servlet.config.annotation.InterceptorRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; -import top.charles7c.continew.admin.monitor.interceptor.LogInterceptor; +import top.charles7c.continew.admin.monitor.mapper.LogMapper; +import top.charles7c.continew.admin.system.service.UserService; +import top.charles7c.continew.starter.log.common.dao.LogDao; +import top.charles7c.continew.starter.log.httptracepro.autoconfigure.ConditionalOnEnabledLog; /** - * 监控模块 Web MVC 配置 + * 日志配置 * * @author Charles7c * @since 2022/12/24 23:15 */ -@EnableWebMvc @Configuration -@RequiredArgsConstructor -public class WebMvcMonitorConfiguration implements WebMvcConfigurer { - - private final LogInterceptor logInterceptor; +@ConditionalOnEnabledLog +public class LogConfiguration { - @Override - public void addInterceptors(InterceptorRegistry registry) { - registry.addInterceptor(logInterceptor); + /** + * 日志持久层接口本地实现类 + */ + @Bean + public LogDao logDao(UserService userService, LogMapper logMapper) { + return new LogDaoLocalImpl(userService, logMapper); } } diff --git a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/config/LogDaoLocalImpl.java b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/config/LogDaoLocalImpl.java new file mode 100644 index 00000000..915cf905 --- /dev/null +++ b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/config/LogDaoLocalImpl.java @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package top.charles7c.continew.admin.monitor.config; + +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.List; +import java.util.Map; + +import lombok.RequiredArgsConstructor; + +import org.springframework.http.HttpHeaders; +import org.springframework.scheduling.annotation.Async; + +import cn.dev33.satoken.SaManager; +import cn.dev33.satoken.stp.StpUtil; +import cn.hutool.core.convert.Convert; +import cn.hutool.core.map.MapUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpStatus; +import cn.hutool.json.JSONUtil; + +import top.charles7c.continew.admin.auth.model.req.AccountLoginReq; +import top.charles7c.continew.admin.common.constant.SysConstants; +import top.charles7c.continew.admin.monitor.enums.LogStatusEnum; +import top.charles7c.continew.admin.monitor.mapper.LogMapper; +import top.charles7c.continew.admin.monitor.model.entity.LogDO; +import top.charles7c.continew.admin.system.service.UserService; +import top.charles7c.continew.starter.core.constant.StringConstants; +import top.charles7c.continew.starter.core.util.ExceptionUtils; +import top.charles7c.continew.starter.extension.crud.model.resp.R; +import top.charles7c.continew.starter.log.common.dao.LogDao; +import top.charles7c.continew.starter.log.common.model.LogRecord; +import top.charles7c.continew.starter.log.common.model.LogRequest; +import top.charles7c.continew.starter.log.common.model.LogResponse; + +/** + * 日志持久层接口本地实现类 + * + * @author Charles7c + * @since 2023/12/16 23:55 + */ +@RequiredArgsConstructor +public class LogDaoLocalImpl implements LogDao { + + private final UserService userService; + private final LogMapper logMapper; + + @Async + @Override + public void add(LogRecord logRecord) { + LogDO logDO = new LogDO(); + logDO.setDescription(logRecord.getDescription()); + String module = logRecord.getModule(); + logDO.setModule( + StrUtil.isNotBlank(module) ? logRecord.getModule().replace("API", StringConstants.EMPTY).trim() : null); + logDO.setCreateTime(LocalDateTime.ofInstant(logRecord.getTimestamp(), ZoneId.systemDefault())); + logDO.setTimeTaken(logRecord.getTimeTaken().toMillis()); + // 请求信息 + LogRequest logRequest = logRecord.getRequest(); + logDO.setRequestMethod(logRequest.getMethod()); + String requestUrl = logRequest.getUri().toString(); + logDO.setRequestUrl(requestUrl); + Map> requestHeaders = logRequest.getHeaders(); + logDO.setRequestHeaders(JSONUtil.toJsonStr(requestHeaders)); + String requestBody = logRequest.getBody(); + logDO.setRequestBody(requestBody); + logDO.setIp(logRequest.getIp()); + logDO.setAddress(logRequest.getAddress()); + logDO.setBrowser(logRequest.getBrowser()); + logDO.setOs(StrUtil.subBefore(logRequest.getOs(), " or", false)); + // 响应信息 + LogResponse logResponse = logRecord.getResponse(); + Integer statusCode = logResponse.getStatus(); + logDO.setStatusCode(statusCode); + logDO.setResponseHeaders(JSONUtil.toJsonStr(logResponse.getHeaders())); + String responseBody = logResponse.getBody(); + logDO.setResponseBody(responseBody); + // 状态 + logDO.setStatus(statusCode >= HttpStatus.HTTP_BAD_REQUEST ? LogStatusEnum.FAILURE : LogStatusEnum.SUCCESS); + if (StrUtil.isNotBlank(responseBody) && JSONUtil.isTypeJSON(responseBody)) { + R result = JSONUtil.toBean(responseBody, R.class); + if (!result.isSuccess()) { + logDO.setStatus(LogStatusEnum.FAILURE); + logDO.setErrorMsg(result.getMsg()); + } + // 操作人 + if (StrUtil.contains(requestUrl, SysConstants.LOGOUT_URI)) { + Long loginId = Convert.toLong(result.getData(), -1L); + logDO.setCreateUser(-1 != loginId ? loginId : null); + } + } + // 操作人 + if (StrUtil.contains(requestUrl, SysConstants.LOGIN_URI)) { + AccountLoginReq loginReq = JSONUtil.toBean(requestBody, AccountLoginReq.class); + logDO.setCreateUser( + ExceptionUtils.exToNull(() -> userService.getByUsername(loginReq.getUsername()).getId())); + } else if (!StrUtil.contains(requestUrl, SysConstants.LOGOUT_URI) && MapUtil.isNotEmpty(requestHeaders) + && requestHeaders.containsKey(HttpHeaders.AUTHORIZATION)) { + String authorization = requestHeaders.get(HttpHeaders.AUTHORIZATION).get(0); + String token = authorization.replace(SaManager.getConfig().getTokenPrefix() + StringConstants.SPACE, + StringConstants.EMPTY); + logDO.setCreateUser(Convert.toLong(StpUtil.getLoginIdByToken(token))); + } + logMapper.insert(logDO); + } +} diff --git a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/config/properties/LogProperties.java b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/config/properties/LogProperties.java deleted file mode 100644 index 007b2101..00000000 --- a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/config/properties/LogProperties.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package top.charles7c.continew.admin.monitor.config.properties; - -import java.util.ArrayList; -import java.util.List; - -import lombok.Data; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.stereotype.Component; - -/** - * 系统日志配置属性 - * - * @author Charles7c - * @since 2022/12/24 23:04 - */ -@Data -@Component -@ConfigurationProperties(prefix = "logging.system") -public class LogProperties { - - /** - * 是否启用系统日志 - */ - private Boolean enabled; - - /** - * 是否记录内网 IP 操作 - */ - private Boolean includeInnerIp; - - /** - * 排除请求方式(哪些请求方式不记录系统日志) - */ - private List excludeMethods = new ArrayList<>(); - - /** - * 脱敏字段 - */ - private List desensitizeFields = new ArrayList<>(); -} diff --git a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/filter/LogFilter.java b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/filter/LogFilter.java deleted file mode 100644 index 5746bce8..00000000 --- a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/filter/LogFilter.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package top.charles7c.continew.admin.monitor.filter; - -import java.io.IOException; -import java.util.Objects; - -import jakarta.servlet.FilterChain; -import jakarta.servlet.ServletException; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; - -import org.springframework.core.Ordered; -import org.springframework.lang.NonNull; -import org.springframework.stereotype.Component; -import org.springframework.web.filter.OncePerRequestFilter; -import org.springframework.web.util.ContentCachingRequestWrapper; -import org.springframework.web.util.ContentCachingResponseWrapper; -import org.springframework.web.util.WebUtils; - -/** - * 系统日志过滤器(缓存请求和响应体过滤器) - * - *

- * 由于 requestBody 和 responseBody 分别对应的是 InputStream 和 OutputStream,由于流的特性,读取完之后就无法再被使用了。 所以,需要额外缓存一次流信息。 - *

- * - * @author Charles7c - * @since 2022/12/24 21:16 - */ -@Component -public class LogFilter extends OncePerRequestFilter implements Ordered { - - @Override - public int getOrder() { - return Ordered.LOWEST_PRECEDENCE - 10; - } - - @Override - protected void doFilterInternal(@NonNull HttpServletRequest request, @NonNull HttpServletResponse response, - @NonNull FilterChain filterChain) throws ServletException, IOException { - // 包装流,可重复读取 - if (!(request instanceof ContentCachingRequestWrapper)) { - request = new ContentCachingRequestWrapper(request); - } - if (!(response instanceof ContentCachingResponseWrapper)) { - response = new ContentCachingResponseWrapper(response); - } - - filterChain.doFilter(request, response); - updateResponse(response); - } - - /** - * 更新响应(不操作这一步,会导致接口响应空白) - * - * @param response - * 响应对象 - * @throws IOException - * / - */ - private void updateResponse(HttpServletResponse response) throws IOException { - ContentCachingResponseWrapper responseWrapper = - WebUtils.getNativeResponse(response, ContentCachingResponseWrapper.class); - Objects.requireNonNull(responseWrapper).copyBodyToResponse(); - } -} diff --git a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/interceptor/LogInterceptor.java b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/interceptor/LogInterceptor.java deleted file mode 100644 index 6f2ca45f..00000000 --- a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/interceptor/LogInterceptor.java +++ /dev/null @@ -1,380 +0,0 @@ -/* - * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package top.charles7c.continew.admin.monitor.interceptor; - -import java.time.LocalDateTime; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; - -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; - -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; - -import org.springframework.lang.NonNull; -import org.springframework.stereotype.Component; -import org.springframework.web.method.HandlerMethod; -import org.springframework.web.servlet.HandlerInterceptor; -import org.springframework.web.util.ContentCachingRequestWrapper; -import org.springframework.web.util.ContentCachingResponseWrapper; -import org.springframework.web.util.WebUtils; - -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.date.LocalDateTimeUtil; -import cn.hutool.core.exceptions.ExceptionUtil; -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.StrUtil; -import cn.hutool.extra.servlet.JakartaServletUtil; -import cn.hutool.extra.spring.SpringUtil; -import cn.hutool.http.HttpStatus; -import cn.hutool.json.JSONArray; -import cn.hutool.json.JSONObject; -import cn.hutool.json.JSONUtil; - -import top.charles7c.continew.admin.auth.model.req.AccountLoginReq; -import top.charles7c.continew.admin.common.constant.SysConstants; -import top.charles7c.continew.admin.common.model.dto.LogContext; -import top.charles7c.continew.admin.common.util.helper.LoginHelper; -import top.charles7c.continew.admin.common.util.holder.LogContextHolder; -import top.charles7c.continew.admin.monitor.annotation.Log; -import top.charles7c.continew.admin.monitor.config.properties.LogProperties; -import top.charles7c.continew.admin.monitor.enums.LogStatusEnum; -import top.charles7c.continew.admin.monitor.model.entity.LogDO; -import top.charles7c.continew.admin.system.service.UserService; -import top.charles7c.continew.starter.core.constant.StringConstants; -import top.charles7c.continew.starter.core.util.ExceptionUtils; -import top.charles7c.continew.starter.core.util.IpUtils; -import top.charles7c.continew.starter.core.util.ServletUtils; -import top.charles7c.continew.starter.extension.crud.model.resp.R; - -/** - * 系统日志拦截器 - * - * @author Charles7c - * @since 2022/12/24 21:14 - */ -@Slf4j -@Component -@RequiredArgsConstructor -public class LogInterceptor implements HandlerInterceptor { - - private final UserService userService; - private final LogProperties operationLogProperties; - private static final String ENCRYPT_SYMBOL = "****************"; - - @Override - public boolean preHandle(@NonNull HttpServletRequest request, @NonNull HttpServletResponse response, - @NonNull Object handler) { - if (this.isNeedRecord(handler, request)) { - // 记录时间 - this.logCreateTime(); - } - return true; - } - - @Override - public void afterCompletion(@NonNull HttpServletRequest request, @NonNull HttpServletResponse response, - @NonNull Object handler, Exception e) { - // 记录请求耗时及异常信息 - LogDO logDO = this.logElapsedTimeAndException(); - if (null == logDO) { - return; - } - HandlerMethod handlerMethod = (HandlerMethod)handler; - // 记录所属模块 - this.logModule(logDO, handlerMethod); - // 记录日志描述 - this.logDescription(logDO, handlerMethod); - // 记录请求信息 - this.logRequest(logDO, request); - // 记录响应信息 - this.logResponse(logDO, response); - // 保存系统日志 - SpringUtil.getApplicationContext().publishEvent(logDO); - } - - /** - * 记录时间 - */ - private void logCreateTime() { - LogContext logContext = new LogContext(); - logContext.setCreateUser(LoginHelper.getUserId()); - logContext.setCreateTime(LocalDateTime.now()); - LogContextHolder.set(logContext); - } - - /** - * 记录请求耗时及异常详情 - * - * @return 系统日志信息 - */ - private LogDO logElapsedTimeAndException() { - LogContext logContext = LogContextHolder.get(); - if (null == logContext) { - return null; - } - try { - LogDO logDO = new LogDO(); - logDO.setCreateTime(logContext.getCreateTime()); - logDO.setElapsedTime(System.currentTimeMillis() - LocalDateTimeUtil.toEpochMilli(logDO.getCreateTime())); - logDO.setStatus(LogStatusEnum.SUCCESS); - // 记录错误信息(非未知异常不记录异常详情,只记录错误信息) - String errorMsg = logContext.getErrorMsg(); - if (StrUtil.isNotBlank(errorMsg)) { - logDO.setStatus(LogStatusEnum.FAILURE); - logDO.setErrorMsg(errorMsg); - } - // 记录异常详情 - Throwable exception = logContext.getException(); - if (null != exception) { - logDO.setStatus(LogStatusEnum.FAILURE); - logDO.setExceptionDetail(ExceptionUtil.stacktraceToString(exception, -1)); - } - return logDO; - } finally { - LogContextHolder.remove(); - } - } - - /** - * 记录所属模块 - * - * @param logDO - * 系统日志信息 - * @param handlerMethod - * 处理器方法 - */ - private void logModule(LogDO logDO, HandlerMethod handlerMethod) { - Tag classTag = handlerMethod.getBeanType().getDeclaredAnnotation(Tag.class); - Log classLog = handlerMethod.getBeanType().getDeclaredAnnotation(Log.class); - Log methodLog = handlerMethod.getMethodAnnotation(Log.class); - // 例如:@Tag(name = "部门管理") -> 部门管理 - // (本框架代码规范)例如:@Tag(name = "部门管理 API") -> 部门管理 - if (null != classTag) { - String name = classTag.name(); - logDO.setModule( - StrUtil.isNotBlank(name) ? name.replace("API", StringConstants.EMPTY).trim() : "请在该接口类上指定所属模块"); - } - // 例如:@Log(module = "部门管理") -> 部门管理 - if (null != classLog && StrUtil.isNotBlank(classLog.module())) { - logDO.setModule(classLog.module()); - } - if (null != methodLog && StrUtil.isNotBlank(methodLog.module())) { - logDO.setModule(methodLog.module()); - } - } - - /** - * 记录日志描述 - * - * @param logDO - * 系统日志信息 - * @param handlerMethod - * 处理器方法 - */ - private void logDescription(LogDO logDO, HandlerMethod handlerMethod) { - Operation methodOperation = handlerMethod.getMethodAnnotation(Operation.class); - Log methodLog = handlerMethod.getMethodAnnotation(Log.class); - // 例如:@Operation(summary="新增部门") -> 新增部门 - if (null != methodOperation) { - logDO.setDescription(StrUtil.blankToDefault(methodOperation.summary(), "请在该接口方法上指定日志描述")); - } - // 例如:@Log("新增部门") -> 新增部门 - if (null != methodLog && StrUtil.isNotBlank(methodLog.value())) { - logDO.setDescription(methodLog.value()); - } - } - - /** - * 记录请求信息 - * - * @param logDO - * 系统日志信息 - * @param request - * 请求对象 - */ - private void logRequest(LogDO logDO, HttpServletRequest request) { - logDO.setRequestUrl(StrUtil.isBlank(request.getQueryString()) ? request.getRequestURL().toString() : request - .getRequestURL().append(StringConstants.QUESTION_MARK).append(request.getQueryString()).toString()); - String method = request.getMethod(); - logDO.setRequestMethod(method); - logDO.setRequestHeaders(this.desensitize(JakartaServletUtil.getHeaderMap(request))); - String requestBody = this.getRequestBody(request); - logDO.setCreateUser(ObjectUtil.defaultIfNull(logDO.getCreateUser(), LoginHelper.getUserId())); - String requestURI = request.getRequestURI(); - if (requestURI.startsWith("/oauth")) { - logDO.setCreateUser(null); - } - if (null == logDO.getCreateUser() && SysConstants.LOGIN_URI.equals(requestURI)) { - AccountLoginReq loginReq = JSONUtil.toBean(requestBody, AccountLoginReq.class); - logDO.setCreateUser( - ExceptionUtils.exToNull(() -> userService.getByUsername(loginReq.getUsername()).getId())); - } - if (StrUtil.isNotBlank(requestBody)) { - if (JSONUtil.isTypeJSONObject(requestBody)) { - requestBody = this.desensitize(JSONUtil.parseObj(requestBody)); - } else if (JSONUtil.isTypeJSONArray(requestBody)) { - JSONArray requestBodyJsonArr = JSONUtil.parseArray(requestBody); - List requestBodyJsonObjList = new ArrayList<>(requestBodyJsonArr.size()); - for (Object requestBodyJsonObj : requestBodyJsonArr) { - requestBodyJsonObjList - .add(JSONUtil.parseObj(this.desensitize(JSONUtil.parseObj(requestBodyJsonObj)))); - } - requestBody = JSONUtil.toJsonStr(requestBodyJsonObjList); - } else { - requestBody = this.desensitize(JakartaServletUtil.getParamMap(request)); - } - logDO.setRequestBody(requestBody); - } - logDO.setClientIp(JakartaServletUtil.getClientIP(request)); - logDO.setLocation(IpUtils.getCityInfo(logDO.getClientIp())); - logDO.setBrowser(ServletUtils.getBrowser(request)); - } - - /** - * 记录响应信息 - * - * @param logDO - * 系统日志信息 - * @param response - * 响应对象 - */ - private void logResponse(LogDO logDO, HttpServletResponse response) { - int status = response.getStatus(); - logDO.setStatusCode(status); - logDO.setStatus(status >= HttpStatus.HTTP_BAD_REQUEST ? LogStatusEnum.FAILURE : logDO.getStatus()); - logDO.setResponseHeaders(this.desensitize(JakartaServletUtil.getHeadersMap(response))); - // 响应体(不记录非 JSON 响应数据) - String responseBody = this.getResponseBody(response); - if (StrUtil.isNotBlank(responseBody) && JSONUtil.isTypeJSON(responseBody)) { - logDO.setResponseBody(responseBody); - // 业务状态码优先级高 - try { - R result = JSONUtil.toBean(responseBody, R.class); - logDO.setStatusCode(result.getCode()); - logDO.setStatus(result.isSuccess() ? LogStatusEnum.SUCCESS : LogStatusEnum.FAILURE); - } catch (Exception ignored) { - } - } - } - - /** - * 数据脱敏 - * - * @param waitDesensitizeData - * 待脱敏数据 - * @return 脱敏后的 JSON 字符串数据 - */ - @SuppressWarnings("unchecked") - private String desensitize(Map waitDesensitizeData) { - String desensitizeDataStr = JSONUtil.toJsonStr(waitDesensitizeData); - try { - if (CollUtil.isEmpty(waitDesensitizeData)) { - return desensitizeDataStr; - } - for (String desensitizeProperty : operationLogProperties.getDesensitizeFields()) { - waitDesensitizeData.computeIfPresent(desensitizeProperty, (k, v) -> ENCRYPT_SYMBOL); - waitDesensitizeData.computeIfPresent(desensitizeProperty.toLowerCase(), (k, v) -> ENCRYPT_SYMBOL); - waitDesensitizeData.computeIfPresent(desensitizeProperty.toUpperCase(), (k, v) -> ENCRYPT_SYMBOL); - } - return JSONUtil.toJsonStr(waitDesensitizeData); - } catch (Exception ignored) { - } - return desensitizeDataStr; - } - - /** - * 获取请求体 - * - * @param request - * 请求对象 - * @return 请求体 - */ - private String getRequestBody(HttpServletRequest request) { - String requestBody = ""; - ContentCachingRequestWrapper wrapper = WebUtils.getNativeRequest(request, ContentCachingRequestWrapper.class); - if (null != wrapper) { - requestBody = StrUtil.utf8Str(wrapper.getContentAsByteArray()); - } - return requestBody; - } - - /** - * 获取响应体 - * - * @param response - * 响应对象 - * @return 响应体 - */ - private String getResponseBody(HttpServletResponse response) { - String responseBody = ""; - ContentCachingResponseWrapper wrapper = - WebUtils.getNativeResponse(response, ContentCachingResponseWrapper.class); - if (null != wrapper) { - responseBody = StrUtil.utf8Str(wrapper.getContentAsByteArray()); - } - return responseBody; - } - - /** - * 是否要记录系统日志 - * - * @param handler - * 处理器 - * @param request - * 请求对象 - * @return true 需要记录;false 不需要记录 - */ - private boolean isNeedRecord(Object handler, HttpServletRequest request) { - // 1、未启用时,不需要记录系统日志 - if (!(handler instanceof HandlerMethod) || Boolean.FALSE.equals(operationLogProperties.getEnabled())) { - return false; - } - // 2、检查是否需要记录内网 IP 操作 - boolean isInnerIp = IpUtils.isInnerIp(JakartaServletUtil.getClientIP(request)); - if (isInnerIp && Boolean.FALSE.equals(operationLogProperties.getIncludeInnerIp())) { - return false; - } - // 3、排除不需要记录系统日志的接口 - HandlerMethod handlerMethod = (HandlerMethod)handler; - Log methodLog = handlerMethod.getMethodAnnotation(Log.class); - // 3.1 如果接口方法上既没有 @Log 注解,也没有 @Operation 注解,则不记录系统日志 - Operation methodOperation = handlerMethod.getMethodAnnotation(Operation.class); - if (null == methodLog && null == methodOperation) { - return false; - } - // 3.2 请求方式不要求记录且接口方法上没有 @Log 注解,则不记录系统日志 - if (null == methodLog && operationLogProperties.getExcludeMethods().contains(request.getMethod())) { - return false; - } - // 3.3 如果接口被隐藏,不记录系统日志 - if (null != methodOperation && methodOperation.hidden()) { - return false; - } - // 3.4 如果接口方法或类上有 @Log 注解,但是要求忽略该接口,则不记录系统日志 - if (null != methodLog && methodLog.ignore()) { - return false; - } - Log classLog = handlerMethod.getBeanType().getDeclaredAnnotation(Log.class); - return null == classLog || !classLog.ignore(); - } -} diff --git a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/entity/LogDO.java b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/entity/LogDO.java index 7c5bbd11..31ef685d 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/entity/LogDO.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/entity/LogDO.java @@ -92,39 +92,39 @@ public class LogDO implements Serializable { private String responseBody; /** - * 请求耗时(ms) + * 耗时(ms) */ - private Long elapsedTime; + private Long timeTaken; /** - * 操作状态 + * IP */ - private LogStatusEnum status; + private String ip; /** - * 客户端IP + * IP 归属地 */ - private String clientIp; + private String address; /** - * IP归属地 + * 浏览器 */ - private String location; + private String browser; /** - * 浏览器 + * 操作系统 */ - private String browser; + private String os; /** - * 错误信息 + * 状态 */ - private String errorMsg; + private LogStatusEnum status; /** - * 异常详情 + * 错误信息 */ - private String exceptionDetail; + private String errorMsg; /** * 创建人 diff --git a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/resp/LoginLogResp.java b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/resp/LoginLogResp.java index 95ee0b9a..919b53e7 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/resp/LoginLogResp.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/resp/LoginLogResp.java @@ -53,13 +53,13 @@ public class LoginLogResp extends LogResp { * 登录 IP */ @Schema(description = "登录 IP", example = "192.168.0.1") - private String clientIp; + private String ip; /** * 登录地点 */ @Schema(description = "登录地点", example = "中国北京北京市") - private String location; + private String address; /** * 浏览器 @@ -67,6 +67,12 @@ public class LoginLogResp extends LogResp { @Schema(description = "浏览器", example = "Chrome 115.0.0.0") private String browser; + /** + * 操作系统 + */ + @Schema(description = "操作系统", example = "Windows 10") + private String os; + /** * 错误信息 */ diff --git a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/resp/OperationLogResp.java b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/resp/OperationLogResp.java index 42a9a13b..a470a1ca 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/resp/OperationLogResp.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/resp/OperationLogResp.java @@ -50,22 +50,16 @@ public class OperationLogResp extends LogResp { private String module; /** - * 操作状态 - */ - @Schema(description = "操作状态(1:成功;2:失败)", type = "Integer", allowableValues = {"1", "2"}, example = "1") - private LogStatusEnum status; - - /** - * 操作IP + * 操作 IP */ - @Schema(description = "操作IP", example = "192.168.0.1") - private String clientIp; + @Schema(description = "操作 IP", example = "192.168.0.1") + private String ip; /** * 操作地点 */ @Schema(description = "操作地点", example = "中国北京北京市") - private String location; + private String address; /** * 浏览器 @@ -73,6 +67,12 @@ public class OperationLogResp extends LogResp { @Schema(description = "浏览器", example = "Chrome 115.0.0.0") private String browser; + /** + * 操作状态 + */ + @Schema(description = "操作状态(1:成功;2:失败)", type = "Integer", allowableValues = {"1", "2"}, example = "1") + private LogStatusEnum status; + /** * 错误信息 */ diff --git a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/resp/SystemLogDetailResp.java b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/resp/SystemLogDetailResp.java index ddf14d5c..05160e26 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/resp/SystemLogDetailResp.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/resp/SystemLogDetailResp.java @@ -56,7 +56,7 @@ public class SystemLogDetailResp extends LogResp { /** * 请求头 */ - @Schema(description = "请求头", example = "{\"Origin\": \"https://cnadmin.charles7c.top\",...}") + @Schema(description = "请求头", example = "{\"Origin\": [\"https://cnadmin.charles7c.top\"],...}") private String requestHeaders; /** @@ -78,16 +78,16 @@ public class SystemLogDetailResp extends LogResp { private String responseBody; /** - * 客户端IP + * IP */ - @Schema(description = "客户端IP", example = "192.168.0.1") - private String clientIp; + @Schema(description = "IP", example = "192.168.0.1") + private String ip; /** - * IP归属地 + * 地址 */ - @Schema(description = "IP归属地", example = "中国北京北京市") - private String location; + @Schema(description = "地址", example = "中国北京北京市") + private String address; /** * 浏览器 @@ -96,8 +96,14 @@ public class SystemLogDetailResp extends LogResp { private String browser; /** - * 请求耗时(ms) + * 操作系统 */ - @Schema(description = "请求耗时(ms)", example = "58") - private Long elapsedTime; + @Schema(description = "操作系统", example = "Windows 10") + private String os; + + /** + * 耗时(ms) + */ + @Schema(description = "耗时(ms)", example = "58") + private Long timeTaken; } diff --git a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/resp/SystemLogResp.java b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/resp/SystemLogResp.java index ccf6ce46..c0046436 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/resp/SystemLogResp.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/resp/SystemLogResp.java @@ -54,16 +54,16 @@ public class SystemLogResp extends LogResp { private String requestUrl; /** - * 客户端IP + * IP */ - @Schema(description = "客户端IP", example = "192.168.0.1") - private String clientIp; + @Schema(description = "IP", example = "192.168.0.1") + private String ip; /** - * IP归属地 + * 地址 */ - @Schema(description = "IP归属地", example = "中国北京北京市") - private String location; + @Schema(description = "地址", example = "中国北京北京市") + private String address; /** * 浏览器 @@ -72,20 +72,8 @@ public class SystemLogResp extends LogResp { private String browser; /** - * 请求耗时(ms) + * 耗时(ms) */ - @Schema(description = "请求耗时(ms)", example = "58") - private Long elapsedTime; - - /** - * 错误信息 - */ - @Schema(description = "错误信息") - private String errorMsg; - - /** - * 异常详情 - */ - @Schema(description = "异常详情") - private String exceptionDetail; + @Schema(description = "耗时(ms)", example = "58") + private Long timeTaken; } diff --git a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/service/impl/LogServiceImpl.java b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/service/impl/LogServiceImpl.java index e0b96b59..6241716c 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/service/impl/LogServiceImpl.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/service/impl/LogServiceImpl.java @@ -23,8 +23,6 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.springframework.context.event.EventListener; -import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -63,27 +61,18 @@ public class LogServiceImpl implements LogService { private final LogMapper logMapper; private final CommonUserService commonUserService; - @Async - @EventListener - public void save(LogDO logDO) { - logMapper.insert(logDO); - } - @Override public PageDataResp page(OperationLogQuery query, PageQuery pageQuery) { QueryWrapper queryWrapper = QueryHelper.build(query); - // 限定查询信息 List fieldNameList = ReflectUtils.getNonStaticFieldsName(OperationLogResp.class); List columnNameList = fieldNameList.stream().filter(n -> !n.endsWith(SysConstants.DESCRIPTION_FIELD_SUFFIX)) .map(StrUtil::toUnderlineCase).collect(Collectors.toList()); queryWrapper.select(columnNameList); - // 分页查询 IPage page = logMapper.selectPage(pageQuery.toPage(), queryWrapper); PageDataResp pageDataResp = PageDataResp.build(page, OperationLogResp.class); - // 填充数据(如果是查询个人操作日志,只查询一次用户信息即可) if (null != query.getUid()) { String nickname = ExceptionUtils.exToNull(() -> commonUserService.getNicknameById(query.getUid())); @@ -98,18 +87,15 @@ public PageDataResp page(OperationLogQuery query, PageQuery pa public PageDataResp page(LoginLogQuery query, PageQuery pageQuery) { QueryWrapper queryWrapper = QueryHelper.build(query); queryWrapper.eq("module", "登录"); - // 限定查询信息 List fieldNameList = ReflectUtils.getNonStaticFieldsName(LoginLogResp.class); List columnNameList = fieldNameList.stream().filter(n -> !n.endsWith(SysConstants.DESCRIPTION_FIELD_SUFFIX)) .map(StrUtil::toUnderlineCase).collect(Collectors.toList()); queryWrapper.select(columnNameList); - // 分页查询 IPage page = logMapper.selectPage(pageQuery.toPage(), queryWrapper); PageDataResp pageDataResp = PageDataResp.build(page, LoginLogResp.class); - // 填充数据 pageDataResp.getList().forEach(this::fill); return pageDataResp; @@ -118,18 +104,15 @@ public PageDataResp page(LoginLogQuery query, PageQuery pageQuery) @Override public PageDataResp page(SystemLogQuery query, PageQuery pageQuery) { QueryWrapper queryWrapper = QueryHelper.build(query); - // 限定查询信息 List fieldNameList = ReflectUtils.getNonStaticFieldsName(SystemLogResp.class); List columnNameList = fieldNameList.stream().filter(n -> !n.endsWith(SysConstants.DESCRIPTION_FIELD_SUFFIX)) .map(StrUtil::toUnderlineCase).collect(Collectors.toList()); queryWrapper.select(columnNameList); - // 分页查询 IPage page = logMapper.selectPage(pageQuery.toPage(), queryWrapper); PageDataResp pageDataResp = PageDataResp.build(page, SystemLogResp.class); - // 填充数据 pageDataResp.getList().forEach(this::fill); return pageDataResp; diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/auth/model/resp/OnlineUserResp.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/auth/model/resp/OnlineUserResp.java index 384f9619..2c199412 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/auth/model/resp/OnlineUserResp.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/auth/model/resp/OnlineUserResp.java @@ -66,13 +66,13 @@ public class OnlineUserResp implements Serializable { * 登录 IP */ @Schema(description = "登录 IP", example = "192.168.0.1") - private String clientIp; + private String ip; /** * 登录地点 */ @Schema(description = "登录地点", example = "中国北京北京市") - private String location; + private String address; /** * 浏览器 @@ -80,6 +80,12 @@ public class OnlineUserResp implements Serializable { @Schema(description = "浏览器", example = "Chrome 115.0.0.0") private String browser; + /** + * 操作系统 + */ + @Schema(description = "操作系统", example = "Windows 10") + private String os; + /** * 登录时间 */ diff --git a/continew-admin-ui/src/api/monitor/log.ts b/continew-admin-ui/src/api/monitor/log.ts index 8d764ce3..2a499d9b 100644 --- a/continew-admin-ui/src/api/monitor/log.ts +++ b/continew-admin-ui/src/api/monitor/log.ts @@ -5,9 +5,10 @@ const BASE_URL = '/monitor/log'; export interface LogRecord { id?: number; - clientIp: string; - location: string; + ip: string; + address: string; browser: string; + os: string; createTime: string; } @@ -22,7 +23,7 @@ export interface OperationLogRecord extends LogRecord { module: string; description: string; status: number; - errorMsg: string; + errorMsgString: string; createUserString: string; } @@ -30,8 +31,7 @@ export interface SystemLogRecord extends LogRecord { statusCode: number; requestMethod: string; requestUrl: string; - elapsedTime: number; - exceptionDetail?: string; + timeTaken: number; } export interface SystemLogDetailRecord extends SystemLogRecord { diff --git a/continew-admin-ui/src/api/monitor/online.ts b/continew-admin-ui/src/api/monitor/online.ts index 91699b68..da9f0617 100644 --- a/continew-admin-ui/src/api/monitor/online.ts +++ b/continew-admin-ui/src/api/monitor/online.ts @@ -7,9 +7,10 @@ export interface DataRecord { token: string; username: string; nickname: string; - clientIp: string; - location: string; + ip: string; + address: string; browser: string; + os: string; loginTime: string; } diff --git a/continew-admin-ui/src/views/monitor/log/login/index.vue b/continew-admin-ui/src/views/monitor/log/login/index.vue index 135869a8..db198a93 100644 --- a/continew-admin-ui/src/views/monitor/log/login/index.vue +++ b/continew-admin-ui/src/views/monitor/log/login/index.vue @@ -72,9 +72,10 @@ - - + + + diff --git a/continew-admin-ui/src/views/monitor/log/operation/index.vue b/continew-admin-ui/src/views/monitor/log/operation/index.vue index df9e27ae..161081cb 100644 --- a/continew-admin-ui/src/views/monitor/log/operation/index.vue +++ b/continew-admin-ui/src/views/monitor/log/operation/index.vue @@ -83,8 +83,8 @@ - - + + diff --git a/continew-admin-ui/src/views/monitor/log/system/index.vue b/continew-admin-ui/src/views/monitor/log/system/index.vue index b44340e4..bf042eeb 100644 --- a/continew-admin-ui/src/views/monitor/log/system/index.vue +++ b/continew-admin-ui/src/views/monitor/log/system/index.vue @@ -74,21 +74,21 @@ }} - - + + - + - + @@ -125,11 +116,11 @@ >
- + - {{ systemLog.clientIp }} + {{ systemLog.ip }} @@ -137,34 +128,40 @@ {{ systemLog.browser }} - + + + + + {{ systemLog.address }} + + - {{ systemLog.location }} + {{ systemLog.os }} - + + + + + {{ systemLog.createTime }} + + - - {{ systemLog.elapsedTime }} ms + + {{ systemLog.timeTaken }} ms - - {{ systemLog.elapsedTime }} ms + + {{ systemLog.timeTaken }} ms {{ systemLog.elapsedTime }} ms{{ systemLog.timeTaken }} ms - - - - - {{ systemLog.createTime }} -
- - - -
{{ exceptionDetail }}
-
@@ -297,17 +280,16 @@ statusCode: 200, responseHeaders: '', responseBody: '', - elapsedTime: 0, - clientIp: '', - location: '', + timeTaken: 0, + ip: '', + address: '', browser: '', + os: '', createTime: '', }); const total = ref(0); - const exceptionDetail = ref(''); const loading = ref(false); const visible = ref(false); - const exceptionDetailVisible = ref(false); const data = reactive({ // 查询参数 @@ -362,24 +344,6 @@ visible.value = false; }; - /** - * 查看异常详情 - * - * @param record 记录信息 - */ - const toExceptionDetail = async (record: SystemLogRecord) => { - exceptionDetail.value = record.exceptionDetail || ''; - exceptionDetailVisible.value = true; - }; - - /** - * 关闭异常详情 - */ - const handleExceptionDetailCancel = () => { - exceptionDetail.value = ''; - exceptionDetailVisible.value = false; - }; - /** * 查询 */ diff --git a/continew-admin-ui/src/views/monitor/online/index.vue b/continew-admin-ui/src/views/monitor/online/index.vue index 6ba2b828..fac0244e 100644 --- a/continew-admin-ui/src/views/monitor/online/index.vue +++ b/continew-admin-ui/src/views/monitor/online/index.vue @@ -63,9 +63,10 @@ {{ record.nickname }}({{ record.username }})
- - + + + - - + + \ No newline at end of file diff --git a/continew-admin-ui/src/assets/icons/svg/file-excel.svg b/continew-admin-ui/src/assets/icons/svg/file-excel.svg new file mode 100644 index 00000000..f53b51fa --- /dev/null +++ b/continew-admin-ui/src/assets/icons/svg/file-excel.svg @@ -0,0 +1,11 @@ + + + + + \ No newline at end of file diff --git a/continew-admin-ui/src/assets/icons/svg/file-exe.svg b/continew-admin-ui/src/assets/icons/svg/file-exe.svg new file mode 100644 index 00000000..4111d06f --- /dev/null +++ b/continew-admin-ui/src/assets/icons/svg/file-exe.svg @@ -0,0 +1,20 @@ + + + + + + + + \ No newline at end of file diff --git a/continew-admin-ui/src/assets/icons/svg/file-html.svg b/continew-admin-ui/src/assets/icons/svg/file-html.svg new file mode 100644 index 00000000..9b704e92 --- /dev/null +++ b/continew-admin-ui/src/assets/icons/svg/file-html.svg @@ -0,0 +1,14 @@ + + + + + + + \ No newline at end of file diff --git a/continew-admin-ui/src/assets/icons/svg/file-image-a.svg b/continew-admin-ui/src/assets/icons/svg/file-image-a.svg new file mode 100644 index 00000000..31ed403c --- /dev/null +++ b/continew-admin-ui/src/assets/icons/svg/file-image-a.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/continew-admin-ui/src/assets/icons/svg/file-image.svg b/continew-admin-ui/src/assets/icons/svg/file-image.svg index 31ed403c..e4989db5 100644 --- a/continew-admin-ui/src/assets/icons/svg/file-image.svg +++ b/continew-admin-ui/src/assets/icons/svg/file-image.svg @@ -1 +1,11 @@ - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/continew-admin-ui/src/assets/icons/svg/file-js.svg b/continew-admin-ui/src/assets/icons/svg/file-js.svg new file mode 100644 index 00000000..b38ef349 --- /dev/null +++ b/continew-admin-ui/src/assets/icons/svg/file-js.svg @@ -0,0 +1,14 @@ + + + + + + + \ No newline at end of file diff --git a/continew-admin-ui/src/assets/icons/svg/file-json.svg b/continew-admin-ui/src/assets/icons/svg/file-json.svg new file mode 100644 index 00000000..e7cd332a --- /dev/null +++ b/continew-admin-ui/src/assets/icons/svg/file-json.svg @@ -0,0 +1,14 @@ + + + + + + + \ No newline at end of file diff --git a/continew-admin-ui/src/assets/icons/svg/file-music.svg b/continew-admin-ui/src/assets/icons/svg/file-music.svg new file mode 100644 index 00000000..77581161 --- /dev/null +++ b/continew-admin-ui/src/assets/icons/svg/file-music.svg @@ -0,0 +1,11 @@ + + + + + \ No newline at end of file diff --git a/continew-admin-ui/src/assets/icons/svg/file-other.svg b/continew-admin-ui/src/assets/icons/svg/file-other.svg new file mode 100644 index 00000000..4215a134 --- /dev/null +++ b/continew-admin-ui/src/assets/icons/svg/file-other.svg @@ -0,0 +1,11 @@ + + + + + \ No newline at end of file diff --git a/continew-admin-ui/src/assets/icons/svg/file-pdf-a.svg b/continew-admin-ui/src/assets/icons/svg/file-pdf-a.svg new file mode 100644 index 00000000..ad9a37ce --- /dev/null +++ b/continew-admin-ui/src/assets/icons/svg/file-pdf-a.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/continew-admin-ui/src/assets/icons/svg/file-pdf.svg b/continew-admin-ui/src/assets/icons/svg/file-pdf.svg index ad9a37ce..9bf682b2 100644 --- a/continew-admin-ui/src/assets/icons/svg/file-pdf.svg +++ b/continew-admin-ui/src/assets/icons/svg/file-pdf.svg @@ -1 +1,11 @@ - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/continew-admin-ui/src/assets/icons/svg/file-ppt.svg b/continew-admin-ui/src/assets/icons/svg/file-ppt.svg new file mode 100644 index 00000000..72bac64c --- /dev/null +++ b/continew-admin-ui/src/assets/icons/svg/file-ppt.svg @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/continew-admin-ui/src/assets/icons/svg/file-rar.svg b/continew-admin-ui/src/assets/icons/svg/file-rar.svg new file mode 100644 index 00000000..8cc3ee23 --- /dev/null +++ b/continew-admin-ui/src/assets/icons/svg/file-rar.svg @@ -0,0 +1,16 @@ + + + + + + + \ No newline at end of file diff --git a/continew-admin-ui/src/assets/icons/svg/file-txt.svg b/continew-admin-ui/src/assets/icons/svg/file-txt.svg new file mode 100644 index 00000000..833e12ac --- /dev/null +++ b/continew-admin-ui/src/assets/icons/svg/file-txt.svg @@ -0,0 +1,11 @@ + + + + + \ No newline at end of file diff --git a/continew-admin-ui/src/assets/icons/svg/file-video-a.svg b/continew-admin-ui/src/assets/icons/svg/file-video-a.svg new file mode 100644 index 00000000..64580805 --- /dev/null +++ b/continew-admin-ui/src/assets/icons/svg/file-video-a.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/continew-admin-ui/src/assets/icons/svg/file-video.svg b/continew-admin-ui/src/assets/icons/svg/file-video.svg index 64580805..720ee9f9 100644 --- a/continew-admin-ui/src/assets/icons/svg/file-video.svg +++ b/continew-admin-ui/src/assets/icons/svg/file-video.svg @@ -1 +1,14 @@ - \ No newline at end of file + + + + + + \ No newline at end of file diff --git a/continew-admin-ui/src/assets/icons/svg/file-wps.svg b/continew-admin-ui/src/assets/icons/svg/file-wps.svg new file mode 100644 index 00000000..210fd333 --- /dev/null +++ b/continew-admin-ui/src/assets/icons/svg/file-wps.svg @@ -0,0 +1,13 @@ + + + + + + + \ No newline at end of file diff --git a/continew-admin-ui/src/assets/icons/svg/file-zip.svg b/continew-admin-ui/src/assets/icons/svg/file-zip.svg new file mode 100644 index 00000000..51fde6fa --- /dev/null +++ b/continew-admin-ui/src/assets/icons/svg/file-zip.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/continew-admin-ui/src/assets/icons/svg/menu-file.svg b/continew-admin-ui/src/assets/icons/svg/menu-file.svg new file mode 100644 index 00000000..d2a1c8a0 --- /dev/null +++ b/continew-admin-ui/src/assets/icons/svg/menu-file.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/continew-admin-ui/src/constant/file.ts b/continew-admin-ui/src/constant/file.ts new file mode 100644 index 00000000..cd35602a --- /dev/null +++ b/continew-admin-ui/src/constant/file.ts @@ -0,0 +1,47 @@ +/** @desc 文件模块-映射 */ + +export interface fileTypeListItem { + name: string + value: number + menuIcon: string + icon: string +} + +// 文件分类 +export const fileTypeList: fileTypeListItem[] = [ + { name: '全部', value: 0, menuIcon: 'menu-file', icon: 'icon-stamp' }, + { name: '图片', value: 1, menuIcon: 'file-image', icon: 'icon-file-image' }, + { name: '文档', value: 2, menuIcon: 'file-txt', icon: 'icon-file' }, + { name: '视频', value: 3, menuIcon: 'file-video', icon: 'icon-video-camera' }, + { name: '音频', value: 4, menuIcon: 'file-music', icon: 'icon-file-audio' }, + { name: '其他', value: 5, menuIcon: 'file-other', icon: 'icon-bulb' } +] + +export interface FileExtendNameIconMap { + [key: string]: string +} + +// 文件类型图标 Map 映射 +export const fileExtendNameIconMap: FileExtendNameIconMap = { + mp3: 'file-music', + mp4: 'file-video', + dir: 'file-dir', + ppt: 'file-ppt', + doc: 'file-wps', + docx: 'file-wps', + xls: 'file-excel', + xlsx: 'file-excel', + txt: 'file-txt', + rar: 'file-rar', + zip: 'file-zip', + html: 'file-html', + css: 'file-css', + js: 'file-js', + other: 'file-other' // 未知文件 +} + +// 图片类型 +export const imageTypeList = ['jpg', 'png', 'gif', 'jpeg'] + +// WPS、Office文件类型 +export const officeFileType = ['ppt', 'pptx', 'doc', 'docx', 'xls', 'xlsx'] diff --git a/continew-admin-ui/src/locale/en-US.ts b/continew-admin-ui/src/locale/en-US.ts index d567496c..de93531d 100644 --- a/continew-admin-ui/src/locale/en-US.ts +++ b/continew-admin-ui/src/locale/en-US.ts @@ -8,6 +8,7 @@ import localeAnnouncement from '@/views/system/announcement/locale/en-US'; import localeMessage from '@/views/system/message/locale/en-US'; import localeDict from '@/views/system/dict/locale/en-US'; import localeConfig from '@/views/system/config/locale/en-US'; +import localeFile from '@/views/system/file/locale/en-US'; import localeGenerator from '@/views/tool/generator/locale/en-US'; @@ -66,6 +67,7 @@ export default { ...localeMessage, ...localeDict, ...localeConfig, + ...localeFile, ...localeGenerator, diff --git a/continew-admin-ui/src/locale/zh-CN.ts b/continew-admin-ui/src/locale/zh-CN.ts index c9b14c31..2aa1f31c 100644 --- a/continew-admin-ui/src/locale/zh-CN.ts +++ b/continew-admin-ui/src/locale/zh-CN.ts @@ -8,6 +8,7 @@ import localeAnnouncement from '@/views/system/announcement/locale/zh-CN'; import localeMessage from '@/views/system/message/locale/zh-CN'; import localeDict from '@/views/system/dict/locale/zh-CN'; import localeConfig from '@/views/system/config/locale/zh-CN'; +import localeFile from '@/views/system/file/locale/zh-CN'; import localeGenerator from '@/views/tool/generator/locale/zh-CN'; @@ -66,6 +67,7 @@ export default { ...localeMessage, ...localeDict, ...localeConfig, + ...localeFile, ...localeGenerator, diff --git a/continew-admin-ui/src/router/routes/modules/system.ts b/continew-admin-ui/src/router/routes/modules/system.ts index 3d07e34f..cc4b609b 100644 --- a/continew-admin-ui/src/router/routes/modules/system.ts +++ b/continew-admin-ui/src/router/routes/modules/system.ts @@ -84,6 +84,15 @@ const System: AppRouteRecordRaw = { requiresAuth: true, }, }, + { + name: 'File', + path: '/system/file', + component: () => import('@/views/system/file/index.vue'), + meta: { + locale: 'menu.system.file.list', + requiresAuth: true, + }, + }, ], }; diff --git a/continew-admin-ui/src/store/modules/file.ts b/continew-admin-ui/src/store/modules/file.ts new file mode 100644 index 00000000..747eb7b2 --- /dev/null +++ b/continew-admin-ui/src/store/modules/file.ts @@ -0,0 +1,42 @@ +import { defineStore } from 'pinia'; +import { ref, computed } from 'vue'; +import type { FileItem } from '@/api/system/file'; + +type TViewMode = 'grid' | 'list'; + +const storeSetup = () => { + const viewMode = ref('grid'); // 视图: grid宫格模式 list列表模式 + const isBatchMode = ref(false); // 是否批量操作 + const selectedFileList = ref([]); + const selectedFileIds = computed(() => + selectedFileList.value.map((i) => i.id), + ); + + // 改变视图模式 + const changeViewMode = () => { + viewMode.value = viewMode.value === 'grid' ? 'list' : 'grid'; + }; + + // 添加选中的文件到文件勾选列表 + const addSelectedFileItem = (item: FileItem) => { + if (selectedFileIds.value.includes(item.id)) { + const index = selectedFileList.value.findIndex((i) => i.id === item.id); + selectedFileList.value.splice(index, 1); + } else { + selectedFileList.value.push(item); + } + }; + + return { + viewMode, + isBatchMode, + selectedFileList, + selectedFileIds, + changeViewMode, + addSelectedFileItem, + }; +}; + +export const useFileStore = defineStore('file', storeSetup, { + // persist: { storage: localStorage, paths: ['viewMode', 'selectedFileList'] }, +}); diff --git a/continew-admin-ui/src/views/system/file/components/FileMoveModal/index.vue b/continew-admin-ui/src/views/system/file/components/FileMoveModal/index.vue new file mode 100644 index 00000000..fbdd56ae --- /dev/null +++ b/continew-admin-ui/src/views/system/file/components/FileMoveModal/index.vue @@ -0,0 +1,176 @@ + + + + + diff --git a/continew-admin-ui/src/views/system/file/components/FileRenameModal/index.vue b/continew-admin-ui/src/views/system/file/components/FileRenameModal/index.vue new file mode 100644 index 00000000..571897b0 --- /dev/null +++ b/continew-admin-ui/src/views/system/file/components/FileRenameModal/index.vue @@ -0,0 +1,85 @@ + + + + + diff --git a/continew-admin-ui/src/views/system/file/components/PreviewAudioModal/index.vue b/continew-admin-ui/src/views/system/file/components/PreviewAudioModal/index.vue new file mode 100644 index 00000000..809a11a8 --- /dev/null +++ b/continew-admin-ui/src/views/system/file/components/PreviewAudioModal/index.vue @@ -0,0 +1,148 @@ + + + + + diff --git a/continew-admin-ui/src/views/system/file/components/PreviewVideoModal/index.vue b/continew-admin-ui/src/views/system/file/components/PreviewVideoModal/index.vue new file mode 100644 index 00000000..1184479e --- /dev/null +++ b/continew-admin-ui/src/views/system/file/components/PreviewVideoModal/index.vue @@ -0,0 +1,45 @@ + + + diff --git a/continew-admin-ui/src/views/system/file/components/index.ts b/continew-admin-ui/src/views/system/file/components/index.ts new file mode 100644 index 00000000..00335538 --- /dev/null +++ b/continew-admin-ui/src/views/system/file/components/index.ts @@ -0,0 +1,68 @@ +import type { Component } from 'vue'; +import { createApp } from 'vue'; +import ArcoVueIcon from '@arco-design/web-vue/es/icon'; +import ArcoVue from '@arco-design/web-vue'; +import { FileItem } from '@/api/system/file'; + +import FileMoveModal from './FileMoveModal/index.vue'; +import FileRenameModal from './FileRenameModal/index.vue'; +import PreviewVideoModal from './PreviewVideoModal/index.vue'; +import PreviewAudioModal from './PreviewAudioModal/index.vue'; + +function createModal void }>( + component: Component, + options?: T, +) { + // 创建一个挂载容器 + const el: HTMLElement = document.createElement('div'); + // 挂载组件 + document.body.appendChild(el); + + // 实例化组件, createApp 第二个参数是 props + const instance = createApp(component, { + ...options, + onClose: () => { + setTimeout(() => { + instance.unmount(); + document.body.removeChild(el); + // options?.callback && options?.callback(); + }, 350); + }, + }); + + instance.use(ArcoVue); + instance.use(ArcoVueIcon); + instance.mount(el); +} + +type TFileOptions = { fileInfo: FileItem; callback?: () => void }; + +/** 打开 文件移动 弹窗 */ +export function openFileMoveModal(fileItem: FileItem) { + return createModal(FileMoveModal, { fileInfo: fileItem }); +} + +/** 打开 文件重命名 弹窗 */ +export function openFileRenameModal(fileItem: FileItem) { + return createModal(FileRenameModal, { fileInfo: fileItem }); +} + +/** 预览 视频文件 弹窗 */ +export function previewFileVideoModal(fileItem: FileItem) { + return createModal(PreviewVideoModal, { fileInfo: fileItem }); +} + +/** 预览 音频文件 弹窗 */ +let fileAudioId = ''; +export function previewFileAudioModal(fileItem: FileItem) { + if (fileAudioId) return; // 防止重复打开 + fileAudioId = fileItem.id; + // eslint-disable-next-line consistent-return + return createModal(PreviewAudioModal, { + fileInfo: fileItem, + // 关闭的回调 + callback: () => { + fileAudioId = ''; + }, + }); +} diff --git a/continew-admin-ui/src/views/system/file/detail/index.vue b/continew-admin-ui/src/views/system/file/detail/index.vue new file mode 100644 index 00000000..6c2cdce5 --- /dev/null +++ b/continew-admin-ui/src/views/system/file/detail/index.vue @@ -0,0 +1,138 @@ + + + + + diff --git a/continew-admin-ui/src/views/system/file/index.vue b/continew-admin-ui/src/views/system/file/index.vue new file mode 100644 index 00000000..20ac5add --- /dev/null +++ b/continew-admin-ui/src/views/system/file/index.vue @@ -0,0 +1,43 @@ + + + + + diff --git a/continew-admin-ui/src/views/system/file/locale/en-US.ts b/continew-admin-ui/src/views/system/file/locale/en-US.ts new file mode 100644 index 00000000..605b7282 --- /dev/null +++ b/continew-admin-ui/src/views/system/file/locale/en-US.ts @@ -0,0 +1,3 @@ +export default { + 'menu.system.file.list': 'File management', +}; diff --git a/continew-admin-ui/src/views/system/file/locale/zh-CN.ts b/continew-admin-ui/src/views/system/file/locale/zh-CN.ts new file mode 100644 index 00000000..2c8c9233 --- /dev/null +++ b/continew-admin-ui/src/views/system/file/locale/zh-CN.ts @@ -0,0 +1,3 @@ +export default { + 'menu.system.file.list': '文件管理(尚在开发)', +}; diff --git a/continew-admin-ui/src/views/system/file/main/FileAside.vue b/continew-admin-ui/src/views/system/file/main/FileAside.vue new file mode 100644 index 00000000..dbe8ed0a --- /dev/null +++ b/continew-admin-ui/src/views/system/file/main/FileAside.vue @@ -0,0 +1,70 @@ + + + + + diff --git a/continew-admin-ui/src/views/system/file/main/FileMain/FileGrid.vue b/continew-admin-ui/src/views/system/file/main/FileMain/FileGrid.vue new file mode 100644 index 00000000..d18a4744 --- /dev/null +++ b/continew-admin-ui/src/views/system/file/main/FileMain/FileGrid.vue @@ -0,0 +1,173 @@ + + + + + diff --git a/continew-admin-ui/src/views/system/file/main/FileMain/FileImg.vue b/continew-admin-ui/src/views/system/file/main/FileMain/FileImg.vue new file mode 100644 index 00000000..05f56dbf --- /dev/null +++ b/continew-admin-ui/src/views/system/file/main/FileMain/FileImg.vue @@ -0,0 +1,47 @@ + + + + + diff --git a/continew-admin-ui/src/views/system/file/main/FileMain/FileList.vue b/continew-admin-ui/src/views/system/file/main/FileMain/FileList.vue new file mode 100644 index 00000000..cea3ac07 --- /dev/null +++ b/continew-admin-ui/src/views/system/file/main/FileMain/FileList.vue @@ -0,0 +1,138 @@ + + + + + + + diff --git a/continew-admin-ui/src/views/system/file/main/FileMain/FileRightMenu.vue b/continew-admin-ui/src/views/system/file/main/FileMain/FileRightMenu.vue new file mode 100644 index 00000000..3369d33b --- /dev/null +++ b/continew-admin-ui/src/views/system/file/main/FileMain/FileRightMenu.vue @@ -0,0 +1,91 @@ + + + + + diff --git a/continew-admin-ui/src/views/system/file/main/FileMain/index.vue b/continew-admin-ui/src/views/system/file/main/FileMain/index.vue new file mode 100644 index 00000000..997ff443 --- /dev/null +++ b/continew-admin-ui/src/views/system/file/main/FileMain/index.vue @@ -0,0 +1,213 @@ + + + + + diff --git a/continew-admin-webapi/src/main/resources/db/changelog/db.changelog-master.yaml b/continew-admin-webapi/src/main/resources/db/changelog/db.changelog-master.yaml index ed254bb1..0cae68e8 100644 --- a/continew-admin-webapi/src/main/resources/db/changelog/db.changelog-master.yaml +++ b/continew-admin-webapi/src/main/resources/db/changelog/db.changelog-master.yaml @@ -23,3 +23,9 @@ databaseChangeLog: file: db/changelog/v1.3.0/continew-admin_column.sql - include: file: db/changelog/v1.3.0/continew-admin_data.sql + - include: + file: db/changelog/v2.2.0/continew-admin_table.sql + - include: + file: db/changelog/v2.2.0/continew-admin_column.sql + - include: + file: db/changelog/v2.2.0/continew-admin_data.sql \ No newline at end of file diff --git a/continew-admin-webapi/src/main/resources/db/changelog/v2.2.0/continew-admin_column.sql b/continew-admin-webapi/src/main/resources/db/changelog/v2.2.0/continew-admin_column.sql new file mode 100644 index 00000000..874085b8 --- /dev/null +++ b/continew-admin-webapi/src/main/resources/db/changelog/v2.2.0/continew-admin_column.sql @@ -0,0 +1,2 @@ +-- liquibase formatted sql + diff --git a/continew-admin-webapi/src/main/resources/db/changelog/v2.2.0/continew-admin_data.sql b/continew-admin-webapi/src/main/resources/db/changelog/v2.2.0/continew-admin_data.sql new file mode 100644 index 00000000..e3c9c437 --- /dev/null +++ b/continew-admin-webapi/src/main/resources/db/changelog/v2.2.0/continew-admin_data.sql @@ -0,0 +1,17 @@ +-- liquibase formatted sql + +-- changeset Charles7c:1 +-- 初始化默认菜单 +INSERT IGNORE INTO `sys_menu` +(`id`, `title`, `parent_id`, `type`, `path`, `name`, `component`, `icon`, `is_external`, `is_cache`, `is_hidden`, `permission`, `sort`, `status`, `create_user`, `create_time`, `update_user`, `update_time`) +VALUES +(1090, '文件管理', 1000, 2, '/system/file', 'File', 'system/file/index', 'file', b'0', b'0', b'0', 'system:file:list', 9, 1, 1, NOW(), NULL, NULL), +(1091, '文件上传', 1090, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:file:upload', 1, 1, 1, NOW(), NULL, NULL), +(1092, '文件修改', 1090, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:file:update', 2, 1, 1, NOW(), NULL, NULL), +(1093, '文件删除', 1090, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:file:delete', 3, 1, 1, NOW(), NULL, NULL), +(1094, '文件下载', 1090, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:file:download', 4, 1, 1, NOW(), NULL, NULL), +(1100, '存储管理', 1000, 2, '/system/storage', 'Storage', 'system/storage/index', 'storage', b'0', b'0', b'1', 'system:storage:list', 10, 1, 1, NOW(), NULL, NULL), +(1101, '存储新增', 1100, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:storage:add', 1, 1, 1, NOW(), NULL, NULL), +(1102, '存储修改', 1100, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:storage:update', 2, 1, 1, NOW(), NULL, NULL), +(1103, '存储删除', 1100, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:storage:delete', 3, 1, 1, NOW(), NULL, NULL), +(1104, '存储导出', 1100, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:storage:export', 4, 1, 1, NOW(), NULL, NULL); diff --git a/continew-admin-webapi/src/main/resources/db/changelog/v2.2.0/continew-admin_table.sql b/continew-admin-webapi/src/main/resources/db/changelog/v2.2.0/continew-admin_table.sql new file mode 100644 index 00000000..07c70d14 --- /dev/null +++ b/continew-admin-webapi/src/main/resources/db/changelog/v2.2.0/continew-admin_table.sql @@ -0,0 +1,44 @@ +-- liquibase formatted sql + +-- changeset Charles7c:1 +CREATE TABLE IF NOT EXISTS `sys_file` ( + `id` bigint(20) NOT NULL COMMENT 'ID', + `name` varchar(255) NOT NULL COMMENT '名称', + `size` bigint(20) NOT NULL COMMENT '大小(字节)', + `url` varchar(512) NOT NULL COMMENT 'URL', + `extension` varchar(100) DEFAULT NULL COMMENT '扩展名', + `mime_type` varchar(100) DEFAULT NULL COMMENT 'MIME类型', + `category` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '类型(1:其他;2:图片;3:文档;4:视频;5:音频)', + `storage_id` bigint(20) NOT NULL COMMENT '存储库ID', + `create_user` bigint(20) NOT NULL COMMENT '创建人', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_user` bigint(20) DEFAULT NULL COMMENT '修改人', + `update_time` datetime DEFAULT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + INDEX `idx_category`(`category`) USING BTREE, + INDEX `idx_create_user`(`create_user`) USING BTREE, + INDEX `idx_update_user`(`update_user`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='文件表'; + +CREATE TABLE IF NOT EXISTS `sys_storage` ( + `id` bigint(20) AUTO_INCREMENT COMMENT 'ID', + `name` varchar(100) NOT NULL COMMENT '名称', + `code` varchar(30) NOT NULL COMMENT '编码', + `access_key` varchar(255) DEFAULT NULL COMMENT 'Access Key(访问密钥)', + `secret_key` varchar(255) DEFAULT NULL COMMENT 'Secret Key(私有访问密钥)', + `endpoint` varchar(255) DEFAULT NULL COMMENT 'Endpoint(终端节点)', + `bucket_name` varchar(255) DEFAULT NULL COMMENT '桶名称', + `domain` varchar(255) DEFAULT NULL COMMENT '自定义域名', + `description` varchar(200) DEFAULT NULL COMMENT '描述', + `is_default` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否为默认存储', + `sort` int NOT NULL DEFAULT 999 COMMENT '排序', + `status` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态(1:启用;2:禁用)', + `create_user` bigint(20) NOT NULL COMMENT '创建人', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_user` bigint(20) DEFAULT NULL COMMENT '修改人', + `update_time` datetime DEFAULT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `uk_code`(`code`) USING BTREE, + INDEX `idx_create_user`(`create_user`) USING BTREE, + INDEX `idx_update_user`(`update_user`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='存储库表'; \ No newline at end of file From 4a50e7290e4d322c342a8f1f7f5b351265c5a972 Mon Sep 17 00:00:00 2001 From: Charles7c Date: Thu, 21 Dec 2023 21:08:38 +0800 Subject: [PATCH 18/49] =?UTF-8?q?style:=20=E4=BC=98=E5=8C=96=E9=83=A8?= =?UTF-8?q?=E5=88=86=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/easyexcel/ExcelBaseEnumConverter.java | 3 ++- .../common/config/jackson/BaseEnumDeserializer.java | 3 ++- .../common/config/jackson/BaseEnumSerializer.java | 3 ++- .../common/config/jackson/JacksonConfiguration.java | 3 ++- .../config/jackson/SimpleDeserializersWrapper.java | 2 +- .../config/mybatis/MyBatisPlusMetaObjectHandler.java | 2 +- .../src/main/resources/config/application-dev.yml | 2 +- .../src/main/resources/config/application-prod.yml | 2 +- .../src/main/resources/config/application.yml | 10 +++++----- .../src/main/resources/logback-spring.xml | 2 +- 10 files changed, 18 insertions(+), 14 deletions(-) diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/easyexcel/ExcelBaseEnumConverter.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/easyexcel/ExcelBaseEnumConverter.java index ea62314a..fdafc115 100644 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/easyexcel/ExcelBaseEnumConverter.java +++ b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/easyexcel/ExcelBaseEnumConverter.java @@ -30,8 +30,9 @@ import top.charles7c.continew.starter.data.mybatis.plus.enums.IBaseEnum; /** - * Easy Excel 枚举基类转换器 + * Easy Excel 枚举接口转换器 * + * @see IBaseEnum * @author Charles7c * @since 2023/2/5 19:29 */ diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/BaseEnumDeserializer.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/BaseEnumDeserializer.java index 111c1481..301dc91a 100644 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/BaseEnumDeserializer.java +++ b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/BaseEnumDeserializer.java @@ -30,8 +30,9 @@ import top.charles7c.continew.starter.data.mybatis.plus.enums.IBaseEnum; /** - * 通用枚举基类 BaseEnum 反序列化器 + * 通用枚举接口 IBaseEnum 反序列化器 * + * @see IBaseEnum * @author Charles7c * @since 2023/1/8 13:56 */ diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/BaseEnumSerializer.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/BaseEnumSerializer.java index 21f37f0f..06f369b4 100644 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/BaseEnumSerializer.java +++ b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/BaseEnumSerializer.java @@ -26,8 +26,9 @@ import top.charles7c.continew.starter.data.mybatis.plus.enums.IBaseEnum; /** - * 通用枚举接口 BaseEnum 序列化器 + * 通用枚举接口 IBaseEnum 序列化器 * + * @see IBaseEnum * @author Charles7c * @since 2023/1/8 13:56 */ diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/JacksonConfiguration.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/JacksonConfiguration.java index 8ed8c7f9..cdd06d39 100644 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/JacksonConfiguration.java +++ b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/JacksonConfiguration.java @@ -30,6 +30,7 @@ /** * Jackson 配置 * + * @see IBaseEnum * @author Charles7c * @since 2022/12/11 13:23 */ @@ -38,7 +39,7 @@ public class JacksonConfiguration { /** - * 针对枚举基类 BaseEnum 的序列化和反序列化 + * 针对枚举接口 IBaseEnum 的序列化和反序列化 */ @Bean public ObjectMapper objectMapper(Jackson2ObjectMapperBuilder builder) { diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/SimpleDeserializersWrapper.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/SimpleDeserializersWrapper.java index 224cfff7..baa8f473 100644 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/SimpleDeserializersWrapper.java +++ b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/SimpleDeserializersWrapper.java @@ -38,7 +38,7 @@ * 重写增强后:
* 1. 同默认 1;
* 2. 同默认 2;
- * 3. 如果也找不到 Enum 类型(所有枚举父类)的反序列化器,开始查找指定枚举类型的接口的反序列化器(例如:GenderEnum 枚举类型,则是找它的接口 BaseEnum 的反序列化器);
+ * 3. 如果也找不到 Enum 类型(所有枚举父类)的反序列化器,开始查找指定枚举类型的接口的反序列化器(例如:GenderEnum 枚举类型,则是找它的接口 IBaseEnum 的反序列化器);
* 4. 同默认 3。 *

* diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/mybatis/MyBatisPlusMetaObjectHandler.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/mybatis/MyBatisPlusMetaObjectHandler.java index 1109ab91..1f81caa3 100644 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/mybatis/MyBatisPlusMetaObjectHandler.java +++ b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/mybatis/MyBatisPlusMetaObjectHandler.java @@ -113,7 +113,7 @@ public void updateFill(MetaObject metaObject) { * @param fillFieldValue * 要填充的字段值 * @param isOverride - * 如果字段值不为空,是否覆盖(true 覆盖、false 不覆盖) + * 如果字段值不为空,是否覆盖(true:覆盖;false:不覆盖) */ private void fillFieldValue(MetaObject metaObject, String fieldName, Object fillFieldValue, boolean isOverride) { if (metaObject.hasSetter(fieldName)) { diff --git a/continew-admin-webapi/src/main/resources/config/application-dev.yml b/continew-admin-webapi/src/main/resources/config/application-dev.yml index f61da519..425124b6 100644 --- a/continew-admin-webapi/src/main/resources/config/application-dev.yml +++ b/continew-admin-webapi/src/main/resources/config/application-dev.yml @@ -17,7 +17,7 @@ spring.datasource: p6spy: true # 设置默认的数据源或者数据源组(默认 master) primary: master - # 严格匹配数据源(true 未匹配到指定数据源时抛异常;false 使用默认数据源;默认 false) + # 严格匹配数据源(true:未匹配到指定数据源时抛异常;false:使用默认数据源;默认 false) strict: false datasource: # 主库配置(可配多个,构成多主) diff --git a/continew-admin-webapi/src/main/resources/config/application-prod.yml b/continew-admin-webapi/src/main/resources/config/application-prod.yml index 8bfb0578..aba356bf 100644 --- a/continew-admin-webapi/src/main/resources/config/application-prod.yml +++ b/continew-admin-webapi/src/main/resources/config/application-prod.yml @@ -19,7 +19,7 @@ spring.datasource: p6spy: false # 设置默认的数据源或者数据源组(默认 master) primary: master - # 严格匹配数据源(true 未匹配到指定数据源时抛异常;false 使用默认数据源;默认 false) + # 严格匹配数据源(true:未匹配到指定数据源时抛异常;false:使用默认数据源;默认 false) strict: false datasource: # 主库配置(可配多个,构成多主) diff --git a/continew-admin-webapi/src/main/resources/config/application.yml b/continew-admin-webapi/src/main/resources/config/application.yml index 97c64446..e26a0d53 100644 --- a/continew-admin-webapi/src/main/resources/config/application.yml +++ b/continew-admin-webapi/src/main/resources/config/application.yml @@ -42,7 +42,7 @@ continew-starter.log: --- ### 接口文档配置 springdoc: - # 设置对象型参数的展示形式(设为 true 表示将对象型参数平展开,即对象内的属性直接作为参数展示而不是嵌套在对象内,默认为 false) + # 设置对象型参数的展示形式(设为 true 表示将对象型参数平展开,即对象内的属性直接作为参数展示而不是嵌套在对象内,默认 false) # 如果不添加该全局配置,可以在需要如此处理的对象参数类上使用 @ParameterObject default-flat-param-object: true # 分组配置 @@ -87,9 +87,9 @@ springdoc: knife4j: enable: true setting: - # 是否显示默认的 footer(默认 true 显示) + # 是否显示默认的 footer(默认 true,显示) enable-footer: false - # 是否自定义 footer(默认 false 非自定义) + # 是否自定义 footer(默认 false,非自定义) enable-footer-custom: true # 自定义 footer 内容,支持 Markdown 语法 footer-custom-content: 'Copyright © 2022-present [${project.contact.name}](${project.contact.url}) ⋅ [${project.name}](${project.url}) v${project.version}' @@ -133,7 +133,7 @@ mybatis-plus: global-config: banner: true db-config: - # 主键类型(默认 assign_id 表示自行赋值) + # 主键类型(默认 assign_id,表示自行赋值) # auto 代表使用数据库自增策略(需要在表中设置好自增约束) id-type: AUTO # 逻辑删除字段 @@ -161,7 +161,7 @@ server: context-path: / ## Undertow 服务器配置 undertow: - # HTTP POST 请求内容的大小上限(默认 -1 不限制) + # HTTP POST 请求内容的大小上限(默认 -1,不限制) max-http-post-size: -1 # 以下的配置会影响 buffer,这些 buffer 会用于服务器连接的 IO 操作,有点类似 Netty 的池化内存管理 # 每块 buffer的空间大小(越小的空间被利用越充分,不要设置太大,以免影响其他应用,合适即可) diff --git a/continew-admin-webapi/src/main/resources/logback-spring.xml b/continew-admin-webapi/src/main/resources/logback-spring.xml index 4b1a5845..9dc51aee 100644 --- a/continew-admin-webapi/src/main/resources/logback-spring.xml +++ b/continew-admin-webapi/src/main/resources/logback-spring.xml @@ -3,7 +3,7 @@ - + From 084942630ab0e1846c1836b8dc4bf5b2c9a5b16e Mon Sep 17 00:00:00 2001 From: Charles7c Date: Thu, 21 Dec 2023 23:24:11 +0800 Subject: [PATCH 19/49] =?UTF-8?q?refactor:=20=E9=80=82=E9=85=8D=20ContiNew?= =?UTF-8?q?=20Starter=20=E6=95=B0=E6=8D=AE=E6=9D=83=E9=99=90=E8=A7=A3?= =?UTF-8?q?=E5=86=B3=E6=96=B9=E6=A1=88=EF=BC=88=E6=95=B0=E6=8D=AE=E8=AE=BF?= =?UTF-8?q?=E9=97=AE=E6=A8=A1=E5=9D=97-MyBatis=20Plus=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1.移除数据权限相关内容,适配 ContiNew Starter 数据权限解决方案 2.适配 ContiNew Starter 部分包结构变动 --- .../common/annotation/DataPermission.java | 75 -------- .../mybatis/DataPermissionFilterImpl.java | 58 ++++++ .../mybatis/DataPermissionHandlerImpl.java | 176 ------------------ .../mybatis}/DataPermissionMapper.java | 6 +- .../mybatis/MybatisPlusConfiguration.java | 10 + .../admin/common/model/dto/LogContext.java | 56 ------ .../admin/monitor/mapper/LogMapper.java | 2 +- .../monitor/model/query/LoginLogQuery.java | 4 +- .../model/query/OperationLogQuery.java | 4 +- .../monitor/model/query/SystemLogQuery.java | 4 +- .../monitor/service/impl/LogServiceImpl.java | 2 +- .../system/mapper/AnnouncementMapper.java | 2 +- .../admin/system/mapper/DeptMapper.java | 2 +- .../admin/system/mapper/DictItemMapper.java | 2 +- .../admin/system/mapper/DictMapper.java | 2 +- .../admin/system/mapper/MenuMapper.java | 2 +- .../admin/system/mapper/MessageMapper.java | 2 +- .../system/mapper/MessageUserMapper.java | 2 +- .../admin/system/mapper/OptionMapper.java | 2 +- .../admin/system/mapper/RoleDeptMapper.java | 2 +- .../admin/system/mapper/RoleMapper.java | 2 +- .../admin/system/mapper/RoleMenuMapper.java | 2 +- .../admin/system/mapper/UserMapper.java | 2 +- .../admin/system/mapper/UserRoleMapper.java | 2 +- .../admin/system/mapper/UserSocialMapper.java | 2 +- .../system/model/query/AnnouncementQuery.java | 4 +- .../admin/system/model/query/DeptQuery.java | 4 +- .../system/model/query/DictItemQuery.java | 2 +- .../admin/system/model/query/DictQuery.java | 2 +- .../admin/system/model/query/MenuQuery.java | 4 +- .../system/model/query/MessageQuery.java | 4 +- .../admin/system/model/query/OptionQuery.java | 4 +- .../admin/system/model/query/RoleQuery.java | 2 +- .../admin/system/model/query/UserQuery.java | 4 +- .../service/impl/MessageServiceImpl.java | 2 +- .../service/impl/OptionServiceImpl.java | 2 +- .../admin/tool/mapper/FieldConfigMapper.java | 2 +- .../admin/tool/mapper/GenConfigMapper.java | 2 +- .../resources/templates/generator/Mapper.ftl | 2 +- .../resources/templates/generator/Query.ftl | 4 +- .../src/main/resources/config/application.yml | 5 +- 41 files changed, 118 insertions(+), 356 deletions(-) delete mode 100644 continew-admin-common/src/main/java/top/charles7c/continew/admin/common/annotation/DataPermission.java create mode 100644 continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/mybatis/DataPermissionFilterImpl.java delete mode 100644 continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/mybatis/DataPermissionHandlerImpl.java rename continew-admin-common/src/main/java/top/charles7c/continew/admin/common/{base => config/mybatis}/DataPermissionMapper.java (85%) delete mode 100644 continew-admin-common/src/main/java/top/charles7c/continew/admin/common/model/dto/LogContext.java diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/annotation/DataPermission.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/annotation/DataPermission.java deleted file mode 100644 index ff94449b..00000000 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/annotation/DataPermission.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package top.charles7c.continew.admin.common.annotation; - -import java.lang.annotation.*; - -import org.springframework.core.annotation.AliasFor; - -/** - * 数据权限注解 - * - * @author Charles7c - * @since 2023/3/6 23:34 - */ -@Target(ElementType.METHOD) -@Retention(RetentionPolicy.RUNTIME) -@Documented -public @interface DataPermission { - - /** - * Alias for the {@link #tableAlias()} attribute. - */ - @AliasFor("tableAlias") - String value() default ""; - - /** - * 表别名 - */ - @AliasFor("value") - String tableAlias() default ""; - - /** - * ID - */ - String id() default "id"; - - /** - * 部门 ID - */ - String deptId() default "dept_id"; - - /** - * 用户 ID - */ - String userId() default "create_user"; - - /** - * 角色 ID(角色和部门关联表) - */ - String roleId() default "role_id"; - - /** - * 部门表别名 - */ - String deptTableAlias() default "sys_dept"; - - /** - * 角色和部门关联表别名 - */ - String roleDeptTableAlias() default "sys_role_dept"; -} diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/mybatis/DataPermissionFilterImpl.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/mybatis/DataPermissionFilterImpl.java new file mode 100644 index 00000000..01ae5430 --- /dev/null +++ b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/mybatis/DataPermissionFilterImpl.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package top.charles7c.continew.admin.common.config.mybatis; + +import java.util.stream.Collectors; + +import cn.hutool.core.convert.Convert; + +import top.charles7c.continew.admin.common.model.dto.LoginUser; +import top.charles7c.continew.admin.common.util.helper.LoginHelper; +import top.charles7c.continew.starter.data.mybatis.plus.datapermission.DataPermissionCurrentUser; +import top.charles7c.continew.starter.data.mybatis.plus.datapermission.DataPermissionFilter; +import top.charles7c.continew.starter.data.mybatis.plus.datapermission.DataScope; + +/** + * 数据权限过滤器实现类 + * + * @author Charles7c + * @since 2023/12/21 21:19 + */ +public class DataPermissionFilterImpl implements DataPermissionFilter { + + @Override + public boolean isFilter() { + LoginUser loginUser = LoginHelper.getLoginUser(); + return null != loginUser && !loginUser.isAdmin(); + } + + @Override + public DataPermissionCurrentUser getCurrentUser() { + LoginUser loginUser = LoginHelper.getLoginUser(); + if (null == loginUser) { + throw new IllegalArgumentException("Current user is not allowed to be empty."); + } + DataPermissionCurrentUser currentUser = new DataPermissionCurrentUser(); + currentUser.setUserId(Convert.toStr(loginUser.getId())); + currentUser.setDeptId(Convert.toStr(loginUser.getDeptId())); + currentUser.setRoles(loginUser.getRoles().stream() + .map(r -> new DataPermissionCurrentUser.CurrentUserRole(Convert.toStr(r.getId()), + DataScope.valueOf(r.getDataScope().name()))) + .collect(Collectors.toSet())); + return currentUser; + } +} diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/mybatis/DataPermissionHandlerImpl.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/mybatis/DataPermissionHandlerImpl.java deleted file mode 100644 index 18cba798..00000000 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/mybatis/DataPermissionHandlerImpl.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package top.charles7c.continew.admin.common.config.mybatis; - -import java.lang.reflect.Method; -import java.util.Collections; - -import lombok.extern.slf4j.Slf4j; - -import com.baomidou.mybatisplus.core.toolkit.StringUtils; -import com.baomidou.mybatisplus.extension.plugins.handler.DataPermissionHandler; - -import top.charles7c.continew.admin.common.annotation.DataPermission; -import top.charles7c.continew.admin.common.enums.DataScopeEnum; -import top.charles7c.continew.admin.common.model.dto.LoginUser; -import top.charles7c.continew.admin.common.model.dto.RoleDTO; -import top.charles7c.continew.admin.common.util.helper.LoginHelper; -import top.charles7c.continew.starter.core.constant.StringConstants; - -import net.sf.jsqlparser.expression.Expression; -import net.sf.jsqlparser.expression.Function; -import net.sf.jsqlparser.expression.LongValue; -import net.sf.jsqlparser.expression.Parenthesis; -import net.sf.jsqlparser.expression.operators.conditional.AndExpression; -import net.sf.jsqlparser.expression.operators.conditional.OrExpression; -import net.sf.jsqlparser.expression.operators.relational.EqualsTo; -import net.sf.jsqlparser.expression.operators.relational.ExpressionList; -import net.sf.jsqlparser.expression.operators.relational.InExpression; -import net.sf.jsqlparser.schema.Column; -import net.sf.jsqlparser.schema.Table; -import net.sf.jsqlparser.statement.select.PlainSelect; -import net.sf.jsqlparser.statement.select.SelectExpressionItem; -import net.sf.jsqlparser.statement.select.SubSelect; - -/** - * 数据权限处理器实现 - *

- * 来源:DataPermissionInterceptor 如何使用? - *

- * - * @author Charles7c - * @since 2023/3/6 23:19 - */ -@Slf4j -public class DataPermissionHandlerImpl implements DataPermissionHandler { - - @Override - public Expression getSqlSegment(Expression where, String mappedStatementId) { - try { - Class clazz = - Class.forName(mappedStatementId.substring(0, mappedStatementId.lastIndexOf(StringConstants.DOT))); - String methodName = mappedStatementId.substring(mappedStatementId.lastIndexOf(StringConstants.DOT) + 1); - Method[] methodArr = clazz.getMethods(); - for (Method method : methodArr) { - DataPermission dataPermission = method.getAnnotation(DataPermission.class); - if (null != dataPermission - && (method.getName().equals(methodName) || (method.getName() + "_COUNT").equals(methodName))) { - LoginUser loginUser = LoginHelper.getLoginUser(); - if (null != loginUser && !loginUser.isAdmin()) { - return buildDataScopeFilter(loginUser, dataPermission, where); - } - } - } - } catch (ClassNotFoundException e) { - log.error("Data permission handler build data scope filter occurred an error: {}.", e.getMessage(), e); - } - return where; - } - - /** - * 构建数据范围过滤条件 - * - * @param user - * 当前登录用户 - * @param dataPermission - * 数据权限 - * @param where - * 当前查询条件 - * @return 构建后查询条件 - */ - private Expression buildDataScopeFilter(LoginUser user, DataPermission dataPermission, Expression where) { - Expression expression = null; - String tableAlias = dataPermission.tableAlias(); - String id = dataPermission.id(); - String deptId = dataPermission.deptId(); - for (RoleDTO role : user.getRoles()) { - DataScopeEnum dataScope = role.getDataScope(); - if (DataScopeEnum.ALL.equals(dataScope)) { - return where; - } - if (DataScopeEnum.DEPT_AND_CHILD.equals(dataScope)) { - // select t1.* from table as t1 where t1.`dept_id` in (select `id` from `sys_dept` where `id` = xxx or - // find_in_set(xxx, `ancestors`)); - // 构建子查询 - SubSelect subSelect = new SubSelect(); - PlainSelect select = new PlainSelect(); - select.setSelectItems(Collections.singletonList(new SelectExpressionItem(new Column(id)))); - select.setFromItem(new Table(dataPermission.deptTableAlias())); - EqualsTo equalsTo = new EqualsTo(); - equalsTo.setLeftExpression(new Column(id)); - equalsTo.setRightExpression(new LongValue(user.getDeptId())); - Function function = new Function(); - function.setName("find_in_set"); - function.setParameters(new ExpressionList(new LongValue(user.getDeptId()), new Column("ancestors"))); - select.setWhere(new OrExpression(equalsTo, function)); - subSelect.setSelectBody(select); - // 构建父查询 - InExpression inExpression = new InExpression(); - inExpression.setLeftExpression(this.buildColumn(tableAlias, deptId)); - inExpression.setRightExpression(subSelect); - expression = null != expression ? new OrExpression(expression, inExpression) : inExpression; - } else if (DataScopeEnum.DEPT.equals(dataScope)) { - // select t1.* from table as t1 where t1.`dept_id` = xxx; - EqualsTo equalsTo = new EqualsTo(); - equalsTo.setLeftExpression(this.buildColumn(tableAlias, deptId)); - equalsTo.setRightExpression(new LongValue(user.getDeptId())); - expression = null != expression ? new OrExpression(expression, equalsTo) : equalsTo; - } else if (DataScopeEnum.SELF.equals(dataScope)) { - // select t1.* from table as t1 where t1.`create_user` = xxx; - EqualsTo equalsTo = new EqualsTo(); - equalsTo.setLeftExpression(this.buildColumn(tableAlias, dataPermission.userId())); - equalsTo.setRightExpression(new LongValue(user.getId())); - expression = null != expression ? new OrExpression(expression, equalsTo) : equalsTo; - } else if (DataScopeEnum.CUSTOM.equals(dataScope)) { - // select t1.* from table as t1 where t1.`dept_id` in (select `dept_id` from `sys_role_dept` where - // `role_id` = xxx); - // 构建子查询 - SubSelect subSelect = new SubSelect(); - PlainSelect select = new PlainSelect(); - select.setSelectItems(Collections.singletonList(new SelectExpressionItem(new Column(deptId)))); - select.setFromItem(new Table(dataPermission.roleDeptTableAlias())); - EqualsTo equalsTo = new EqualsTo(); - equalsTo.setLeftExpression(new Column(dataPermission.roleId())); - equalsTo.setRightExpression(new LongValue(role.getId())); - select.setWhere(equalsTo); - subSelect.setSelectBody(select); - // 构建父查询 - InExpression inExpression = new InExpression(); - inExpression.setLeftExpression(this.buildColumn(tableAlias, deptId)); - inExpression.setRightExpression(subSelect); - expression = null != expression ? new OrExpression(expression, inExpression) : inExpression; - } - } - return null != where ? new AndExpression(where, new Parenthesis(expression)) : expression; - } - - /** - * 构建 Column - * - * @param tableAlias - * 表别名 - * @param columnName - * 字段名称 - * @return 带表别名字段 - */ - private Column buildColumn(String tableAlias, String columnName) { - if (StringUtils.isNotEmpty(tableAlias)) { - columnName = String.format("%s.%s", tableAlias, columnName); - } - return new Column(columnName); - } -} diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/base/DataPermissionMapper.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/mybatis/DataPermissionMapper.java similarity index 85% rename from continew-admin-common/src/main/java/top/charles7c/continew/admin/common/base/DataPermissionMapper.java rename to continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/mybatis/DataPermissionMapper.java index 2a5e82c4..46a2c688 100644 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/base/DataPermissionMapper.java +++ b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/mybatis/DataPermissionMapper.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package top.charles7c.continew.admin.common.base; +package top.charles7c.continew.admin.common.config.mybatis; import java.util.List; @@ -24,8 +24,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Constants; -import top.charles7c.continew.admin.common.annotation.DataPermission; -import top.charles7c.continew.starter.extension.crud.base.BaseMapper; +import top.charles7c.continew.starter.data.mybatis.plus.base.BaseMapper; +import top.charles7c.continew.starter.data.mybatis.plus.datapermission.DataPermission; /** * 数据权限 Mapper 基类 diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/mybatis/MybatisPlusConfiguration.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/mybatis/MybatisPlusConfiguration.java index ca1c4e7f..54905749 100644 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/mybatis/MybatisPlusConfiguration.java +++ b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/mybatis/MybatisPlusConfiguration.java @@ -21,6 +21,8 @@ import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; +import top.charles7c.continew.starter.data.mybatis.plus.datapermission.DataPermissionFilter; + /** * MyBatis Plus 配置 * @@ -37,4 +39,12 @@ public class MybatisPlusConfiguration { public MetaObjectHandler metaObjectHandler() { return new MyBatisPlusMetaObjectHandler(); } + + /** + * 数据权限过滤器 + */ + @Bean + public DataPermissionFilter dataPermissionFilter() { + return new DataPermissionFilterImpl(); + } } diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/model/dto/LogContext.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/model/dto/LogContext.java deleted file mode 100644 index ec38c54d..00000000 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/model/dto/LogContext.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package top.charles7c.continew.admin.common.model.dto; - -import java.io.Serial; -import java.io.Serializable; -import java.time.LocalDateTime; - -import lombok.Data; - -/** - * 系统日志上下文 - * - * @author Charles7c - * @since 2022/12/25 8:59 - */ -@Data -public class LogContext implements Serializable { - - @Serial - private static final long serialVersionUID = 1L; - - /** - * 创建人 - */ - private Long createUser; - - /** - * 创建时间 - */ - private LocalDateTime createTime; - - /** - * 错误信息 - */ - private String errorMsg; - - /** - * 异常信息 - */ - private Throwable exception; -} diff --git a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/mapper/LogMapper.java b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/mapper/LogMapper.java index caebbcfe..324b94f1 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/mapper/LogMapper.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/mapper/LogMapper.java @@ -25,7 +25,7 @@ import top.charles7c.continew.admin.monitor.model.resp.DashboardAccessTrendResp; import top.charles7c.continew.admin.monitor.model.resp.DashboardPopularModuleResp; import top.charles7c.continew.admin.monitor.model.resp.DashboardTotalResp; -import top.charles7c.continew.starter.extension.crud.base.BaseMapper; +import top.charles7c.continew.starter.data.mybatis.plus.base.BaseMapper; /** * 系统日志 Mapper diff --git a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/query/LoginLogQuery.java b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/query/LoginLogQuery.java index 1cd08e24..27650a77 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/query/LoginLogQuery.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/query/LoginLogQuery.java @@ -29,8 +29,8 @@ import cn.hutool.core.date.DatePattern; -import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; -import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryType; +import top.charles7c.continew.starter.data.mybatis.plus.query.Query; +import top.charles7c.continew.starter.data.mybatis.plus.query.QueryType; /** * 登录日志查询条件 diff --git a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/query/OperationLogQuery.java b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/query/OperationLogQuery.java index 51d24a25..a60f4ac8 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/query/OperationLogQuery.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/query/OperationLogQuery.java @@ -29,8 +29,8 @@ import cn.hutool.core.date.DatePattern; -import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; -import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryType; +import top.charles7c.continew.starter.data.mybatis.plus.query.Query; +import top.charles7c.continew.starter.data.mybatis.plus.query.QueryType; /** * 操作日志查询条件 diff --git a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/query/SystemLogQuery.java b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/query/SystemLogQuery.java index 663755e3..3be705fb 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/query/SystemLogQuery.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/query/SystemLogQuery.java @@ -29,8 +29,8 @@ import cn.hutool.core.date.DatePattern; -import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; -import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryType; +import top.charles7c.continew.starter.data.mybatis.plus.query.Query; +import top.charles7c.continew.starter.data.mybatis.plus.query.QueryType; /** * 系统日志查询条件 diff --git a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/service/impl/LogServiceImpl.java b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/service/impl/LogServiceImpl.java index 6241716c..c3482229 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/service/impl/LogServiceImpl.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/service/impl/LogServiceImpl.java @@ -42,7 +42,7 @@ import top.charles7c.continew.starter.core.util.ExceptionUtils; import top.charles7c.continew.starter.core.util.ReflectUtils; import top.charles7c.continew.starter.core.util.validate.CheckUtils; -import top.charles7c.continew.starter.data.mybatis.plus.util.QueryHelper; +import top.charles7c.continew.starter.data.mybatis.plus.query.QueryHelper; import top.charles7c.continew.starter.extension.crud.base.CommonUserService; import top.charles7c.continew.starter.extension.crud.model.query.PageQuery; import top.charles7c.continew.starter.extension.crud.model.resp.PageDataResp; diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/AnnouncementMapper.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/AnnouncementMapper.java index 49f7160c..375e84f1 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/AnnouncementMapper.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/AnnouncementMapper.java @@ -20,7 +20,7 @@ import top.charles7c.continew.admin.system.model.entity.AnnouncementDO; import top.charles7c.continew.admin.system.model.resp.DashboardAnnouncementResp; -import top.charles7c.continew.starter.extension.crud.base.BaseMapper; +import top.charles7c.continew.starter.data.mybatis.plus.base.BaseMapper; /** * 公告 Mapper diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/DeptMapper.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/DeptMapper.java index 7081a165..b4819ebd 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/DeptMapper.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/DeptMapper.java @@ -17,7 +17,7 @@ package top.charles7c.continew.admin.system.mapper; import top.charles7c.continew.admin.system.model.entity.DeptDO; -import top.charles7c.continew.starter.extension.crud.base.BaseMapper; +import top.charles7c.continew.starter.data.mybatis.plus.base.BaseMapper; /** * 部门 Mapper diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/DictItemMapper.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/DictItemMapper.java index 3c22e697..97fbe27c 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/DictItemMapper.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/DictItemMapper.java @@ -22,7 +22,7 @@ import top.charles7c.continew.admin.common.model.resp.LabelValueResp; import top.charles7c.continew.admin.system.model.entity.DictItemDO; -import top.charles7c.continew.starter.extension.crud.base.BaseMapper; +import top.charles7c.continew.starter.data.mybatis.plus.base.BaseMapper; /** * 字典项 Mapper diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/DictMapper.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/DictMapper.java index 9f10af9a..2e53650f 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/DictMapper.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/DictMapper.java @@ -17,7 +17,7 @@ package top.charles7c.continew.admin.system.mapper; import top.charles7c.continew.admin.system.model.entity.DictDO; -import top.charles7c.continew.starter.extension.crud.base.BaseMapper; +import top.charles7c.continew.starter.data.mybatis.plus.base.BaseMapper; /** * 字典 Mapper diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/MenuMapper.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/MenuMapper.java index 0c21ec0a..fd26c79f 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/MenuMapper.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/MenuMapper.java @@ -22,7 +22,7 @@ import org.apache.ibatis.annotations.Param; import top.charles7c.continew.admin.system.model.entity.MenuDO; -import top.charles7c.continew.starter.extension.crud.base.BaseMapper; +import top.charles7c.continew.starter.data.mybatis.plus.base.BaseMapper; /** * 菜单 Mapper diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/MessageMapper.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/MessageMapper.java index 1eaf234c..b0700bc1 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/MessageMapper.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/MessageMapper.java @@ -24,7 +24,7 @@ import top.charles7c.continew.admin.system.model.entity.MessageDO; import top.charles7c.continew.admin.system.model.resp.MessageResp; -import top.charles7c.continew.starter.extension.crud.base.BaseMapper; +import top.charles7c.continew.starter.data.mybatis.plus.base.BaseMapper; /** * 消息 Mapper diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/MessageUserMapper.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/MessageUserMapper.java index 7327d42f..ee1b34c2 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/MessageUserMapper.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/MessageUserMapper.java @@ -19,7 +19,7 @@ import org.apache.ibatis.annotations.Param; import top.charles7c.continew.admin.system.model.entity.MessageUserDO; -import top.charles7c.continew.starter.extension.crud.base.BaseMapper; +import top.charles7c.continew.starter.data.mybatis.plus.base.BaseMapper; /** * 消息和用户 Mapper diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/OptionMapper.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/OptionMapper.java index 0ed0dcf3..82171102 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/OptionMapper.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/OptionMapper.java @@ -17,7 +17,7 @@ package top.charles7c.continew.admin.system.mapper; import top.charles7c.continew.admin.system.model.entity.OptionDO; -import top.charles7c.continew.starter.extension.crud.base.BaseMapper; +import top.charles7c.continew.starter.data.mybatis.plus.base.BaseMapper; /** * 参数 Mapper diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/RoleDeptMapper.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/RoleDeptMapper.java index 5a94d519..32238858 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/RoleDeptMapper.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/RoleDeptMapper.java @@ -22,7 +22,7 @@ import org.apache.ibatis.annotations.Select; import top.charles7c.continew.admin.system.model.entity.RoleDeptDO; -import top.charles7c.continew.starter.extension.crud.base.BaseMapper; +import top.charles7c.continew.starter.data.mybatis.plus.base.BaseMapper; /** * 角色和部门 Mapper diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/RoleMapper.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/RoleMapper.java index 5010b773..d58c67f1 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/RoleMapper.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/RoleMapper.java @@ -17,7 +17,7 @@ package top.charles7c.continew.admin.system.mapper; import top.charles7c.continew.admin.system.model.entity.RoleDO; -import top.charles7c.continew.starter.extension.crud.base.BaseMapper; +import top.charles7c.continew.starter.data.mybatis.plus.base.BaseMapper; /** * 角色 Mapper diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/RoleMenuMapper.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/RoleMenuMapper.java index 38bb4f24..14a2bb80 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/RoleMenuMapper.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/RoleMenuMapper.java @@ -19,7 +19,7 @@ import java.util.List; import top.charles7c.continew.admin.system.model.entity.RoleMenuDO; -import top.charles7c.continew.starter.extension.crud.base.BaseMapper; +import top.charles7c.continew.starter.data.mybatis.plus.base.BaseMapper; /** * 角色和菜单 Mapper diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/UserMapper.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/UserMapper.java index 67180ac2..eaab379a 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/UserMapper.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/UserMapper.java @@ -19,7 +19,7 @@ import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; -import top.charles7c.continew.admin.common.base.DataPermissionMapper; +import top.charles7c.continew.admin.common.config.mybatis.DataPermissionMapper; import top.charles7c.continew.admin.system.model.entity.UserDO; /** diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/UserRoleMapper.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/UserRoleMapper.java index c2291fa8..4468082d 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/UserRoleMapper.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/UserRoleMapper.java @@ -22,7 +22,7 @@ import org.apache.ibatis.annotations.Select; import top.charles7c.continew.admin.system.model.entity.UserRoleDO; -import top.charles7c.continew.starter.extension.crud.base.BaseMapper; +import top.charles7c.continew.starter.data.mybatis.plus.base.BaseMapper; /** * 用户和角色 Mapper diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/UserSocialMapper.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/UserSocialMapper.java index 1f2fcbea..ec7b0daa 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/UserSocialMapper.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/UserSocialMapper.java @@ -19,7 +19,7 @@ import org.apache.ibatis.annotations.Param; import top.charles7c.continew.admin.system.model.entity.UserSocialDO; -import top.charles7c.continew.starter.extension.crud.base.BaseMapper; +import top.charles7c.continew.starter.data.mybatis.plus.base.BaseMapper; /** * 用户社会化关联 Mapper diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/AnnouncementQuery.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/AnnouncementQuery.java index 4a5a3b89..92df7fda 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/AnnouncementQuery.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/AnnouncementQuery.java @@ -23,8 +23,8 @@ import io.swagger.v3.oas.annotations.media.Schema; -import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; -import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryType; +import top.charles7c.continew.starter.data.mybatis.plus.query.Query; +import top.charles7c.continew.starter.data.mybatis.plus.query.QueryType; /** * 公告查询条件 diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/DeptQuery.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/DeptQuery.java index 0426e5be..5bf0c925 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/DeptQuery.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/DeptQuery.java @@ -23,8 +23,8 @@ import io.swagger.v3.oas.annotations.media.Schema; -import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; -import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryType; +import top.charles7c.continew.starter.data.mybatis.plus.query.Query; +import top.charles7c.continew.starter.data.mybatis.plus.query.QueryType; /** * 部门查询条件 diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/DictItemQuery.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/DictItemQuery.java index 1b9a5ce9..d25de8ca 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/DictItemQuery.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/DictItemQuery.java @@ -23,7 +23,7 @@ import io.swagger.v3.oas.annotations.media.Schema; -import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; +import top.charles7c.continew.starter.data.mybatis.plus.query.Query; /** * 字典项查询条件 diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/DictQuery.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/DictQuery.java index 4a335f35..ce3f94d4 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/DictQuery.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/DictQuery.java @@ -23,7 +23,7 @@ import io.swagger.v3.oas.annotations.media.Schema; -import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; +import top.charles7c.continew.starter.data.mybatis.plus.query.Query; /** * 字典查询条件 diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/MenuQuery.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/MenuQuery.java index 7ff6b609..284b42e7 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/MenuQuery.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/MenuQuery.java @@ -23,8 +23,8 @@ import io.swagger.v3.oas.annotations.media.Schema; -import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; -import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryType; +import top.charles7c.continew.starter.data.mybatis.plus.query.Query; +import top.charles7c.continew.starter.data.mybatis.plus.query.QueryType; /** * 菜单查询条件 diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/MessageQuery.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/MessageQuery.java index d5299181..1ddd2d2c 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/MessageQuery.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/MessageQuery.java @@ -22,8 +22,8 @@ import io.swagger.v3.oas.annotations.media.Schema; -import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; -import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryType; +import top.charles7c.continew.starter.data.mybatis.plus.query.Query; +import top.charles7c.continew.starter.data.mybatis.plus.query.QueryType; /** * 消息查询条件 diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/OptionQuery.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/OptionQuery.java index aa4a70e8..86aa9df1 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/OptionQuery.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/OptionQuery.java @@ -26,8 +26,8 @@ import io.swagger.v3.oas.annotations.media.Schema; -import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; -import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryType; +import top.charles7c.continew.starter.data.mybatis.plus.query.Query; +import top.charles7c.continew.starter.data.mybatis.plus.query.QueryType; /** * 参数查询条件 diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/RoleQuery.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/RoleQuery.java index 8ce3b9fb..1ada6ff8 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/RoleQuery.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/RoleQuery.java @@ -23,7 +23,7 @@ import io.swagger.v3.oas.annotations.media.Schema; -import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; +import top.charles7c.continew.starter.data.mybatis.plus.query.Query; /** * 角色查询条件 diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/UserQuery.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/UserQuery.java index 25eed4ce..a59ddbbe 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/UserQuery.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/UserQuery.java @@ -29,8 +29,8 @@ import cn.hutool.core.date.DatePattern; -import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; -import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryType; +import top.charles7c.continew.starter.data.mybatis.plus.query.Query; +import top.charles7c.continew.starter.data.mybatis.plus.query.QueryType; /** * 用户查询条件 diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/MessageServiceImpl.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/MessageServiceImpl.java index 3ba6dbbd..1451479f 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/MessageServiceImpl.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/MessageServiceImpl.java @@ -39,7 +39,7 @@ import top.charles7c.continew.admin.system.service.MessageUserService; import top.charles7c.continew.starter.core.util.ExceptionUtils; import top.charles7c.continew.starter.core.util.validate.CheckUtils; -import top.charles7c.continew.starter.data.mybatis.plus.util.QueryHelper; +import top.charles7c.continew.starter.data.mybatis.plus.query.QueryHelper; import top.charles7c.continew.starter.extension.crud.base.CommonUserService; import top.charles7c.continew.starter.extension.crud.model.query.PageQuery; import top.charles7c.continew.starter.extension.crud.model.resp.PageDataResp; diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/OptionServiceImpl.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/OptionServiceImpl.java index 30cd9b6c..4abc27ce 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/OptionServiceImpl.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/OptionServiceImpl.java @@ -34,7 +34,7 @@ import top.charles7c.continew.admin.system.model.req.OptionResetValueReq; import top.charles7c.continew.admin.system.model.resp.OptionResp; import top.charles7c.continew.admin.system.service.OptionService; -import top.charles7c.continew.starter.data.mybatis.plus.util.QueryHelper; +import top.charles7c.continew.starter.data.mybatis.plus.query.QueryHelper; /** * 参数业务实现 diff --git a/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/mapper/FieldConfigMapper.java b/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/mapper/FieldConfigMapper.java index 209b93cc..44d8e354 100644 --- a/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/mapper/FieldConfigMapper.java +++ b/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/mapper/FieldConfigMapper.java @@ -22,7 +22,7 @@ import org.apache.ibatis.annotations.Select; import top.charles7c.continew.admin.tool.model.entity.FieldConfigDO; -import top.charles7c.continew.starter.extension.crud.base.BaseMapper; +import top.charles7c.continew.starter.data.mybatis.plus.base.BaseMapper; /** * 字段配置 Mapper diff --git a/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/mapper/GenConfigMapper.java b/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/mapper/GenConfigMapper.java index 0472dc97..1c8a9dac 100644 --- a/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/mapper/GenConfigMapper.java +++ b/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/mapper/GenConfigMapper.java @@ -17,7 +17,7 @@ package top.charles7c.continew.admin.tool.mapper; import top.charles7c.continew.admin.tool.model.entity.GenConfigDO; -import top.charles7c.continew.starter.extension.crud.base.BaseMapper; +import top.charles7c.continew.starter.data.mybatis.plus.base.BaseMapper; /** * 生成配置 Mapper diff --git a/continew-admin-tool/src/main/resources/templates/generator/Mapper.ftl b/continew-admin-tool/src/main/resources/templates/generator/Mapper.ftl index 92d5145a..6f0b5968 100644 --- a/continew-admin-tool/src/main/resources/templates/generator/Mapper.ftl +++ b/continew-admin-tool/src/main/resources/templates/generator/Mapper.ftl @@ -1,6 +1,6 @@ package ${packageName}.${subPackageName}; -import top.charles7c.continew.starter.extension.crud.base.BaseMapper; +import top.charles7c.continew.starter.data.mybatis.plus.base.BaseMapper; import ${packageName}.model.entity.${classNamePrefix}DO; /** diff --git a/continew-admin-tool/src/main/resources/templates/generator/Query.ftl b/continew-admin-tool/src/main/resources/templates/generator/Query.ftl index 1be09674..f0039284 100644 --- a/continew-admin-tool/src/main/resources/templates/generator/Query.ftl +++ b/continew-admin-tool/src/main/resources/templates/generator/Query.ftl @@ -16,8 +16,8 @@ import lombok.Data; import io.swagger.v3.oas.annotations.media.Schema; -import top.charles7c.continew.starter.data.mybatis.plus.annotation.Query; -import top.charles7c.continew.starter.data.mybatis.plus.enums.QueryType; +import top.charles7c.continew.starter.data.mybatis.plus.query.Query; +import top.charles7c.continew.starter.data.mybatis.plus.query.QueryType; /** * ${businessName}查询条件 diff --git a/continew-admin-webapi/src/main/resources/config/application.yml b/continew-admin-webapi/src/main/resources/config/application.yml index e26a0d53..548d890a 100644 --- a/continew-admin-webapi/src/main/resources/config/application.yml +++ b/continew-admin-webapi/src/main/resources/config/application.yml @@ -147,8 +147,9 @@ mybatis-plus: enabled: true # Mapper 接口扫描包配置 mapper-package: ${project.base-package}.**.mapper - # 数据权限实现 - data-permission-handler-impl: top.charles7c.continew.admin.common.config.mybatis.DataPermissionHandlerImpl + # 数据权限配置 + data-permission: + enabled: true # 分页插件配置 pagination: enabled: true From e6c6e1cb0e326c5f531ca5cb2e17a1e26efac7d9 Mon Sep 17 00:00:00 2001 From: Charles7c Date: Fri, 22 Dec 2023 21:09:13 +0800 Subject: [PATCH 20/49] =?UTF-8?q?refactor:=20=E8=B0=83=E6=95=B4=20IBaseEnu?= =?UTF-8?q?m=20=E6=89=80=E5=B1=9E=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/common/config/easyexcel/ExcelBaseEnumConverter.java | 2 +- .../admin/common/config/jackson/BaseEnumDeserializer.java | 2 +- .../admin/common/config/jackson/BaseEnumSerializer.java | 2 +- .../admin/common/config/jackson/JacksonConfiguration.java | 2 +- .../charles7c/continew/admin/common/enums/DataScopeEnum.java | 2 +- .../continew/admin/common/enums/DisEnableStatusEnum.java | 2 +- .../top/charles7c/continew/admin/common/enums/GenderEnum.java | 2 +- .../top/charles7c/continew/admin/common/enums/MenuTypeEnum.java | 2 +- .../charles7c/continew/admin/common/enums/MessageTypeEnum.java | 2 +- .../continew/admin/common/enums/SuccessFailureStatusEnum.java | 2 +- .../charles7c/continew/admin/monitor/enums/LogStatusEnum.java | 2 +- .../continew/admin/system/enums/AnnouncementStatusEnum.java | 2 +- .../top/charles7c/continew/admin/tool/enums/FormTypeEnum.java | 2 +- .../top/charles7c/continew/admin/tool/enums/QueryTypeEnum.java | 2 +- .../continew/admin/webapi/common/CommonController.java | 2 +- 15 files changed, 15 insertions(+), 15 deletions(-) diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/easyexcel/ExcelBaseEnumConverter.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/easyexcel/ExcelBaseEnumConverter.java index fdafc115..53030a74 100644 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/easyexcel/ExcelBaseEnumConverter.java +++ b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/easyexcel/ExcelBaseEnumConverter.java @@ -27,7 +27,7 @@ import cn.hutool.core.util.ClassUtil; import top.charles7c.continew.starter.core.constant.StringConstants; -import top.charles7c.continew.starter.data.mybatis.plus.enums.IBaseEnum; +import top.charles7c.continew.starter.data.mybatis.plus.base.IBaseEnum; /** * Easy Excel 枚举接口转换器 diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/BaseEnumDeserializer.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/BaseEnumDeserializer.java index 301dc91a..f4aad395 100644 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/BaseEnumDeserializer.java +++ b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/BaseEnumDeserializer.java @@ -27,7 +27,7 @@ import cn.hutool.core.util.ClassUtil; import cn.hutool.core.util.ReflectUtil; -import top.charles7c.continew.starter.data.mybatis.plus.enums.IBaseEnum; +import top.charles7c.continew.starter.data.mybatis.plus.base.IBaseEnum; /** * 通用枚举接口 IBaseEnum 反序列化器 diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/BaseEnumSerializer.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/BaseEnumSerializer.java index 06f369b4..d8181618 100644 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/BaseEnumSerializer.java +++ b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/BaseEnumSerializer.java @@ -23,7 +23,7 @@ import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.annotation.JacksonStdImpl; -import top.charles7c.continew.starter.data.mybatis.plus.enums.IBaseEnum; +import top.charles7c.continew.starter.data.mybatis.plus.base.IBaseEnum; /** * 通用枚举接口 IBaseEnum 序列化器 diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/JacksonConfiguration.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/JacksonConfiguration.java index cdd06d39..6c1494af 100644 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/JacksonConfiguration.java +++ b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/config/jackson/JacksonConfiguration.java @@ -25,7 +25,7 @@ import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.module.SimpleModule; -import top.charles7c.continew.starter.data.mybatis.plus.enums.IBaseEnum; +import top.charles7c.continew.starter.data.mybatis.plus.base.IBaseEnum; /** * Jackson 配置 diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/DataScopeEnum.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/DataScopeEnum.java index c9081d37..96c6c326 100644 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/DataScopeEnum.java +++ b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/DataScopeEnum.java @@ -19,7 +19,7 @@ import lombok.Getter; import lombok.RequiredArgsConstructor; -import top.charles7c.continew.starter.data.mybatis.plus.enums.IBaseEnum; +import top.charles7c.continew.starter.data.mybatis.plus.base.IBaseEnum; /** * 数据权限枚举 diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/DisEnableStatusEnum.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/DisEnableStatusEnum.java index 6946f5e3..fb705ffc 100644 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/DisEnableStatusEnum.java +++ b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/DisEnableStatusEnum.java @@ -20,7 +20,7 @@ import lombok.RequiredArgsConstructor; import top.charles7c.continew.admin.common.constant.UIConstants; -import top.charles7c.continew.starter.data.mybatis.plus.enums.IBaseEnum; +import top.charles7c.continew.starter.data.mybatis.plus.base.IBaseEnum; /** * 启用/禁用状态枚举 diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/GenderEnum.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/GenderEnum.java index 345e2a2e..727c3eec 100644 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/GenderEnum.java +++ b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/GenderEnum.java @@ -19,7 +19,7 @@ import lombok.Getter; import lombok.RequiredArgsConstructor; -import top.charles7c.continew.starter.data.mybatis.plus.enums.IBaseEnum; +import top.charles7c.continew.starter.data.mybatis.plus.base.IBaseEnum; /** * 性别枚举 diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/MenuTypeEnum.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/MenuTypeEnum.java index 19655d57..8f7dba03 100644 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/MenuTypeEnum.java +++ b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/MenuTypeEnum.java @@ -19,7 +19,7 @@ import lombok.Getter; import lombok.RequiredArgsConstructor; -import top.charles7c.continew.starter.data.mybatis.plus.enums.IBaseEnum; +import top.charles7c.continew.starter.data.mybatis.plus.base.IBaseEnum; /** * 菜单类型枚举 diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/MessageTypeEnum.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/MessageTypeEnum.java index 46ff50de..3c771a80 100644 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/MessageTypeEnum.java +++ b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/MessageTypeEnum.java @@ -20,7 +20,7 @@ import lombok.RequiredArgsConstructor; import top.charles7c.continew.admin.common.constant.UIConstants; -import top.charles7c.continew.starter.data.mybatis.plus.enums.IBaseEnum; +import top.charles7c.continew.starter.data.mybatis.plus.base.IBaseEnum; /** * 消息类型枚举 diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/SuccessFailureStatusEnum.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/SuccessFailureStatusEnum.java index 1ddeed6e..1e75d534 100644 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/SuccessFailureStatusEnum.java +++ b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/enums/SuccessFailureStatusEnum.java @@ -20,7 +20,7 @@ import lombok.RequiredArgsConstructor; import top.charles7c.continew.admin.common.constant.UIConstants; -import top.charles7c.continew.starter.data.mybatis.plus.enums.IBaseEnum; +import top.charles7c.continew.starter.data.mybatis.plus.base.IBaseEnum; /** * 成功/失败状态枚举 diff --git a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/enums/LogStatusEnum.java b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/enums/LogStatusEnum.java index d64aac00..b340d8f0 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/enums/LogStatusEnum.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/enums/LogStatusEnum.java @@ -19,7 +19,7 @@ import lombok.Getter; import lombok.RequiredArgsConstructor; -import top.charles7c.continew.starter.data.mybatis.plus.enums.IBaseEnum; +import top.charles7c.continew.starter.data.mybatis.plus.base.IBaseEnum; /** * 操作状态枚举 diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/enums/AnnouncementStatusEnum.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/enums/AnnouncementStatusEnum.java index 3fb4e3f0..99b65199 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/enums/AnnouncementStatusEnum.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/enums/AnnouncementStatusEnum.java @@ -20,7 +20,7 @@ import lombok.RequiredArgsConstructor; import top.charles7c.continew.admin.common.constant.UIConstants; -import top.charles7c.continew.starter.data.mybatis.plus.enums.IBaseEnum; +import top.charles7c.continew.starter.data.mybatis.plus.base.IBaseEnum; /** * 公告状态枚举 diff --git a/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/enums/FormTypeEnum.java b/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/enums/FormTypeEnum.java index 7a71451c..a9e8febc 100644 --- a/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/enums/FormTypeEnum.java +++ b/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/enums/FormTypeEnum.java @@ -19,7 +19,7 @@ import lombok.Getter; import lombok.RequiredArgsConstructor; -import top.charles7c.continew.starter.data.mybatis.plus.enums.IBaseEnum; +import top.charles7c.continew.starter.data.mybatis.plus.base.IBaseEnum; /** * 表单类型枚举 diff --git a/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/enums/QueryTypeEnum.java b/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/enums/QueryTypeEnum.java index 0ab47508..25fda1a0 100644 --- a/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/enums/QueryTypeEnum.java +++ b/continew-admin-tool/src/main/java/top/charles7c/continew/admin/tool/enums/QueryTypeEnum.java @@ -19,7 +19,7 @@ import lombok.Getter; import lombok.RequiredArgsConstructor; -import top.charles7c.continew.starter.data.mybatis.plus.enums.IBaseEnum; +import top.charles7c.continew.starter.data.mybatis.plus.base.IBaseEnum; /** * 查询类型枚举 diff --git a/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/common/CommonController.java b/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/common/CommonController.java index 429fd986..b61eb23d 100644 --- a/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/common/CommonController.java +++ b/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/common/CommonController.java @@ -55,7 +55,7 @@ import top.charles7c.continew.starter.core.util.FileUploadUtils; import top.charles7c.continew.starter.core.util.validate.CheckUtils; import top.charles7c.continew.starter.core.util.validate.ValidationUtils; -import top.charles7c.continew.starter.data.mybatis.plus.enums.IBaseEnum; +import top.charles7c.continew.starter.data.mybatis.plus.base.IBaseEnum; import top.charles7c.continew.starter.extension.crud.model.query.SortQuery; import top.charles7c.continew.starter.extension.crud.model.resp.R; import top.charles7c.continew.starter.log.common.annotation.Log; From 4df887d82678ced0d30aa0c7a6f92edcac902052 Mon Sep 17 00:00:00 2001 From: Charles7c Date: Fri, 22 Dec 2023 21:12:42 +0800 Subject: [PATCH 21/49] =?UTF-8?q?refactor:=20=E4=BC=98=E5=8C=96=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E8=AE=BF=E5=AE=A2=E5=9C=B0=E5=9F=9F=E5=88=86=E5=B8=83?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E6=8E=A5=E5=8F=A3=20SQL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/LogMapper.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/continew-admin-monitor/src/main/resources/mapper/LogMapper.xml b/continew-admin-monitor/src/main/resources/mapper/LogMapper.xml index 01994f5f..e8b2b467 100644 --- a/continew-admin-monitor/src/main/resources/mapper/LogMapper.xml +++ b/continew-admin-monitor/src/main/resources/mapper/LogMapper.xml @@ -38,10 +38,10 @@ From ac4283679a847ed372db28aae1ea05fd791651b8 Mon Sep 17 00:00:00 2001 From: Charles7c Date: Fri, 22 Dec 2023 21:20:25 +0800 Subject: [PATCH 22/49] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=E4=BB=AA?= =?UTF-8?q?=E8=A1=A8=E7=9B=98=E5=B8=AE=E5=8A=A9=E6=96=87=E6=A1=A3=E9=83=A8?= =?UTF-8?q?=E5=88=86=E8=BF=87=E6=9C=9F=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/dashboard/workplace/components/docs.vue | 10 +++++----- .../src/views/dashboard/workplace/locale/en-US.ts | 2 +- .../src/views/dashboard/workplace/locale/zh-CN.ts | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/continew-admin-ui/src/views/dashboard/workplace/components/docs.vue b/continew-admin-ui/src/views/dashboard/workplace/components/docs.vue index 0bd44abd..7f08e71c 100644 --- a/continew-admin-ui/src/views/dashboard/workplace/components/docs.vue +++ b/continew-admin-ui/src/views/dashboard/workplace/components/docs.vue @@ -14,7 +14,7 @@ @@ -23,7 +23,7 @@ @@ -41,7 +41,7 @@ @@ -50,11 +50,11 @@ - {{ $t('workplace.docs.require') }}✨ + {{ $t('workplace.docs.continewStarter') }}📦 diff --git a/continew-admin-ui/src/views/dashboard/workplace/locale/en-US.ts b/continew-admin-ui/src/views/dashboard/workplace/locale/en-US.ts index 7ff9b848..40d07781 100644 --- a/continew-admin-ui/src/views/dashboard/workplace/locale/en-US.ts +++ b/continew-admin-ui/src/views/dashboard/workplace/locale/en-US.ts @@ -14,7 +14,7 @@ export default { 'workplace.docs.userGuide': 'User Guide', 'workplace.docs.faq': 'FAQ', 'workplace.docs.changelog': 'Change Log', - 'workplace.docs.require': 'Require', + 'workplace.docs.continewStarter': 'Starter', 'workplace.docs.authorSite': 'Author Site', 'workplace.announcement': 'Announcement', 'workplace.recently.visited': 'Recently Visited', diff --git a/continew-admin-ui/src/views/dashboard/workplace/locale/zh-CN.ts b/continew-admin-ui/src/views/dashboard/workplace/locale/zh-CN.ts index d4ba67b3..90c8ae4c 100644 --- a/continew-admin-ui/src/views/dashboard/workplace/locale/zh-CN.ts +++ b/continew-admin-ui/src/views/dashboard/workplace/locale/zh-CN.ts @@ -14,7 +14,7 @@ export default { 'workplace.docs.userGuide': '使用指南', 'workplace.docs.faq': '常见问题', 'workplace.docs.changelog': '更新日志', - 'workplace.docs.require': '需求墙', + 'workplace.docs.continewStarter': 'Starter组件', 'workplace.docs.authorSite': '作者主页', 'workplace.announcement': '公告', 'workplace.recently.visited': '最近访问', From fd0e05f95a1146fd2e080094f63c7bb2b494f0dc Mon Sep 17 00:00:00 2001 From: Charles7c Date: Fri, 22 Dec 2023 21:58:07 +0800 Subject: [PATCH 23/49] =?UTF-8?q?refactor:=20=E4=BC=98=E5=8C=96=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E6=97=A5=E5=BF=97=E4=BF=A1=E6=81=AF=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1.简化记录 request_url 2.优化记录操作人信息 --- .../admin/monitor/config/LogDaoLocalImpl.java | 19 ++++++++++++------- .../model/resp/SystemLogDetailResp.java | 2 +- .../monitor/model/resp/SystemLogResp.java | 2 +- .../src/views/monitor/log/system/index.vue | 4 +--- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/config/LogDaoLocalImpl.java b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/config/LogDaoLocalImpl.java index 915cf905..f09f711c 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/config/LogDaoLocalImpl.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/config/LogDaoLocalImpl.java @@ -16,6 +16,7 @@ package top.charles7c.continew.admin.monitor.config; +import java.net.URI; import java.time.LocalDateTime; import java.time.ZoneId; import java.util.List; @@ -73,7 +74,11 @@ public void add(LogRecord logRecord) { // 请求信息 LogRequest logRequest = logRecord.getRequest(); logDO.setRequestMethod(logRequest.getMethod()); - String requestUrl = logRequest.getUri().toString(); + // 仅记录:/xxx?xx=xx&xx=xx + URI requestUri = logRequest.getUri(); + String requestQuery = requestUri.getQuery(); + String requestUrl = StrUtil.isNotBlank(requestQuery) + ? requestUri.getPath() + StringConstants.QUESTION_MARK + requestQuery : requestUri.getPath(); logDO.setRequestUrl(requestUrl); Map> requestHeaders = logRequest.getHeaders(); logDO.setRequestHeaders(JSONUtil.toJsonStr(requestHeaders)); @@ -99,17 +104,17 @@ public void add(LogRecord logRecord) { logDO.setErrorMsg(result.getMsg()); } // 操作人 - if (StrUtil.contains(requestUrl, SysConstants.LOGOUT_URI)) { + if (requestUrl.startsWith(SysConstants.LOGOUT_URI)) { Long loginId = Convert.toLong(result.getData(), -1L); logDO.setCreateUser(-1 != loginId ? loginId : null); + } else if (result.isSuccess() && requestUrl.startsWith(SysConstants.LOGIN_URI)) { + AccountLoginReq loginReq = JSONUtil.toBean(requestBody, AccountLoginReq.class); + logDO.setCreateUser( + ExceptionUtils.exToNull(() -> userService.getByUsername(loginReq.getUsername()).getId())); } } // 操作人 - if (StrUtil.contains(requestUrl, SysConstants.LOGIN_URI)) { - AccountLoginReq loginReq = JSONUtil.toBean(requestBody, AccountLoginReq.class); - logDO.setCreateUser( - ExceptionUtils.exToNull(() -> userService.getByUsername(loginReq.getUsername()).getId())); - } else if (!StrUtil.contains(requestUrl, SysConstants.LOGOUT_URI) && MapUtil.isNotEmpty(requestHeaders) + if (!requestUrl.startsWith(SysConstants.LOGOUT_URI) && MapUtil.isNotEmpty(requestHeaders) && requestHeaders.containsKey(HttpHeaders.AUTHORIZATION)) { String authorization = requestHeaders.get(HttpHeaders.AUTHORIZATION).get(0); String token = authorization.replace(SaManager.getConfig().getTokenPrefix() + StringConstants.SPACE, diff --git a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/resp/SystemLogDetailResp.java b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/resp/SystemLogDetailResp.java index 05160e26..ca89a678 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/resp/SystemLogDetailResp.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/resp/SystemLogDetailResp.java @@ -50,7 +50,7 @@ public class SystemLogDetailResp extends LogResp { /** * 请求 URL */ - @Schema(description = "请求 URL", example = "http://api.charles7c.top/system/dept") + @Schema(description = "请求 URL", example = "/system/dept") private String requestUrl; /** diff --git a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/resp/SystemLogResp.java b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/resp/SystemLogResp.java index c0046436..949a7790 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/resp/SystemLogResp.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/continew/admin/monitor/model/resp/SystemLogResp.java @@ -50,7 +50,7 @@ public class SystemLogResp extends LogResp { /** * 请求 URL */ - @Schema(description = "请求 URL", example = "http://api.charles7c.top/system/dept") + @Schema(description = "请求 URL", example = "/system/dept") private String requestUrl; /** diff --git a/continew-admin-ui/src/views/monitor/log/system/index.vue b/continew-admin-ui/src/views/monitor/log/system/index.vue index bf042eeb..d1cd1bb2 100644 --- a/continew-admin-ui/src/views/monitor/log/system/index.vue +++ b/continew-admin-ui/src/views/monitor/log/system/index.vue @@ -68,9 +68,7 @@ From 4c24aea5605f2a69092ff2f8405a92da07043fe5 Mon Sep 17 00:00:00 2001 From: Charles7c Date: Sat, 23 Dec 2023 15:10:51 +0800 Subject: [PATCH 24/49] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E9=83=A8?= =?UTF-8?q?=E5=88=86=E6=96=87=E4=BB=B6=E7=AE=A1=E7=90=86=E5=90=8E=E7=AB=AF?= =?UTF-8?q?=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/system/enums/FileTypeEnum.java | 65 +++++++ .../admin/system/mapper/FileMapper.java | 28 +++ .../admin/system/model/entity/FileDO.java | 75 ++++++++ .../admin/system/model/query/FileQuery.java | 55 ++++++ .../admin/system/model/req/FileReq.java | 39 ++++ .../system/model/resp/FileDetailResp.java | 93 +++++++++ .../admin/system/model/resp/FileResp.java | 89 +++++++++ .../admin/system/service/FileService.java | 31 +++ .../system/service/impl/FileServiceImpl.java | 41 ++++ continew-admin-ui/src/api/system/file.ts | 58 ++++-- .../src/assets/icons/svg/menu-about.svg | 1 + .../src/assets/icons/svg/menu-chart.svg | 1 + .../src/assets/icons/svg/menu-data.svg | 1 + .../src/assets/icons/svg/menu-delete.svg | 6 + .../src/assets/icons/svg/menu-detail.svg | 7 + .../src/assets/icons/svg/menu-download.svg | 1 + .../src/assets/icons/svg/menu-edit.svg | 10 + .../src/assets/icons/svg/menu-error.svg | 1 + .../src/assets/icons/svg/menu-example.svg | 1 + .../src/assets/icons/svg/menu-form.svg | 1 + .../src/assets/icons/svg/menu-gitee.svg | 1 + .../src/assets/icons/svg/menu-home.svg | 1 + .../src/assets/icons/svg/menu-move.svg | 15 ++ .../src/assets/icons/svg/menu-nav.svg | 7 + .../src/assets/icons/svg/menu-result.svg | 1 + .../src/assets/icons/svg/menu-system.svg | 1 + .../src/assets/icons/svg/menu-table.svg | 1 + .../src/assets/icons/svg/menu-test.svg | 1 + .../src/assets/icons/svg/menu-user.svg | 1 + .../src/assets/icons/svg/menu-zip.svg | 6 + .../src/assets/icons/svg/minus-square.svg | 1 + .../src/components/gi-option-item/index.vue | 75 ++++++++ .../src/components/gi-option/index.vue | 20 ++ continew-admin-ui/src/constant/file.ts | 30 +-- .../file/components/FileMoveModal/index.vue | 176 ------------------ .../file/components/FileRenameModal/index.vue | 9 +- .../components/PreviewAudioModal/index.vue | 4 +- .../components/PreviewVideoModal/index.vue | 2 +- .../src/views/system/file/components/index.ts | 6 - .../src/views/system/file/detail/index.vue | 138 -------------- .../src/views/system/file/index.vue | 61 +++--- .../src/views/system/file/main/FileAside.vue | 7 +- .../system/file/main/FileMain/FileGrid.vue | 2 +- .../system/file/main/FileMain/FileImg.vue | 20 +- .../file/main/FileMain/FileRightMenu.vue | 33 ++-- .../views/system/file/main/FileMain/index.vue | 118 +++++++----- .../admin/webapi/system/FileController.java | 41 ++++ .../changelog/v2.2.0/continew-admin_table.sql | 4 +- 48 files changed, 926 insertions(+), 460 deletions(-) create mode 100644 continew-admin-system/src/main/java/top/charles7c/continew/admin/system/enums/FileTypeEnum.java create mode 100644 continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/FileMapper.java create mode 100644 continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/entity/FileDO.java create mode 100644 continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/FileQuery.java create mode 100644 continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/req/FileReq.java create mode 100644 continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/resp/FileDetailResp.java create mode 100644 continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/resp/FileResp.java create mode 100644 continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/FileService.java create mode 100644 continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/FileServiceImpl.java create mode 100644 continew-admin-ui/src/assets/icons/svg/menu-about.svg create mode 100644 continew-admin-ui/src/assets/icons/svg/menu-chart.svg create mode 100644 continew-admin-ui/src/assets/icons/svg/menu-data.svg create mode 100644 continew-admin-ui/src/assets/icons/svg/menu-delete.svg create mode 100644 continew-admin-ui/src/assets/icons/svg/menu-detail.svg create mode 100644 continew-admin-ui/src/assets/icons/svg/menu-download.svg create mode 100644 continew-admin-ui/src/assets/icons/svg/menu-edit.svg create mode 100644 continew-admin-ui/src/assets/icons/svg/menu-error.svg create mode 100644 continew-admin-ui/src/assets/icons/svg/menu-example.svg create mode 100644 continew-admin-ui/src/assets/icons/svg/menu-form.svg create mode 100644 continew-admin-ui/src/assets/icons/svg/menu-gitee.svg create mode 100644 continew-admin-ui/src/assets/icons/svg/menu-home.svg create mode 100644 continew-admin-ui/src/assets/icons/svg/menu-move.svg create mode 100644 continew-admin-ui/src/assets/icons/svg/menu-nav.svg create mode 100644 continew-admin-ui/src/assets/icons/svg/menu-result.svg create mode 100644 continew-admin-ui/src/assets/icons/svg/menu-system.svg create mode 100644 continew-admin-ui/src/assets/icons/svg/menu-table.svg create mode 100644 continew-admin-ui/src/assets/icons/svg/menu-test.svg create mode 100644 continew-admin-ui/src/assets/icons/svg/menu-user.svg create mode 100644 continew-admin-ui/src/assets/icons/svg/menu-zip.svg create mode 100644 continew-admin-ui/src/assets/icons/svg/minus-square.svg create mode 100644 continew-admin-ui/src/components/gi-option-item/index.vue create mode 100644 continew-admin-ui/src/components/gi-option/index.vue delete mode 100644 continew-admin-ui/src/views/system/file/components/FileMoveModal/index.vue delete mode 100644 continew-admin-ui/src/views/system/file/detail/index.vue create mode 100644 continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/system/FileController.java diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/enums/FileTypeEnum.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/enums/FileTypeEnum.java new file mode 100644 index 00000000..384e4475 --- /dev/null +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/enums/FileTypeEnum.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package top.charles7c.continew.admin.system.enums; + +import java.util.Collections; +import java.util.List; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +import top.charles7c.continew.starter.data.mybatis.plus.base.IBaseEnum; + +/** + * 文件分类枚举 + * + * @author Charles7c + * @since 2023/12/23 13:38 + */ +@Getter +@RequiredArgsConstructor +public enum FileTypeEnum implements IBaseEnum { + + /** + * 其他 + */ + UNKNOWN(1, "其他", Collections.emptyList()), + + /** + * 图片 + */ + IMAGE(2, "图片", List.of("jpg", "png", "gif", "bmp", "webp", "ico", "psd", "tiff", "dwg", "jxr", "apng", "xcf")), + + /** + * 文档 + */ + DOC(3, "文档", List.of("txt", "pdf", "doc", "xls", "ppt", "docx", "xlsx", "pptx")), + + /** + * 视频 + */ + VIDEO(4, "视频", List.of("mp4", "avi", "mkv", "flv", "webm", "wmv", "m4v", "mov", "mpg", "rmvb", "3gp")), + + /** + * 音频 + */ + AUDIO(5, "音频", List.of("mp3", "flac", "wav", "ogg", "midi", "m4a", "aac", "amr", "ac3", "aiff")),; + + private final Integer value; + private final String description; + private final List extensions; +} diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/FileMapper.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/FileMapper.java new file mode 100644 index 00000000..93dc6a63 --- /dev/null +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/mapper/FileMapper.java @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package top.charles7c.continew.admin.system.mapper; + +import top.charles7c.continew.admin.system.model.entity.FileDO; +import top.charles7c.continew.starter.data.mybatis.plus.base.BaseMapper; + +/** + * 文件 Mapper + * + * @author Charles7c + * @since 2023/12/23 10:38 + */ +public interface FileMapper extends BaseMapper {} \ No newline at end of file diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/entity/FileDO.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/entity/FileDO.java new file mode 100644 index 00000000..f3d497ce --- /dev/null +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/entity/FileDO.java @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package top.charles7c.continew.admin.system.model.entity; + +import java.io.Serial; + +import lombok.Data; + +import com.baomidou.mybatisplus.annotation.TableName; + +import top.charles7c.continew.admin.system.enums.FileTypeEnum; +import top.charles7c.continew.starter.extension.crud.base.BaseDO; + +/** + * 文件实体 + * + * @author Charles7c + * @since 2023/12/23 10:38 + */ +@Data +@TableName("sys_file") +public class FileDO extends BaseDO { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 名称 + */ + private String name; + + /** + * 大小(字节) + */ + private Long size; + + /** + * URL + */ + private String url; + + /** + * 扩展名 + */ + private String extension; + + /** + * MIME类型 + */ + private String mimeType; + + /** + * 类型 + */ + private FileTypeEnum type; + + /** + * 存储库ID + */ + private Long storageId; +} \ No newline at end of file diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/FileQuery.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/FileQuery.java new file mode 100644 index 00000000..e926220a --- /dev/null +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/FileQuery.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package top.charles7c.continew.admin.system.model.query; + +import java.io.Serial; +import java.io.Serializable; + +import lombok.Data; + +import io.swagger.v3.oas.annotations.media.Schema; + +import top.charles7c.continew.starter.data.mybatis.plus.query.Query; +import top.charles7c.continew.starter.data.mybatis.plus.query.QueryType; + +/** + * 文件查询条件 + * + * @author Charles7c + * @since 2023/12/23 10:38 + */ +@Data +@Schema(description = "文件查询条件") +public class FileQuery implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 名称 + */ + @Schema(description = "名称") + @Query(type = QueryType.INNER_LIKE) + private String name; + + /** + * 类型 + */ + @Schema(description = "类型") + @Query(type = QueryType.EQUAL) + private Integer type; +} \ No newline at end of file diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/req/FileReq.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/req/FileReq.java new file mode 100644 index 00000000..313ede6a --- /dev/null +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/req/FileReq.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package top.charles7c.continew.admin.system.model.req; + +import java.io.Serial; + +import lombok.Data; + +import io.swagger.v3.oas.annotations.media.Schema; + +import top.charles7c.continew.starter.extension.crud.base.BaseReq; + +/** + * 创建或修改文件信息 + * + * @author Charles7c + * @since 2023/12/23 10:38 + */ +@Data +@Schema(description = "创建或修改文件信息") +public class FileReq extends BaseReq { + + @Serial + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/resp/FileDetailResp.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/resp/FileDetailResp.java new file mode 100644 index 00000000..ad8eb991 --- /dev/null +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/resp/FileDetailResp.java @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package top.charles7c.continew.admin.system.model.resp; + +import java.io.Serial; + +import lombok.Data; + +import io.swagger.v3.oas.annotations.media.Schema; + +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; + +import top.charles7c.continew.admin.system.enums.FileTypeEnum; +import top.charles7c.continew.starter.extension.crud.base.BaseDetailResp; + +/** + * 文件详情信息 + * + * @author Charles7c + * @since 2023/12/23 10:38 + */ +@Data +@ExcelIgnoreUnannotated +@Schema(description = "文件详情信息") +public class FileDetailResp extends BaseDetailResp { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 名称 + */ + @Schema(description = "名称") + @ExcelProperty(value = "名称") + private String name; + + /** + * 大小(字节) + */ + @Schema(description = "大小(字节)") + @ExcelProperty(value = "大小(字节)") + private Long size; + + /** + * URL + */ + @Schema(description = "URL") + @ExcelProperty(value = "URL") + private String url; + + /** + * 扩展名 + */ + @Schema(description = "扩展名") + @ExcelProperty(value = "扩展名") + private String extension; + + /** + * MIME类型 + */ + @Schema(description = "MIME类型") + @ExcelProperty(value = "MIME类型") + private String mimeType; + + /** + * 类型 + */ + @Schema(description = "类型") + @ExcelProperty(value = "类型") + private FileTypeEnum type; + + /** + * 存储库ID + */ + @Schema(description = "存储库ID") + @ExcelProperty(value = "存储库ID") + private Long storageId; +} \ No newline at end of file diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/resp/FileResp.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/resp/FileResp.java new file mode 100644 index 00000000..188721f2 --- /dev/null +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/resp/FileResp.java @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package top.charles7c.continew.admin.system.model.resp; + +import java.io.Serial; +import java.time.LocalDateTime; + +import lombok.Data; + +import io.swagger.v3.oas.annotations.media.Schema; + +import top.charles7c.continew.admin.system.enums.FileTypeEnum; +import top.charles7c.continew.starter.extension.crud.base.BaseResp; + +/** + * 文件信息 + * + * @author Charles7c + * @since 2023/12/23 10:38 + */ +@Data +@Schema(description = "文件信息") +public class FileResp extends BaseResp { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 大小(字节) + */ + @Schema(description = "大小(字节)") + private Long size; + + /** + * URL + */ + @Schema(description = "URL") + private String url; + + /** + * 扩展名 + */ + @Schema(description = "扩展名") + private String extension; + + /** + * MIME类型 + */ + @Schema(description = "MIME类型") + private String mimeType; + + /** + * 类型 + */ + @Schema(description = "类型") + private FileTypeEnum type; + + /** + * 存储库ID + */ + @Schema(description = "存储库ID") + private Long storageId; + + /** + * 修改时间 + */ + @Schema(description = "修改时间") + private LocalDateTime updateTime; +} \ No newline at end of file diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/FileService.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/FileService.java new file mode 100644 index 00000000..7df68656 --- /dev/null +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/FileService.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package top.charles7c.continew.admin.system.service; + +import top.charles7c.continew.admin.system.model.query.FileQuery; +import top.charles7c.continew.admin.system.model.req.FileReq; +import top.charles7c.continew.admin.system.model.resp.FileDetailResp; +import top.charles7c.continew.admin.system.model.resp.FileResp; +import top.charles7c.continew.starter.extension.crud.base.BaseService; + +/** + * 文件业务接口 + * + * @author Charles7c + * @since 2023/12/23 10:38 + */ +public interface FileService extends BaseService {} \ No newline at end of file diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/FileServiceImpl.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/FileServiceImpl.java new file mode 100644 index 00000000..7bc9f411 --- /dev/null +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/FileServiceImpl.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package top.charles7c.continew.admin.system.service.impl; + +import lombok.RequiredArgsConstructor; + +import org.springframework.stereotype.Service; + +import top.charles7c.continew.admin.system.mapper.FileMapper; +import top.charles7c.continew.admin.system.model.entity.FileDO; +import top.charles7c.continew.admin.system.model.query.FileQuery; +import top.charles7c.continew.admin.system.model.req.FileReq; +import top.charles7c.continew.admin.system.model.resp.FileDetailResp; +import top.charles7c.continew.admin.system.model.resp.FileResp; +import top.charles7c.continew.admin.system.service.FileService; +import top.charles7c.continew.starter.extension.crud.base.BaseServiceImpl; + +/** + * 文件业务实现 + * + * @author Charles7c + * @since 2023/12/23 10:38 + */ +@Service +@RequiredArgsConstructor +public class FileServiceImpl extends BaseServiceImpl + implements FileService {} \ No newline at end of file diff --git a/continew-admin-ui/src/api/system/file.ts b/continew-admin-ui/src/api/system/file.ts index 9d9b41b8..0daf502c 100644 --- a/continew-admin-ui/src/api/system/file.ts +++ b/continew-admin-ui/src/api/system/file.ts @@ -1,24 +1,56 @@ import axios from 'axios'; +import qs from 'query-string'; const BASE_URL = '/system/file'; export interface FileItem { - id: string - type: string - name: string - extendName: string - src: string | null - updateTime: string - isDir: boolean - filePath: string - [propName: string]: any // 一个 interface 中任意属性只能有一个 + id: string; + name: string; + size: number; + url: string; + extension: string; + mimeType?: string; + type?: string; + storageId?: string; + createUser?: string; + createTime?: string; + updateUser?: string; + updateTime: string; + createUserString?: string; + updateUserString?: string; } -interface PageRes { - records: T; +export interface ListParam { + name?: string; + type?: string; + updateTime?: string; + page?: number; + size?: number; + sort?: Array; +} + +export interface PageRes { total: number; + list: T; +} + +export function list(params: ListParam) { + return axios.get>(`${BASE_URL}`, { + params, + paramsSerializer: (obj) => { + return qs.stringify(obj); + }, + }); +} + +export function get(id: string) { + return axios.get(`${BASE_URL}/${id}`); +} + +export function update(req: FileItem, id: string) { + return axios.put(`${BASE_URL}/${id}`, req); } -export function getFileList() { - return axios.get>(`${BASE_URL}/file`); +export function del(ids: string | Array) { + return axios.delete(`${BASE_URL}/${ids}`); } diff --git a/continew-admin-ui/src/assets/icons/svg/menu-about.svg b/continew-admin-ui/src/assets/icons/svg/menu-about.svg new file mode 100644 index 00000000..424adade --- /dev/null +++ b/continew-admin-ui/src/assets/icons/svg/menu-about.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/continew-admin-ui/src/assets/icons/svg/menu-chart.svg b/continew-admin-ui/src/assets/icons/svg/menu-chart.svg new file mode 100644 index 00000000..2a6cb928 --- /dev/null +++ b/continew-admin-ui/src/assets/icons/svg/menu-chart.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/continew-admin-ui/src/assets/icons/svg/menu-data.svg b/continew-admin-ui/src/assets/icons/svg/menu-data.svg new file mode 100644 index 00000000..a55d0866 --- /dev/null +++ b/continew-admin-ui/src/assets/icons/svg/menu-data.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/continew-admin-ui/src/assets/icons/svg/menu-delete.svg b/continew-admin-ui/src/assets/icons/svg/menu-delete.svg new file mode 100644 index 00000000..9a2e277e --- /dev/null +++ b/continew-admin-ui/src/assets/icons/svg/menu-delete.svg @@ -0,0 +1,6 @@ + + + \ No newline at end of file diff --git a/continew-admin-ui/src/assets/icons/svg/menu-detail.svg b/continew-admin-ui/src/assets/icons/svg/menu-detail.svg new file mode 100644 index 00000000..3b50683b --- /dev/null +++ b/continew-admin-ui/src/assets/icons/svg/menu-detail.svg @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/continew-admin-ui/src/assets/icons/svg/menu-download.svg b/continew-admin-ui/src/assets/icons/svg/menu-download.svg new file mode 100644 index 00000000..a473c633 --- /dev/null +++ b/continew-admin-ui/src/assets/icons/svg/menu-download.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/continew-admin-ui/src/assets/icons/svg/menu-edit.svg b/continew-admin-ui/src/assets/icons/svg/menu-edit.svg new file mode 100644 index 00000000..9f5d103b --- /dev/null +++ b/continew-admin-ui/src/assets/icons/svg/menu-edit.svg @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/continew-admin-ui/src/assets/icons/svg/menu-error.svg b/continew-admin-ui/src/assets/icons/svg/menu-error.svg new file mode 100644 index 00000000..b078659e --- /dev/null +++ b/continew-admin-ui/src/assets/icons/svg/menu-error.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/continew-admin-ui/src/assets/icons/svg/menu-example.svg b/continew-admin-ui/src/assets/icons/svg/menu-example.svg new file mode 100644 index 00000000..e6336ca9 --- /dev/null +++ b/continew-admin-ui/src/assets/icons/svg/menu-example.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/continew-admin-ui/src/assets/icons/svg/menu-form.svg b/continew-admin-ui/src/assets/icons/svg/menu-form.svg new file mode 100644 index 00000000..e9c9065f --- /dev/null +++ b/continew-admin-ui/src/assets/icons/svg/menu-form.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/continew-admin-ui/src/assets/icons/svg/menu-gitee.svg b/continew-admin-ui/src/assets/icons/svg/menu-gitee.svg new file mode 100644 index 00000000..0e55b981 --- /dev/null +++ b/continew-admin-ui/src/assets/icons/svg/menu-gitee.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/continew-admin-ui/src/assets/icons/svg/menu-home.svg b/continew-admin-ui/src/assets/icons/svg/menu-home.svg new file mode 100644 index 00000000..97ff012a --- /dev/null +++ b/continew-admin-ui/src/assets/icons/svg/menu-home.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/continew-admin-ui/src/assets/icons/svg/menu-move.svg b/continew-admin-ui/src/assets/icons/svg/menu-move.svg new file mode 100644 index 00000000..30583b1f --- /dev/null +++ b/continew-admin-ui/src/assets/icons/svg/menu-move.svg @@ -0,0 +1,15 @@ + + + + + + \ No newline at end of file diff --git a/continew-admin-ui/src/assets/icons/svg/menu-nav.svg b/continew-admin-ui/src/assets/icons/svg/menu-nav.svg new file mode 100644 index 00000000..51909da6 --- /dev/null +++ b/continew-admin-ui/src/assets/icons/svg/menu-nav.svg @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/continew-admin-ui/src/assets/icons/svg/menu-result.svg b/continew-admin-ui/src/assets/icons/svg/menu-result.svg new file mode 100644 index 00000000..186d90db --- /dev/null +++ b/continew-admin-ui/src/assets/icons/svg/menu-result.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/continew-admin-ui/src/assets/icons/svg/menu-system.svg b/continew-admin-ui/src/assets/icons/svg/menu-system.svg new file mode 100644 index 00000000..7d220b30 --- /dev/null +++ b/continew-admin-ui/src/assets/icons/svg/menu-system.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/continew-admin-ui/src/assets/icons/svg/menu-table.svg b/continew-admin-ui/src/assets/icons/svg/menu-table.svg new file mode 100644 index 00000000..404a0f69 --- /dev/null +++ b/continew-admin-ui/src/assets/icons/svg/menu-table.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/continew-admin-ui/src/assets/icons/svg/menu-test.svg b/continew-admin-ui/src/assets/icons/svg/menu-test.svg new file mode 100644 index 00000000..5fe46944 --- /dev/null +++ b/continew-admin-ui/src/assets/icons/svg/menu-test.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/continew-admin-ui/src/assets/icons/svg/menu-user.svg b/continew-admin-ui/src/assets/icons/svg/menu-user.svg new file mode 100644 index 00000000..c4275100 --- /dev/null +++ b/continew-admin-ui/src/assets/icons/svg/menu-user.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/continew-admin-ui/src/assets/icons/svg/menu-zip.svg b/continew-admin-ui/src/assets/icons/svg/menu-zip.svg new file mode 100644 index 00000000..71161773 --- /dev/null +++ b/continew-admin-ui/src/assets/icons/svg/menu-zip.svg @@ -0,0 +1,6 @@ + + + \ No newline at end of file diff --git a/continew-admin-ui/src/assets/icons/svg/minus-square.svg b/continew-admin-ui/src/assets/icons/svg/minus-square.svg new file mode 100644 index 00000000..69b62ae8 --- /dev/null +++ b/continew-admin-ui/src/assets/icons/svg/minus-square.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/continew-admin-ui/src/components/gi-option-item/index.vue b/continew-admin-ui/src/components/gi-option-item/index.vue new file mode 100644 index 00000000..fbd12db6 --- /dev/null +++ b/continew-admin-ui/src/components/gi-option-item/index.vue @@ -0,0 +1,75 @@ + + + + + diff --git a/continew-admin-ui/src/components/gi-option/index.vue b/continew-admin-ui/src/components/gi-option/index.vue new file mode 100644 index 00000000..85cf3601 --- /dev/null +++ b/continew-admin-ui/src/components/gi-option/index.vue @@ -0,0 +1,20 @@ + + + + + diff --git a/continew-admin-ui/src/constant/file.ts b/continew-admin-ui/src/constant/file.ts index cd35602a..c5a0b014 100644 --- a/continew-admin-ui/src/constant/file.ts +++ b/continew-admin-ui/src/constant/file.ts @@ -1,24 +1,24 @@ /** @desc 文件模块-映射 */ export interface fileTypeListItem { - name: string - value: number - menuIcon: string - icon: string + name: string; + value: number; + menuIcon: string; + icon: string; } // 文件分类 export const fileTypeList: fileTypeListItem[] = [ { name: '全部', value: 0, menuIcon: 'menu-file', icon: 'icon-stamp' }, - { name: '图片', value: 1, menuIcon: 'file-image', icon: 'icon-file-image' }, - { name: '文档', value: 2, menuIcon: 'file-txt', icon: 'icon-file' }, - { name: '视频', value: 3, menuIcon: 'file-video', icon: 'icon-video-camera' }, - { name: '音频', value: 4, menuIcon: 'file-music', icon: 'icon-file-audio' }, - { name: '其他', value: 5, menuIcon: 'file-other', icon: 'icon-bulb' } -] + { name: '图片', value: 2, menuIcon: 'file-image', icon: 'icon-file-image' }, + { name: '文档', value: 3, menuIcon: 'file-txt', icon: 'icon-file' }, + { name: '视频', value: 4, menuIcon: 'file-video', icon: 'icon-video-camera' }, + { name: '音频', value: 5, menuIcon: 'file-music', icon: 'icon-file-audio' }, + { name: '其他', value: 1, menuIcon: 'file-other', icon: 'icon-bulb' }, +]; export interface FileExtendNameIconMap { - [key: string]: string + [key: string]: string; } // 文件类型图标 Map 映射 @@ -37,11 +37,11 @@ export const fileExtendNameIconMap: FileExtendNameIconMap = { html: 'file-html', css: 'file-css', js: 'file-js', - other: 'file-other' // 未知文件 -} + other: 'file-other', // 未知文件 +}; // 图片类型 -export const imageTypeList = ['jpg', 'png', 'gif', 'jpeg'] +export const imageTypeList = ['jpg', 'png', 'gif', 'jpeg']; // WPS、Office文件类型 -export const officeFileType = ['ppt', 'pptx', 'doc', 'docx', 'xls', 'xlsx'] +export const officeFileType = ['ppt', 'pptx', 'doc', 'docx', 'xls', 'xlsx']; diff --git a/continew-admin-ui/src/views/system/file/components/FileMoveModal/index.vue b/continew-admin-ui/src/views/system/file/components/FileMoveModal/index.vue deleted file mode 100644 index fbdd56ae..00000000 --- a/continew-admin-ui/src/views/system/file/components/FileMoveModal/index.vue +++ /dev/null @@ -1,176 +0,0 @@ - - - - - diff --git a/continew-admin-ui/src/views/system/file/components/FileRenameModal/index.vue b/continew-admin-ui/src/views/system/file/components/FileRenameModal/index.vue index 571897b0..ae58111c 100644 --- a/continew-admin-ui/src/views/system/file/components/FileRenameModal/index.vue +++ b/continew-admin-ui/src/views/system/file/components/FileRenameModal/index.vue @@ -57,11 +57,10 @@ // 模拟接口 const saveApi = (): Promise => { return new Promise((resolve) => { - setTimeout(() => { - resolve(true); - }, 2000) - } - ); + setTimeout(() => { + resolve(true); + }, 2000); + }); }; const FormRef = ref(null); diff --git a/continew-admin-ui/src/views/system/file/components/PreviewAudioModal/index.vue b/continew-admin-ui/src/views/system/file/components/PreviewAudioModal/index.vue index 809a11a8..bcfd9266 100644 --- a/continew-admin-ui/src/views/system/file/components/PreviewAudioModal/index.vue +++ b/continew-admin-ui/src/views/system/file/components/PreviewAudioModal/index.vue @@ -11,7 +11,7 @@
{{ props.fileInfo?.name }}.{{ props.fileInfo?.extendName }}{{ props.fileInfo?.name }}.{{ props.fileInfo?.extension }}
@@ -42,7 +42,7 @@ const audioHeadRef = ref(null); const audioSrc = computed(() => { - return props.fileInfo?.src || ''; + return props.fileInfo?.url || ''; }); onMounted(() => { diff --git a/continew-admin-ui/src/views/system/file/components/PreviewVideoModal/index.vue b/continew-admin-ui/src/views/system/file/components/PreviewVideoModal/index.vue index 1184479e..646bcb11 100644 --- a/continew-admin-ui/src/views/system/file/components/PreviewVideoModal/index.vue +++ b/continew-admin-ui/src/views/system/file/components/PreviewVideoModal/index.vue @@ -29,7 +29,7 @@ // eslint-disable-next-line no-new new Player({ id: 'videoId', - url: props.fileInfo?.src || '', + url: props.fileInfo?.url || '', lang: 'zh-cn', autoplay: true, closeVideoClick: true, diff --git a/continew-admin-ui/src/views/system/file/components/index.ts b/continew-admin-ui/src/views/system/file/components/index.ts index 00335538..be82d828 100644 --- a/continew-admin-ui/src/views/system/file/components/index.ts +++ b/continew-admin-ui/src/views/system/file/components/index.ts @@ -4,7 +4,6 @@ import ArcoVueIcon from '@arco-design/web-vue/es/icon'; import ArcoVue from '@arco-design/web-vue'; import { FileItem } from '@/api/system/file'; -import FileMoveModal from './FileMoveModal/index.vue'; import FileRenameModal from './FileRenameModal/index.vue'; import PreviewVideoModal from './PreviewVideoModal/index.vue'; import PreviewAudioModal from './PreviewAudioModal/index.vue'; @@ -37,11 +36,6 @@ function createModal void }>( type TFileOptions = { fileInfo: FileItem; callback?: () => void }; -/** 打开 文件移动 弹窗 */ -export function openFileMoveModal(fileItem: FileItem) { - return createModal(FileMoveModal, { fileInfo: fileItem }); -} - /** 打开 文件重命名 弹窗 */ export function openFileRenameModal(fileItem: FileItem) { return createModal(FileRenameModal, { fileInfo: fileItem }); diff --git a/continew-admin-ui/src/views/system/file/detail/index.vue b/continew-admin-ui/src/views/system/file/detail/index.vue deleted file mode 100644 index 6c2cdce5..00000000 --- a/continew-admin-ui/src/views/system/file/detail/index.vue +++ /dev/null @@ -1,138 +0,0 @@ - - - - - diff --git a/continew-admin-ui/src/views/system/file/index.vue b/continew-admin-ui/src/views/system/file/index.vue index 20ac5add..e7554b9f 100644 --- a/continew-admin-ui/src/views/system/file/index.vue +++ b/continew-admin-ui/src/views/system/file/index.vue @@ -1,30 +1,33 @@ diff --git a/continew-admin-ui/src/views/system/file/main/FileAside.vue b/continew-admin-ui/src/views/system/file/main/FileAside.vue index dbe8ed0a..729742f1 100644 --- a/continew-admin-ui/src/views/system/file/main/FileAside.vue +++ b/continew-admin-ui/src/views/system/file/main/FileAside.vue @@ -14,6 +14,7 @@ + + diff --git a/continew-admin-ui/src/components/verifition/Verify/VerifyPoints.vue b/continew-admin-ui/src/components/verifition/Verify/VerifyPoints.vue new file mode 100644 index 00000000..add38991 --- /dev/null +++ b/continew-admin-ui/src/components/verifition/Verify/VerifyPoints.vue @@ -0,0 +1,296 @@ + + + diff --git a/continew-admin-ui/src/components/verifition/Verify/VerifySlide.vue b/continew-admin-ui/src/components/verifition/Verify/VerifySlide.vue new file mode 100644 index 00000000..c648fbe1 --- /dev/null +++ b/continew-admin-ui/src/components/verifition/Verify/VerifySlide.vue @@ -0,0 +1,462 @@ + + + diff --git a/continew-admin-ui/src/components/verifition/utils/ase.js b/continew-admin-ui/src/components/verifition/utils/ase.js new file mode 100644 index 00000000..9ed83769 --- /dev/null +++ b/continew-admin-ui/src/components/verifition/utils/ase.js @@ -0,0 +1,14 @@ +import CryptoJS from 'crypto-js'; +/** + * @word 要加密的内容 + * @keyWord String 服务器随机返回的关键字 + * */ +export function aesEncrypt(word, keyWord = 'XwKsGlMcdPMEhR1B') { + const key = CryptoJS.enc.Utf8.parse(keyWord); + const arcs = CryptoJS.enc.Utf8.parse(word); + const encrypted = CryptoJS.AES.encrypt(arcs, key, { + mode: CryptoJS.mode.ECB, + padding: CryptoJS.pad.Pkcs7, + }); + return encrypted.toString(); +} diff --git a/continew-admin-ui/src/components/verifition/utils/util.js b/continew-admin-ui/src/components/verifition/utils/util.js new file mode 100644 index 00000000..901e307f --- /dev/null +++ b/continew-admin-ui/src/components/verifition/utils/util.js @@ -0,0 +1,39 @@ +export function resetSize(vm) { + let img_width; + let img_height; + let bar_width; + let bar_height; // 图片的宽度、高度,移动条的宽度、高度 + + const parentWidth = vm.$el.parentNode.offsetWidth || window.offsetWidth; + const parentHeight = vm.$el.parentNode.offsetHeight || window.offsetHeight; + if (vm.imgSize.width.indexOf('%') !== -1) { + img_width = `${(parseInt(vm.imgSize.width, 10) / 100) * parentWidth}px`; + } else { + img_width = vm.imgSize.width; + } + + if (vm.imgSize.height.indexOf('%') !== -1) { + img_height = `${(parseInt(vm.imgSize.height, 10) / 100) * parentHeight}px`; + } else { + img_height = vm.imgSize.height; + } + + if (vm.barSize.width.indexOf('%') !== -1) { + bar_width = `${(parseInt(vm.barSize.width, 10) / 100) * parentWidth}px`; + } else { + bar_width = vm.barSize.width; + } + + if (vm.barSize.height.indexOf('%') !== -1) { + bar_height = `${(parseInt(vm.barSize.height, 10) / 100) * parentHeight}px`; + } else { + bar_height = vm.barSize.height; + } + + return { + imgWidth: img_width, + imgHeight: img_height, + barWidth: bar_width, + barHeight: bar_height, + }; +} diff --git a/continew-admin-ui/src/views/login/components/phone-login.vue b/continew-admin-ui/src/views/login/components/phone-login.vue index 71b634a7..621225d6 100644 --- a/continew-admin-ui/src/views/login/components/phone-login.vue +++ b/continew-admin-ui/src/views/login/components/phone-login.vue @@ -29,7 +29,7 @@ class="captcha-btn" :loading="captchaLoading" :disabled="captchaDisable" - @click="handleSendCaptcha" + @click="handleOpenBehaviorCaptcha" > {{ captchaBtnName }} @@ -43,6 +43,13 @@ >{{ $t('login.button') }}(演示不开放) + diff --git a/continew-admin-ui/src/views/system/file/main/FileMain/FileImg.vue b/continew-admin-ui/src/views/system/file/main/FileMain/FileImg.vue index 2e23e09d..5cf5c5e5 100644 --- a/continew-admin-ui/src/views/system/file/main/FileMain/FileImg.vue +++ b/continew-admin-ui/src/views/system/file/main/FileMain/FileImg.vue @@ -1,6 +1,6 @@ + + diff --git a/continew-admin-ui/src/views/system/file/components/PreviewVideoModal/index.vue b/continew-admin-ui/src/views/system/file/components/PreviewVideoModal/index.vue index 646bcb11..43d9c408 100644 --- a/continew-admin-ui/src/views/system/file/components/PreviewVideoModal/index.vue +++ b/continew-admin-ui/src/views/system/file/components/PreviewVideoModal/index.vue @@ -1,8 +1,9 @@