From cec3ccb0309b88a19373202caffdbd8d7d7c4e11 Mon Sep 17 00:00:00 2001 From: x_z Date: Fri, 31 Mar 2023 11:59:34 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=B7=BB=E5=8A=A0=E5=88=A0=E9=99=A4=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/dao/monitor/SysLogininforMapper.java | 6 + .../api/dao/monitor/SysOperLogMapper.java | 6 + .../glxp/api/dao/sync/BasicDownloadDao.java | 2 + .../com/glxp/api/dao/sync/BasicExportDao.java | 2 + .../com/glxp/api/dao/system/SysErpLogDao.java | 15 ++ .../api/dao/thrsys/ThrCorpExportLogDao.java | 7 + .../api/dao/thrsys/ThrCorpImportLogDao.java | 7 +- .../thrsys/ThrInvProductsExportLogDao.java | 2 + .../thrsys/ThrInvProductsImportLogDao.java | 1 + .../api/dao/thrsys/ThrOrderExportLogDao.java | 2 + .../api/dao/thrsys/ThrOrderImportLogDao.java | 1 + .../dao/thrsys/ThrProductsExportLogDao.java | 2 + .../dao/thrsys/ThrProductsImportLogDao.java | 2 + .../api/entity/system/SysErpLogEntity.java | 71 ++++++++ .../java/com/glxp/api/task/AsyncUdiTask.java | 13 +- .../java/com/glxp/api/task/CleanLogTask.java | 159 ++++++++++++++++++ .../mapper/monitor/SysLogininforMapper.xml | 3 + .../mapper/monitor/SysOperLogMapper.xml | 3 + .../mapper/schedule/SystemParamConfigDao.xml | 4 +- .../mybatis/mapper/sync/BasicDownloadDao.xml | 4 + .../mybatis/mapper/sync/BasicExportDao.xml | 4 + .../mybatis/mapper/system/SysErpLogDao.xml | 10 ++ .../mapper/thrsys/ThrCorpExportLogDao.xml | 3 + .../mapper/thrsys/ThrCorpImportLogDao.xml | 3 + .../thrsys/ThrInvProductsExportLogDao.xml | 3 + .../thrsys/ThrInvProductsImportLogDao.xml | 3 + .../mapper/thrsys/ThrOrderExportLogDao.xml | 3 + .../mapper/thrsys/ThrOrderImportLogDao.xml | 3 + .../mapper/thrsys/ThrProductsExportLogDao.xml | 3 + .../mapper/thrsys/ThrProductsImportLogDao.xml | 3 + 30 files changed, 341 insertions(+), 9 deletions(-) create mode 100644 src/main/java/com/glxp/api/dao/system/SysErpLogDao.java create mode 100644 src/main/java/com/glxp/api/entity/system/SysErpLogEntity.java create mode 100644 src/main/java/com/glxp/api/task/CleanLogTask.java create mode 100644 src/main/resources/mybatis/mapper/system/SysErpLogDao.xml diff --git a/src/main/java/com/glxp/api/dao/monitor/SysLogininforMapper.java b/src/main/java/com/glxp/api/dao/monitor/SysLogininforMapper.java index 60ea5db4e..d385270c0 100644 --- a/src/main/java/com/glxp/api/dao/monitor/SysLogininforMapper.java +++ b/src/main/java/com/glxp/api/dao/monitor/SysLogininforMapper.java @@ -28,4 +28,10 @@ public interface SysLogininforMapper { void insertLogininfor(SysLogininfor logininfor); + /** + * 根据此日期之前的数据(包括当前时间) + * + * @param date 日期 + */ + void deleteByDate(@Param("date") String date); } diff --git a/src/main/java/com/glxp/api/dao/monitor/SysOperLogMapper.java b/src/main/java/com/glxp/api/dao/monitor/SysOperLogMapper.java index 4d6db93a3..dca5c6ec2 100644 --- a/src/main/java/com/glxp/api/dao/monitor/SysOperLogMapper.java +++ b/src/main/java/com/glxp/api/dao/monitor/SysOperLogMapper.java @@ -25,4 +25,10 @@ public interface SysOperLogMapper { SysOperLog selectById(Long id); + /** + * 根据此日期之前的数据(包括当前时间) + * + * @param date 日期 + */ + void deleteByDate(@Param("date") String date); } diff --git a/src/main/java/com/glxp/api/dao/sync/BasicDownloadDao.java b/src/main/java/com/glxp/api/dao/sync/BasicDownloadDao.java index ed241bfde..92d27bd61 100644 --- a/src/main/java/com/glxp/api/dao/sync/BasicDownloadDao.java +++ b/src/main/java/com/glxp/api/dao/sync/BasicDownloadDao.java @@ -21,4 +21,6 @@ public interface BasicDownloadDao { boolean deleteByTime(); + + void deleteByDate(@Param("date") String date); } diff --git a/src/main/java/com/glxp/api/dao/sync/BasicExportDao.java b/src/main/java/com/glxp/api/dao/sync/BasicExportDao.java index e85a32561..28d13f80c 100644 --- a/src/main/java/com/glxp/api/dao/sync/BasicExportDao.java +++ b/src/main/java/com/glxp/api/dao/sync/BasicExportDao.java @@ -21,4 +21,6 @@ public interface BasicExportDao { boolean deleteByTime(); + + void deleteByDate(@Param("date") String date); } diff --git a/src/main/java/com/glxp/api/dao/system/SysErpLogDao.java b/src/main/java/com/glxp/api/dao/system/SysErpLogDao.java new file mode 100644 index 000000000..5692aee6a --- /dev/null +++ b/src/main/java/com/glxp/api/dao/system/SysErpLogDao.java @@ -0,0 +1,15 @@ +package com.glxp.api.dao.system; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.glxp.api.entity.system.SysErpLogEntity; +import org.apache.ibatis.annotations.Param; + +public interface SysErpLogDao extends BaseMapper { + + /** + * 根据时间删除日志 + * + * @param date 日期 + */ + void deleteByDate(@Param("date") String date); +} \ No newline at end of file diff --git a/src/main/java/com/glxp/api/dao/thrsys/ThrCorpExportLogDao.java b/src/main/java/com/glxp/api/dao/thrsys/ThrCorpExportLogDao.java index e7d7c62ac..ed843553d 100644 --- a/src/main/java/com/glxp/api/dao/thrsys/ThrCorpExportLogDao.java +++ b/src/main/java/com/glxp/api/dao/thrsys/ThrCorpExportLogDao.java @@ -23,4 +23,11 @@ public interface ThrCorpExportLogDao { boolean deleteByTime(); String selectFilePathById(@Param("id") String id); + + /** + * 根据时间删除日志数据 + * + * @param date 日期 + */ + void deleteByDate(@Param("date") String date); } diff --git a/src/main/java/com/glxp/api/dao/thrsys/ThrCorpImportLogDao.java b/src/main/java/com/glxp/api/dao/thrsys/ThrCorpImportLogDao.java index a1195980f..4a96e5cf3 100644 --- a/src/main/java/com/glxp/api/dao/thrsys/ThrCorpImportLogDao.java +++ b/src/main/java/com/glxp/api/dao/thrsys/ThrCorpImportLogDao.java @@ -3,7 +3,6 @@ package com.glxp.api.dao.thrsys; import com.glxp.api.entity.thrsys.ThrCorpImportLogEntity; import com.glxp.api.req.thrsys.FilterThrCorpImportLogRequest; -import com.glxp.api.req.thrsys.FilterThrProductsImportLogRequest; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -22,4 +21,10 @@ public interface ThrCorpImportLogDao { boolean deleteByTime(); + /** + * 根据日期删除日志数据 + * + * @param date 日期 + */ + void deleteByDate(@Param("date") String date); } diff --git a/src/main/java/com/glxp/api/dao/thrsys/ThrInvProductsExportLogDao.java b/src/main/java/com/glxp/api/dao/thrsys/ThrInvProductsExportLogDao.java index e74422969..b8699daf7 100644 --- a/src/main/java/com/glxp/api/dao/thrsys/ThrInvProductsExportLogDao.java +++ b/src/main/java/com/glxp/api/dao/thrsys/ThrInvProductsExportLogDao.java @@ -17,4 +17,6 @@ public interface ThrInvProductsExportLogDao { boolean updateThrInvProductsExportLog(ThrInvProductsExportLogEntity thrInvProductsExportLogEntity); boolean deleteById(@Param("id") String id); + + void deleteByDate(@Param("date") String date); } diff --git a/src/main/java/com/glxp/api/dao/thrsys/ThrInvProductsImportLogDao.java b/src/main/java/com/glxp/api/dao/thrsys/ThrInvProductsImportLogDao.java index 4b29dbb9c..294a43a2d 100644 --- a/src/main/java/com/glxp/api/dao/thrsys/ThrInvProductsImportLogDao.java +++ b/src/main/java/com/glxp/api/dao/thrsys/ThrInvProductsImportLogDao.java @@ -19,4 +19,5 @@ public interface ThrInvProductsImportLogDao { boolean deleteById(@Param("id") String id); + void deleteByDate(@Param("date") String date); } diff --git a/src/main/java/com/glxp/api/dao/thrsys/ThrOrderExportLogDao.java b/src/main/java/com/glxp/api/dao/thrsys/ThrOrderExportLogDao.java index 4fa30deac..ad879790a 100644 --- a/src/main/java/com/glxp/api/dao/thrsys/ThrOrderExportLogDao.java +++ b/src/main/java/com/glxp/api/dao/thrsys/ThrOrderExportLogDao.java @@ -20,4 +20,6 @@ public interface ThrOrderExportLogDao { boolean deleteById(@Param("id") String id); boolean deleteByTime(); + + void deleteByDate(@Param("date") String date); } diff --git a/src/main/java/com/glxp/api/dao/thrsys/ThrOrderImportLogDao.java b/src/main/java/com/glxp/api/dao/thrsys/ThrOrderImportLogDao.java index 4ee02506c..f39174eea 100644 --- a/src/main/java/com/glxp/api/dao/thrsys/ThrOrderImportLogDao.java +++ b/src/main/java/com/glxp/api/dao/thrsys/ThrOrderImportLogDao.java @@ -21,4 +21,5 @@ public interface ThrOrderImportLogDao { boolean deleteByTime(); + void deleteByDate(@Param("date") String date); } diff --git a/src/main/java/com/glxp/api/dao/thrsys/ThrProductsExportLogDao.java b/src/main/java/com/glxp/api/dao/thrsys/ThrProductsExportLogDao.java index 047061e56..f419ed638 100644 --- a/src/main/java/com/glxp/api/dao/thrsys/ThrProductsExportLogDao.java +++ b/src/main/java/com/glxp/api/dao/thrsys/ThrProductsExportLogDao.java @@ -28,4 +28,6 @@ public interface ThrProductsExportLogDao { String selectFilePathById(@Param("id") String id); boolean deleteByTime(); + + void deleteByDate(@Param("date") String date); } diff --git a/src/main/java/com/glxp/api/dao/thrsys/ThrProductsImportLogDao.java b/src/main/java/com/glxp/api/dao/thrsys/ThrProductsImportLogDao.java index 45ea90e86..0ed66f76e 100644 --- a/src/main/java/com/glxp/api/dao/thrsys/ThrProductsImportLogDao.java +++ b/src/main/java/com/glxp/api/dao/thrsys/ThrProductsImportLogDao.java @@ -19,4 +19,6 @@ public interface ThrProductsImportLogDao { boolean deleteById(@Param("id") String id); boolean deleteByTime(); + + void deleteByDate(@Param("date") String date); } diff --git a/src/main/java/com/glxp/api/entity/system/SysErpLogEntity.java b/src/main/java/com/glxp/api/entity/system/SysErpLogEntity.java new file mode 100644 index 000000000..e29a7c362 --- /dev/null +++ b/src/main/java/com/glxp/api/entity/system/SysErpLogEntity.java @@ -0,0 +1,71 @@ +package com.glxp.api.entity.system; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.util.Date; + +/** + * 第三方接口服务日志表 + */ +@Data +@TableName(value = "sys_erp_log") +public class SysErpLogEntity { + + /** + * id + */ + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + /** + * 请求路径 + */ + @TableField(value = "url") + private String url; + + /** + * 接口名/方法名 + */ + @TableField(value = "`name`") + private String name; + + /** + * 入参 + */ + @TableField(value = "params") + private String params; + + /** + * 结果 + */ + @TableField(value = "`result`") + private String result; + + /** + * 请求时间 + */ + @TableField(value = "createTime") + private Date createTime; + + /** + * 操作类型 interface::接口 third:请求第三方系统 + */ + @TableField(value = "`type`") + private String type; + + /** + * 处理状态 + */ + @TableField(value = "`status`") + private Integer status; + + /** + * 处理时长 + */ + @TableField(value = "time") + private Long time; +} \ No newline at end of file diff --git a/src/main/java/com/glxp/api/task/AsyncUdiTask.java b/src/main/java/com/glxp/api/task/AsyncUdiTask.java index 311ee0a54..5b7cf5004 100644 --- a/src/main/java/com/glxp/api/task/AsyncUdiTask.java +++ b/src/main/java/com/glxp/api/task/AsyncUdiTask.java @@ -1,7 +1,9 @@ package com.glxp.api.task; -import javax.annotation.Resource; - +import com.glxp.api.dao.schedule.ScheduledDao; +import com.glxp.api.entity.system.ScheduledEntity; +import com.glxp.api.idc.service.IdcService; +import com.glxp.api.req.system.ScheduledRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.scheduling.annotation.EnableScheduling; @@ -10,10 +12,7 @@ import org.springframework.scheduling.config.ScheduledTaskRegistrar; import org.springframework.scheduling.support.CronTrigger; import org.springframework.stereotype.Component; -import com.glxp.api.dao.schedule.ScheduledDao; -import com.glxp.api.entity.system.ScheduledEntity; -import com.glxp.api.idc.service.IdcService; -import com.glxp.api.req.system.ScheduledRequest; +import javax.annotation.Resource; @@ -50,7 +49,7 @@ public class AsyncUdiTask implements SchedulingConfigurer { private void process() { logger.info("syncIdcUdi----process------------"); - idcService.asyncUdiTask(); + //idcService.asyncUdiTask(); } } diff --git a/src/main/java/com/glxp/api/task/CleanLogTask.java b/src/main/java/com/glxp/api/task/CleanLogTask.java new file mode 100644 index 000000000..f516ba109 --- /dev/null +++ b/src/main/java/com/glxp/api/task/CleanLogTask.java @@ -0,0 +1,159 @@ +package com.glxp.api.task; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.StrUtil; +import com.glxp.api.dao.monitor.SysLogininforMapper; +import com.glxp.api.dao.monitor.SysOperLogMapper; +import com.glxp.api.dao.schedule.ScheduledDao; +import com.glxp.api.dao.schedule.SystemParamConfigDao; +import com.glxp.api.dao.sync.BasicDownloadDao; +import com.glxp.api.dao.sync.BasicExportDao; +import com.glxp.api.dao.system.SysErpLogDao; +import com.glxp.api.dao.thrsys.*; +import com.glxp.api.entity.system.ScheduledEntity; +import com.glxp.api.req.system.ScheduledRequest; +import lombok.extern.slf4j.Slf4j; +import org.springframework.scheduling.annotation.SchedulingConfigurer; +import org.springframework.scheduling.config.ScheduledTaskRegistrar; +import org.springframework.scheduling.support.CronTrigger; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.Date; + +/** + * 清理日志定时任务 + */ +@Slf4j +@Component +@Transactional(rollbackFor = Exception.class) +public class CleanLogTask implements SchedulingConfigurer { + + @Resource + private ScheduledDao scheduledDao; + @Resource + private SystemParamConfigDao systemParamConfigDao; + @Resource + private SysOperLogMapper sysOperLogMapper; + @Resource + private SysLogininforMapper sysLogininforMapper; + @Resource + private ThrCorpExportLogDao thrCorpExportLogDao; + @Resource + private ThrCorpImportLogDao thrCorpImportLogDao; + @Resource + private ThrInvProductsExportLogDao thrInvProductsExportLogDao; + @Resource + private ThrInvProductsImportLogDao thrInvProductsImportLogDao; + @Resource + private ThrOrderExportLogDao thrOrderExportLogDao; + @Resource + private ThrOrderImportLogDao thrOrderImportLogDao; + @Resource + private ThrProductsExportLogDao thrProductsExportLogDao; + @Resource + private ThrProductsImportLogDao thrProductsImportLogDao; + @Resource + private SysErpLogDao sysErpLogDao; + @Resource + private BasicDownloadDao basicDownloadDao; + @Resource + private BasicExportDao basicExportDao; + + @Override + public void configureTasks(ScheduledTaskRegistrar taskRegistrar) { + taskRegistrar.addTriggerTask(this::process, triggerContext -> { + ScheduledRequest scheduledRequest = new ScheduledRequest(); + scheduledRequest.setCronName("clean_log_task"); + ScheduledEntity scheduledEntity = scheduledDao.findScheduled(scheduledRequest); + String cron = scheduledEntity.getCron(); + if (StrUtil.isBlank(cron)) { + log.error("清理日志定时任务参数未配置"); + } + return new CronTrigger(cron).nextExecutionTime(triggerContext); + }); + } + + private void process() { + //查询删除日志时间配置 + String value = systemParamConfigDao.selectValueByParamKey("clean_log_days"); + if (StrUtil.isBlank(value)) { + log.info("删除日志天数参数未配置,结束任务"); + } else { + int days = Integer.parseInt(value); + if (days > 0) { + String date = DateUtil.offsetDay(new Date(), -days).toString("yyyy-MM-dd"); + //查询系统日志删除是否开启 + String cleanSystemLogValue = systemParamConfigDao.selectValueByParamKey("clean_system_log"); + if ("1".equals(cleanSystemLogValue)) { + cleanSystemLog(date); + } + String cleanThrLogValue = systemParamConfigDao.selectValueByParamKey("clean_thr_log"); + if ("1".equals(cleanThrLogValue)) { + cleanThrLog(date); + } + String cleanSyncLogValue = systemParamConfigDao.selectValueByParamKey("clean_sync_log"); + if ("1".equals(cleanSyncLogValue)) { + cleanSyncLog(date); + } + } else { + log.info("配置删除日志天数为0,不进行删除"); + } + } + } + + /** + * 删除系统日志 + * + * @param date 时间 + */ + private void cleanSystemLog(String date) { + //删除操作系统日志 + sysOperLogMapper.deleteByDate(date); + //删除系统访问日志 + sysLogininforMapper.deleteByDate(date); + } + + /** + * 删除第三方系统日志 + * + * @param date 时间 + */ + private void cleanThrLog(String date) { + log.info("删除第三方系统日志"); + //删除第三方往来单位导出日志 + thrCorpExportLogDao.deleteByDate(date); + //删除第三方往来单位导入日志 + thrCorpImportLogDao.deleteByDate(date); + //删除第三方库存产品导出日志 + thrInvProductsExportLogDao.deleteByDate(date); + //删除第三方库存产品导入日志 + thrInvProductsImportLogDao.deleteByDate(date); + //删除第三方单据导出日志 + thrOrderExportLogDao.deleteByDate(date); + //删除第三方单据导入日志 + thrOrderImportLogDao.deleteByDate(date); + //删除第三方产品导出日志 + thrProductsExportLogDao.deleteByDate(date); + //删除第三方产品导入日志 + thrProductsImportLogDao.deleteByDate(date); + //删除第三方接口服务日志 + sysErpLogDao.deleteByDate(date); + log.info("第三方系统日志删除完成"); + } + + /** + * 删除同步日志 + * + * @param date 时间 + */ + private void cleanSyncLog(String date) { + log.info("开始删除同步日志"); + //删除下载日志 + basicDownloadDao.deleteByDate(date); + //删除上传日志 + basicExportDao.deleteByDate(date); + } + +} diff --git a/src/main/resources/mybatis/mapper/monitor/SysLogininforMapper.xml b/src/main/resources/mybatis/mapper/monitor/SysLogininforMapper.xml index 349cb37f6..28ba1c31b 100644 --- a/src/main/resources/mybatis/mapper/monitor/SysLogininforMapper.xml +++ b/src/main/resources/mybatis/mapper/monitor/SysLogininforMapper.xml @@ -75,4 +75,7 @@ + + delete from monitor_login_log where date_format(#{date}, '%Y-%m-%d') >= date_format(login_time, '%Y-%m-%d') + diff --git a/src/main/resources/mybatis/mapper/monitor/SysOperLogMapper.xml b/src/main/resources/mybatis/mapper/monitor/SysOperLogMapper.xml index 115b42ed1..dfcaae4dd 100644 --- a/src/main/resources/mybatis/mapper/monitor/SysOperLogMapper.xml +++ b/src/main/resources/mybatis/mapper/monitor/SysOperLogMapper.xml @@ -108,4 +108,7 @@ + + delete from monitor_oper_log where date_format(#{date}, '%Y-%m-%d') >= date_format(oper_time, '%Y-%m-%d') + diff --git a/src/main/resources/mybatis/mapper/schedule/SystemParamConfigDao.xml b/src/main/resources/mybatis/mapper/schedule/SystemParamConfigDao.xml index 948e368a0..6c99e5ebe 100644 --- a/src/main/resources/mybatis/mapper/schedule/SystemParamConfigDao.xml +++ b/src/main/resources/mybatis/mapper/schedule/SystemParamConfigDao.xml @@ -75,5 +75,7 @@ #{paramExplain}) - + \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/sync/BasicDownloadDao.xml b/src/main/resources/mybatis/mapper/sync/BasicDownloadDao.xml index b52ced8d6..1f7779d71 100644 --- a/src/main/resources/mybatis/mapper/sync/BasicDownloadDao.xml +++ b/src/main/resources/mybatis/mapper/sync/BasicDownloadDao.xml @@ -88,4 +88,8 @@ From basic_download_status where date(startTime) <= date(DATE_SUB(NOW(), INTERVAL 30 day)) + + + delete from basic_download_status where date_format(#{date}, '%Y-%m-%d') >= date_format(updateTime, '%Y-%m-%d') + diff --git a/src/main/resources/mybatis/mapper/sync/BasicExportDao.xml b/src/main/resources/mybatis/mapper/sync/BasicExportDao.xml index 582d6cf7b..239a5cf31 100644 --- a/src/main/resources/mybatis/mapper/sync/BasicExportDao.xml +++ b/src/main/resources/mybatis/mapper/sync/BasicExportDao.xml @@ -71,4 +71,8 @@ Delete From basic_export_status where date(startTime) <= date(DATE_SUB(NOW(),INTERVAL 30 day)) + + + delete from basic_export_status where date_format(#{date}, '%Y-%m-%d') >= date_format(startTime, '%Y-%m-%d') + diff --git a/src/main/resources/mybatis/mapper/system/SysErpLogDao.xml b/src/main/resources/mybatis/mapper/system/SysErpLogDao.xml new file mode 100644 index 000000000..0fc3207ca --- /dev/null +++ b/src/main/resources/mybatis/mapper/system/SysErpLogDao.xml @@ -0,0 +1,10 @@ + + + + + + delete + from sys_erp_log + where date_format(#{date}, '%Y-%m-%d') >= date_format(createTime, '%Y-%m-%d') + + \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/thrsys/ThrCorpExportLogDao.xml b/src/main/resources/mybatis/mapper/thrsys/ThrCorpExportLogDao.xml index 3cba3fd19..86f09971f 100644 --- a/src/main/resources/mybatis/mapper/thrsys/ThrCorpExportLogDao.xml +++ b/src/main/resources/mybatis/mapper/thrsys/ThrCorpExportLogDao.xml @@ -64,4 +64,7 @@ where date(updateTime) <= date(DATE_SUB(NOW(),INTERVAL 30 day)) + + delete from thr_corp_export_log where date_format(#{date}, '%Y-%m-%d') >= date_format(updateTime, '%Y-%m-%d') + \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/thrsys/ThrCorpImportLogDao.xml b/src/main/resources/mybatis/mapper/thrsys/ThrCorpImportLogDao.xml index d1731c5a7..b66030b10 100644 --- a/src/main/resources/mybatis/mapper/thrsys/ThrCorpImportLogDao.xml +++ b/src/main/resources/mybatis/mapper/thrsys/ThrCorpImportLogDao.xml @@ -67,4 +67,7 @@ where date(updateTime) <= date(DATE_SUB(NOW(),INTERVAL 30 day)) + + delete from thr_corp_import_log where date_format(#{date}, '%Y-%m-%d') >= date_format(updateTime, '%Y-%m-%d') + \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/thrsys/ThrInvProductsExportLogDao.xml b/src/main/resources/mybatis/mapper/thrsys/ThrInvProductsExportLogDao.xml index ad1e8c70a..3e92cea10 100644 --- a/src/main/resources/mybatis/mapper/thrsys/ThrInvProductsExportLogDao.xml +++ b/src/main/resources/mybatis/mapper/thrsys/ThrInvProductsExportLogDao.xml @@ -55,4 +55,7 @@ WHERE genKey = #{genKey} + + delete from thr_inv_products_export_log where date_format(#{date}, '%Y-%m-%d') >= date_format(updateTime, '%Y-%m-%d') + \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/thrsys/ThrInvProductsImportLogDao.xml b/src/main/resources/mybatis/mapper/thrsys/ThrInvProductsImportLogDao.xml index 29a076544..f950315f2 100644 --- a/src/main/resources/mybatis/mapper/thrsys/ThrInvProductsImportLogDao.xml +++ b/src/main/resources/mybatis/mapper/thrsys/ThrInvProductsImportLogDao.xml @@ -61,4 +61,7 @@ WHERE genKey = #{genKey} + + delete from thr_inv_products_import_log where date_format(#{date}, '%Y-%m-%d') >= date_format(updateTime, '%Y-%m-%d') + \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/thrsys/ThrOrderExportLogDao.xml b/src/main/resources/mybatis/mapper/thrsys/ThrOrderExportLogDao.xml index db61f7c42..cd6235c12 100644 --- a/src/main/resources/mybatis/mapper/thrsys/ThrOrderExportLogDao.xml +++ b/src/main/resources/mybatis/mapper/thrsys/ThrOrderExportLogDao.xml @@ -56,4 +56,7 @@ + + delete from thr_order_export_log where date_format(#{date}, '%Y-%m-%d') >= date_format(updateTime, '%Y-%m-%d') + \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/thrsys/ThrOrderImportLogDao.xml b/src/main/resources/mybatis/mapper/thrsys/ThrOrderImportLogDao.xml index dc560b65d..10fc17f18 100644 --- a/src/main/resources/mybatis/mapper/thrsys/ThrOrderImportLogDao.xml +++ b/src/main/resources/mybatis/mapper/thrsys/ThrOrderImportLogDao.xml @@ -59,4 +59,7 @@ where date(updateTime) <= date(DATE_SUB(NOW(),INTERVAL 30 day)) + + delete from thr_order_import_log where date_format(#{date}, '%Y-%m-%d') >= date_format(updateTime, '%Y-%m-%d') + \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/thrsys/ThrProductsExportLogDao.xml b/src/main/resources/mybatis/mapper/thrsys/ThrProductsExportLogDao.xml index ad8c644ab..c15292a78 100644 --- a/src/main/resources/mybatis/mapper/thrsys/ThrProductsExportLogDao.xml +++ b/src/main/resources/mybatis/mapper/thrsys/ThrProductsExportLogDao.xml @@ -64,4 +64,7 @@ where date(updateTime) <= date(DATE_SUB(NOW(),INTERVAL 30 day)) + + delete from thr_products_export_log where date_format(#{date}, '%Y-%m-%d') >= date_format(updateTime, '%Y-%m-%d') + \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/thrsys/ThrProductsImportLogDao.xml b/src/main/resources/mybatis/mapper/thrsys/ThrProductsImportLogDao.xml index 574d9e57a..11311c56f 100644 --- a/src/main/resources/mybatis/mapper/thrsys/ThrProductsImportLogDao.xml +++ b/src/main/resources/mybatis/mapper/thrsys/ThrProductsImportLogDao.xml @@ -65,4 +65,7 @@ where date(updateTime) <= date(DATE_SUB(NOW(),INTERVAL 30 day)) + + delete from thr_products_import_log where date_format(#{date}, '%Y-%m-%d') >= date_format(updateTime, '%Y-%m-%d') + \ No newline at end of file