From 0837147172f82ca1abec71cfdb81ff63ee56cdfb Mon Sep 17 00:00:00 2001
From: wang-hao-jie <1550036656@qq.com>
Date: 星期五, 10 十二月 2021 11:07:12 +0800
Subject: [PATCH] 违章记录
---
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/CarScheduleImpl.java | 29 ++++++++++++++++++++++++++++-
1 files changed, 28 insertions(+), 1 deletions(-)
diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/CarScheduleImpl.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/CarScheduleImpl.java
index 5d8a8b6..9c75e08 100644
--- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/CarScheduleImpl.java
+++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/schedulings/CarScheduleImpl.java
@@ -1,14 +1,41 @@
package cn.exrick.xboot.your.schedulings;
+import cn.exrick.xboot.your.entity.Area;
+import cn.exrick.xboot.your.entity.Customer;
+import cn.exrick.xboot.your.service.IAreaSectionService;
+import cn.exrick.xboot.your.service.IAreaService;
+import cn.exrick.xboot.your.service.ICustomerService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.io.IOException;
+import java.util.List;
+//澶у睆閰嶉�佸垎鏋�
@Component
public class CarScheduleImpl {
+ @Autowired
+ private IAreaService iAreaService;
+
+ @Autowired
+ private IAreaSectionService iAreaSectionService;
+
+ @Autowired
+ private ICustomerService iCustomerService;
@Scheduled(cron="0 0 * * * ?")//姣忓皬鏃舵墽琛屼竴娆�
- public void execute() throws IOException {
+ public void execute(){
+ List<Area> list = iAreaService.list();
+ for(Area area:list){
+ QueryWrapper<Customer> wrapper = new QueryWrapper<>();
+ wrapper.eq("area_id",area.getId());
+ int count = iCustomerService.count(wrapper);
+ area.setCustomerSum(count);
+ iAreaService.saveOrUpdate(area);
+ }
+
+
}
}
--
Gitblit v1.9.1