From 535c06c0b6258b77661acf90297a205776bcf2df Mon Sep 17 00:00:00 2001 From: lihongjie0209 Date: Sun, 6 Apr 2025 22:08:02 +0800 Subject: [PATCH] =?UTF-8?q?refactor(aop):=20=E4=BF=AE=E6=94=B9=E6=8E=A7?= =?UTF-8?q?=E5=88=B6=E5=99=A8=E5=88=87=E9=9D=A2=E5=88=87=E5=85=A5=E7=82=B9?= =?UTF-8?q?=E8=A1=A8=E8=BE=BE=E5=BC=8F=E5=B9=B6=E5=A2=9E=E5=8A=A0=E7=BB=84?= =?UTF-8?q?=E7=BB=87ID=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将控制器切面的切入点表达式从 execution 改为 within,提高灵活性 - 在 SmartCamCarLicenseSnapshotDataService 中为 smartCamCarDataEntity 和 byNumber 实体添加 organizationId 字段 --- src/main/java/cn/lihongjie/coal/aop/ControllerAop.java | 2 +- .../service/SmartCamCarLicenseSnapshotDataService.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/cn/lihongjie/coal/aop/ControllerAop.java b/src/main/java/cn/lihongjie/coal/aop/ControllerAop.java index 81ae3c42..9eda650d 100644 --- a/src/main/java/cn/lihongjie/coal/aop/ControllerAop.java +++ b/src/main/java/cn/lihongjie/coal/aop/ControllerAop.java @@ -66,7 +66,7 @@ public class ControllerAop { @Autowired PojoProcessor pojoProcessor; - @Pointcut("execution (* cn.lihongjie.coal.*.controller.*.*(..))") + @Pointcut("within (cn.lihongjie.coal..*.controller..*)") public void controllerMethods() {} @SneakyThrows diff --git a/src/main/java/cn/lihongjie/coal/smartCamCarLicenseSnapshotData/service/SmartCamCarLicenseSnapshotDataService.java b/src/main/java/cn/lihongjie/coal/smartCamCarLicenseSnapshotData/service/SmartCamCarLicenseSnapshotDataService.java index 7765728c..54b81083 100644 --- a/src/main/java/cn/lihongjie/coal/smartCamCarLicenseSnapshotData/service/SmartCamCarLicenseSnapshotDataService.java +++ b/src/main/java/cn/lihongjie/coal/smartCamCarLicenseSnapshotData/service/SmartCamCarLicenseSnapshotDataService.java @@ -326,6 +326,7 @@ public class SmartCamCarLicenseSnapshotDataService smartCamCarDataEntity.setEntry(entity); smartCamCarDataEntity.setEntryTime(entity.getInfoTimeObj()); + smartCamCarDataEntity.setOrganizationId(entity.getOrganizationId()); smartCamCarDataRepository.save(smartCamCarDataEntity); } else { @@ -334,6 +335,7 @@ public class SmartCamCarLicenseSnapshotDataService smartCamCarDataEntity.setNumber(entity.getNumber()); smartCamCarDataEntity.setExit(entity); smartCamCarDataEntity.setExitTime(entity.getInfoTimeObj()); + smartCamCarDataEntity.setOrganizationId(entity.getOrganizationId()); smartCamCarDataRepository.save(smartCamCarDataEntity); } @@ -348,6 +350,7 @@ public class SmartCamCarLicenseSnapshotDataService byNumber.setExit(entity); byNumber.setExitTime(entity.getInfoTimeObj()); + byNumber.setOrganizationId(entity.getOrganizationId()); smartCamCarDataRepository.save(byNumber); } }