From 9d6553bbfa5f1e709550d18a6a00f5bab97ff999 Mon Sep 17 00:00:00 2001 From: theo <971366405@qq.com> Date: Mon, 10 Nov 2025 11:42:12 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat(system):=20=E8=AE=B0=E5=BD=95=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=E6=96=B9=E6=B3=95=E5=88=B0=E6=93=8D=E4=BD=9C=E6=97=A5?= =?UTF-8?q?=E5=BF=97-=20=E5=9C=A8=20Log=20=E5=AE=9E=E4=BD=93=E7=B1=BB?= =?UTF-8?q?=E4=B8=AD=E6=96=B0=E5=A2=9E=20method=20=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E7=94=A8=E4=BA=8E=E5=AD=98=E5=82=A8=E8=AF=B7=E6=B1=82=E6=96=B9?= =?UTF-8?q?=E6=B3=95-=20=E5=9C=A8=20LogAspect=20=E5=88=87=E9=9D=A2?= =?UTF-8?q?=E4=B8=AD=E8=8E=B7=E5=8F=96=E5=B9=B6=E8=AE=BE=E7=BD=AE=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=E6=96=B9=E6=B3=95=E5=90=8D=E5=88=B0=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E5=AF=B9=E8=B1=A1-=20=E5=AE=8C=E5=96=84=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E8=AE=B0=E5=BD=95=E5=8A=9F=E8=83=BD=EF=BC=8C?= =?UTF-8?q?=E5=A2=9E=E5=BC=BA=E6=97=A5=E5=BF=97=E5=8F=AF=E8=BF=BD=E6=BA=AF?= =?UTF-8?q?=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/youlai/boot/core/aspect/LogAspect.java | 3 +++ src/main/java/com/youlai/boot/system/model/entity/Log.java | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/src/main/java/com/youlai/boot/core/aspect/LogAspect.java b/src/main/java/com/youlai/boot/core/aspect/LogAspect.java index 4b7ed91b..d25bfc11 100644 --- a/src/main/java/com/youlai/boot/core/aspect/LogAspect.java +++ b/src/main/java/com/youlai/boot/core/aspect/LogAspect.java @@ -138,6 +138,9 @@ public class LogAspect { log.setBrowser(userAgent.getBrowser().getName()); log.setBrowserVersion(userAgent.getBrowser().getVersion(userAgentString)); } + //获取方法名 + String methodName = joinPoint.getSignature().getName(); + log.setMethod(methodName); // 保存日志到数据库 logService.save(log); } diff --git a/src/main/java/com/youlai/boot/system/model/entity/Log.java b/src/main/java/com/youlai/boot/system/model/entity/Log.java index 0d49eb00..56ecdb99 100644 --- a/src/main/java/com/youlai/boot/system/model/entity/Log.java +++ b/src/main/java/com/youlai/boot/system/model/entity/Log.java @@ -56,6 +56,11 @@ public class Log implements Serializable { */ private String requestUri; + /** + * 请求方法 + */ + private String method; + /** * IP 地址 */ From 3eb66cb16eff58a8a8ec25664bf15127aa3c3834 Mon Sep 17 00:00:00 2001 From: theo <971366405@qq.com> Date: Fri, 14 Nov 2025 14:51:54 +0800 Subject: [PATCH 2/2] =?UTF-8?q?refactor(dept):=E4=BC=98=E5=8C=96=E9=83=A8?= =?UTF-8?q?=E9=97=A8=E6=9C=8D=E5=8A=A1=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将 Collections.EMPTY_LIST 替换为 Collections.emptyList() -优化树路径删除逻辑,使用预定义模式匹配- 提取重复代码为局部变量 --- .../com/youlai/boot/system/service/impl/DeptServiceImpl.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/youlai/boot/system/service/impl/DeptServiceImpl.java b/src/main/java/com/youlai/boot/system/service/impl/DeptServiceImpl.java index 39a60deb..db0ec596 100644 --- a/src/main/java/com/youlai/boot/system/service/impl/DeptServiceImpl.java +++ b/src/main/java/com/youlai/boot/system/service/impl/DeptServiceImpl.java @@ -108,7 +108,7 @@ public class DeptServiceImpl extends ServiceImpl implements De .orderByAsc(Dept::getSort) ); if (CollectionUtil.isEmpty(deptList)) { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } Set deptIds = deptList.stream() @@ -238,10 +238,11 @@ public class DeptServiceImpl extends ServiceImpl implements De if (StrUtil.isNotBlank(ids)) { String[] menuIds = ids.split(","); for (String deptId : menuIds) { + String patten = "%," + deptId + ",%"; this.update(new LambdaUpdateWrapper() .eq(Dept::getId, deptId) .or() - .apply("CONCAT (',',tree_path,',') LIKE CONCAT('%,',{0},',%')", deptId) + .apply("CONCAT (',',tree_path,',') LIKE {0}", patten) .set(Dept::getIsDeleted, 1) .set(Dept::getUpdateBy, SecurityUtils.getUserId()) );