邮件API

This commit is contained in:
2025-09-22 23:43:05 +08:00
parent 46f6847b51
commit 3d6c77536e
2 changed files with 24 additions and 1 deletions

View File

@@ -9,6 +9,7 @@ import com.mini.capi.biz.service.SyncTaskService;
import com.mini.capi.config.DataSourceConfig;
import com.mini.capi.model.ApiResult;
import com.mini.capi.model.TabResult;
import com.mini.capi.utils.DateUtils;
import jakarta.annotation.Resource;
import org.springframework.jdbc.core.BatchPreparedStatementSetter;
import org.springframework.jdbc.core.JdbcTemplate;
@@ -150,6 +151,8 @@ public class DbService {
if (!tableExists(targetJdbc, targetTable)) {
createTargetTable(sourceJdbc, targetJdbc, sourceTable, targetTable);
}
// 2. 清空目标表当前ds7天前值的数据
clearTargetTableLastWeekData(targetJdbc, targetTable);
// 2. 清空目标表当前ds值的数据
clearTargetTableData(targetJdbc, targetTable, dsValue);
// 3. 全量同步数据
@@ -315,6 +318,12 @@ public class DbService {
targetJdbc.update(sql, dsValue);
}
private void clearTargetTableLastWeekData(JdbcTemplate targetJdbc, String targetTable) {
String sql = "DELETE FROM " + targetTable + " WHERE ds = ?";
targetJdbc.update(sql, DateUtils.getSevenDaysAgo());
}
/**
* 全量同步数据
*/