1.添加定时删除历史数据任务

wms_pzh
x_z 3 years ago
parent 015bda9635
commit 96106c312f

@ -20,4 +20,5 @@ public interface BasicDownloadDao {
boolean updateDownloadStatus(BasicDownloadStatusEntity basicDownloadStatusEntity);
boolean deleteByTime();
}

@ -1,9 +1,7 @@
package com.glxp.api.admin.dao.basic;
import com.glxp.api.admin.entity.basic.BasicExportStatusEntity;
import com.glxp.api.admin.entity.inout.IOOrderStatusEntity;
import com.glxp.api.admin.req.basic.BasicExportStatusRequest;
import com.glxp.api.admin.req.inout.OrderStatusFilterRequest;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -22,4 +20,5 @@ public interface BasicExportDao {
boolean updateExportStatus(BasicExportStatusEntity warehouseEntity);
boolean deleteByTime();
}

@ -20,4 +20,6 @@ public interface ThrCorpExportLogDao {
boolean deleteById(@Param("id") String id);
String selectFilePathById(@Param("id") String id);
boolean deleteByTime();
}

@ -20,4 +20,6 @@ public interface ThrCorpImportDetailDao {
boolean deleteById(@Param("id") String id);
boolean deleteByGenkey(@Param("genKey") String genKey);
boolean deleteByTime();
}

@ -18,4 +18,5 @@ public interface ThrCorpImportLogDao {
boolean deleteById(@Param("id") String id);
boolean deleteByTime();
}

@ -19,4 +19,6 @@ public interface ThrImportLogDao {
boolean deleteById(@Param("id") String id);
boolean deleteByTime();
}

@ -26,4 +26,6 @@ public interface ThrOrderDetailDao {
boolean deleteAll();
boolean deleteByTime();
}

@ -17,4 +17,6 @@ public interface ThrOrderExportLogDao {
boolean updateThrOrderExportLog(ThrOrderExportLogEntity thrOrderExportLogEntity);
boolean deleteById(@Param("id") String id);
boolean deleteByTime();
}

@ -21,4 +21,6 @@ public interface ThrOrderImportDetailDao {
boolean deleteById(@Param("id") String id);
boolean deleteByGenkey(@Param("genKey") String genKey);
boolean deleteByTime();
}

@ -18,4 +18,6 @@ public interface ThrOrderImportLogDao {
boolean deleteById(@Param("id") String id);
boolean deleteByTime();
}

@ -25,4 +25,6 @@ public interface ThrProductsExportLogDao {
* @return
*/
String selectFilePathById(@Param("id") String id);
boolean deleteByTime();
}

@ -23,4 +23,5 @@ public interface ThrProductsImportDetailDao {
boolean deleteByGenkey(@Param("genKey") String genKey);
boolean deleteByTime();
}

@ -16,4 +16,7 @@ public interface ThrProductsImportLogDao {
boolean updateImportLog(ThrProductsImportLogEntity thrProductsImportLogEntity);
boolean deleteById(@Param("id") String id);
boolean deleteByTime();
}

@ -16,4 +16,6 @@ public interface BasicDownloadService {
boolean deleteById(String id);
boolean updateDownloadStatus(BasicDownloadStatusEntity basicDownloadStatusEntity);
boolean deleteByTime();
}

@ -2,8 +2,6 @@ package com.glxp.api.admin.service.basic;
import com.glxp.api.admin.entity.basic.BasicExportStatusEntity;
import com.glxp.api.admin.req.basic.BasicExportStatusRequest;
import com.glxp.api.admin.req.inout.OrderStatusFilterRequest;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -18,4 +16,7 @@ public interface BasicExportService {
boolean deleteById(String id);
boolean updateExportStatus(BasicExportStatusEntity warehouseEntity);
boolean deleteByTime();
}

@ -7,12 +7,14 @@ import com.glxp.api.admin.entity.basic.BasicDownloadStatusEntity;
import com.glxp.api.admin.req.basic.BasicDownloadRequest;
import com.glxp.api.admin.service.basic.BasicDownloadService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
@Service
@Transactional(rollbackFor = Exception.class)
public class BasicDownloadServiceImpl implements BasicDownloadService {
@Resource
@ -56,4 +58,9 @@ public class BasicDownloadServiceImpl implements BasicDownloadService {
public boolean updateDownloadStatus(BasicDownloadStatusEntity basicDownloadStatusEntity) {
return basicDownloadDao.updateDownloadStatus(basicDownloadStatusEntity);
}
@Override
public boolean deleteByTime() {
return basicDownloadDao.deleteByTime();
}
}

@ -4,17 +4,17 @@ import cn.hutool.core.collection.CollUtil;
import com.github.pagehelper.PageHelper;
import com.glxp.api.admin.dao.basic.BasicExportDao;
import com.glxp.api.admin.entity.basic.BasicExportStatusEntity;
import com.glxp.api.admin.entity.inout.IOOrderStatusEntity;
import com.glxp.api.admin.req.basic.BasicExportStatusRequest;
import com.glxp.api.admin.req.inout.OrderStatusFilterRequest;
import com.glxp.api.admin.service.basic.BasicExportService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
@Service
@Transactional(rollbackFor = Exception.class)
public class BasicExportServiceImpl implements BasicExportService {
@Resource
@ -58,4 +58,9 @@ public class BasicExportServiceImpl implements BasicExportService {
public boolean updateExportStatus(BasicExportStatusEntity basicExportStatusEntity) {
return basicExportDao.updateExportStatus(basicExportStatusEntity);
}
@Override
public boolean deleteByTime() {
return basicExportDao.deleteByTime();
}
}

@ -1,7 +1,6 @@
package com.glxp.api.admin.service.thrsys;
import com.glxp.api.admin.entity.thrsys.ThrCorpExportLogEntity;
import com.glxp.api.admin.entity.thrsys.ThrCorpImportLogEntity;
import com.glxp.api.admin.req.basic.FilterUdiEpLogRequest;
import java.util.List;
@ -20,4 +19,5 @@ public interface ThrCorpExportLogService {
boolean deleteById(String id);
boolean deleteByTime();
}

@ -2,7 +2,6 @@ package com.glxp.api.admin.service.thrsys;
import com.glxp.api.admin.entity.thrsys.ThrCorpImportDetailEntity;
import com.glxp.api.admin.req.basic.FilterUdiIpLogRequest;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;
import java.util.List;
@ -22,4 +21,5 @@ public interface ThrCorpImportDetailService {
boolean deleteByGenkey( String genKey);
boolean deleteByTime();
}

@ -17,4 +17,5 @@ public interface ThrCorpImportLogService {
boolean deleteById(String id);
boolean deleteByTime();
}

@ -17,4 +17,6 @@ public interface ThrImportLogService {
boolean deleteById(String id);
ThrImportLogEntity selectByGenKey(String genKey);
boolean deleteByTime();
}

@ -22,4 +22,5 @@ public interface ThrOrderDetailService {
boolean deleteAll();
boolean deleteByTime();
}

@ -16,4 +16,6 @@ public interface ThrOrderExportLogService {
boolean updateThrOrderExportLog(ThrOrderExportLogEntity thrOrderExportLogEntity);
boolean deleteById(String id);
boolean deleteByTime();
}

@ -18,4 +18,6 @@ public interface ThrOrderImportDetailService {
boolean deleteById(String id);
boolean deleteByGenkey(String genKey);
boolean deleteByTime();
}

@ -16,4 +16,5 @@ public interface ThrOrderImportLogService {
boolean deleteById(String id);
boolean deleteByTime();
}

@ -17,4 +17,5 @@ public interface ThrProductsExportLogService {
boolean deleteById(String id);
boolean deleteByTime();
}

@ -18,4 +18,5 @@ public interface ThrProductsImportDetailService {
boolean deleteByGenkey(String genKey);
boolean deleteByTime();
}

@ -15,4 +15,6 @@ public interface ThrProductsImportLogService {
boolean deleteById(String id);
ThrProductsImportLogEntity selectByGenKey(String genKey);
boolean deleteByTime();
}

@ -8,13 +8,16 @@ import com.glxp.api.admin.entity.thrsys.ThrCorpExportLogEntity;
import com.glxp.api.admin.req.basic.FilterUdiEpLogRequest;
import com.glxp.api.admin.service.thrsys.ThrCorpExportLogService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
@Service
@Transactional(rollbackFor = Exception.class)
public class ThrCorpExportLogServiceImpl implements ThrCorpExportLogService {
@Resource
ThrCorpExportLogDao thrCorpExportLogDao;
@ -61,4 +64,9 @@ public class ThrCorpExportLogServiceImpl implements ThrCorpExportLogService {
}
return thrCorpExportLogDao.deleteById(id);
}
@Override
public boolean deleteByTime() {
return thrCorpExportLogDao.deleteByTime();
}
}

@ -6,12 +6,14 @@ import com.glxp.api.admin.entity.thrsys.ThrCorpImportDetailEntity;
import com.glxp.api.admin.req.basic.FilterUdiIpLogRequest;
import com.glxp.api.admin.service.thrsys.ThrCorpImportDetailService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
@Service
@Transactional(rollbackFor = Exception.class)
public class ThrCorpImportDetailServiceImpl implements ThrCorpImportDetailService {
@Resource
@ -54,4 +56,9 @@ public class ThrCorpImportDetailServiceImpl implements ThrCorpImportDetailServic
public boolean deleteByGenkey(String genKey) {
return thrCorpImportDetailDao.deleteByGenkey(genKey);
}
@Override
public boolean deleteByTime() {
return thrCorpImportDetailDao.deleteByTime();
}
}

@ -6,12 +6,14 @@ import com.glxp.api.admin.entity.thrsys.ThrCorpImportLogEntity;
import com.glxp.api.admin.req.basic.FilterUdiIpLogRequest;
import com.glxp.api.admin.service.thrsys.ThrCorpImportLogService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
@Service
@Transactional(rollbackFor = Exception.class)
public class ThrCorpImportLogServiceImpl implements ThrCorpImportLogService {
@Resource
ThrCorpImportLogDao thrCorpImportLogDao;
@ -55,4 +57,9 @@ public class ThrCorpImportLogServiceImpl implements ThrCorpImportLogService {
public boolean deleteById(String id) {
return thrCorpImportLogDao.deleteById(id);
}
@Override
public boolean deleteByTime() {
return thrCorpImportLogDao.deleteByTime();
}
}

@ -6,12 +6,14 @@ import com.glxp.api.admin.entity.thrsys.ThrImportLogEntity;
import com.glxp.api.admin.req.basic.FilterUdiIpLogRequest;
import com.glxp.api.admin.service.thrsys.ThrImportLogService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
@Service
@Transactional(rollbackFor = Exception.class)
public class ThrImportLogServiceImpl implements ThrImportLogService {
@Resource
@ -55,4 +57,9 @@ public class ThrImportLogServiceImpl implements ThrImportLogService {
}
return null;
}
@Override
public boolean deleteByTime() {
return thrImportLogDao.deleteByTime();
}
}

@ -2,17 +2,18 @@ package com.glxp.api.admin.service.thrsys.impl;
import com.github.pagehelper.PageHelper;
import com.glxp.api.admin.dao.thrsys.ThrOrderDetailDao;
import com.glxp.api.admin.entity.thrsys.ThrInvProductsEntity;
import com.glxp.api.admin.entity.thrsys.ThrOrderDetailEntity;
import com.glxp.api.admin.req.thrsys.FilterThrOrderDetailRequest;
import com.glxp.api.admin.service.thrsys.ThrOrderDetailService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
@Service
@Transactional(rollbackFor = Exception.class)
public class ThrOrderDetailServiceImpl implements ThrOrderDetailService {
@Resource
@ -60,4 +61,9 @@ public class ThrOrderDetailServiceImpl implements ThrOrderDetailService {
public boolean deleteAll() {
return thrOrderDetailDao.deleteAll();
}
@Override
public boolean deleteByTime() {
return thrOrderDetailDao.deleteByTime();
}
}

@ -6,12 +6,14 @@ import com.glxp.api.admin.entity.thrsys.ThrOrderExportLogEntity;
import com.glxp.api.admin.req.basic.FilterUdiEpLogRequest;
import com.glxp.api.admin.service.thrsys.ThrOrderExportLogService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
@Service
@Transactional(rollbackFor = Exception.class)
public class ThrOrderExportLogServiceImpl implements ThrOrderExportLogService {
@Resource
@ -55,4 +57,9 @@ public class ThrOrderExportLogServiceImpl implements ThrOrderExportLogService {
public boolean deleteById(String id) {
return thrOrderExportLogDao.deleteById(id);
}
@Override
public boolean deleteByTime() {
return thrOrderExportLogDao.deleteByTime();
}
}

@ -6,12 +6,14 @@ import com.glxp.api.admin.entity.thrsys.ThrOrderImportDetailEntity;
import com.glxp.api.admin.req.basic.FilterUdiIpLogRequest;
import com.glxp.api.admin.service.thrsys.ThrOrderImportDetailService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
@Service
@Transactional(rollbackFor = Exception.class)
public class ThrOrderImportDetailServiceImpl implements ThrOrderImportDetailService {
@Resource
@ -54,4 +56,9 @@ public class ThrOrderImportDetailServiceImpl implements ThrOrderImportDetailServ
public boolean deleteByGenkey(String genKey) {
return thrOrderImportDetailDao.deleteByGenkey(genKey);
}
@Override
public boolean deleteByTime() {
return thrOrderImportDetailDao.deleteByTime();
}
}

@ -2,11 +2,11 @@ package com.glxp.api.admin.service.thrsys.impl;
import com.github.pagehelper.PageHelper;
import com.glxp.api.admin.dao.thrsys.ThrOrderImportLogDao;
import com.glxp.api.admin.entity.basic.CorpImportLogEntity;
import com.glxp.api.admin.entity.thrsys.ThrOrderImportLogEntity;
import com.glxp.api.admin.req.basic.FilterUdiIpLogRequest;
import com.glxp.api.admin.service.thrsys.ThrOrderImportLogService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Collections;
@ -14,6 +14,7 @@ import java.util.List;
@Service
@Transactional(rollbackFor = Exception.class)
public class ThrOrderImportLogServiceImpl implements ThrOrderImportLogService {
@Resource
ThrOrderImportLogDao thrOrderImportLogDao;
@ -57,4 +58,9 @@ public class ThrOrderImportLogServiceImpl implements ThrOrderImportLogService {
public boolean deleteById(String id) {
return thrOrderImportLogDao.deleteById(id);
}
@Override
public boolean deleteByTime() {
return thrOrderImportLogDao.deleteByTime();
}
}

@ -8,12 +8,14 @@ import com.glxp.api.admin.entity.thrsys.ThrProductsExportLogEntity;
import com.glxp.api.admin.req.basic.FilterUdiEpLogRequest;
import com.glxp.api.admin.service.thrsys.ThrProductsExportLogService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
@Service
@Transactional(rollbackFor = Exception.class)
public class ThrProductsExportLogServiceImpl implements ThrProductsExportLogService {
@Resource
ThrProductsExportLogDao thrProductsExportLogDao;
@ -61,4 +63,9 @@ public class ThrProductsExportLogServiceImpl implements ThrProductsExportLogServ
}
return thrProductsExportLogDao.deleteById(id);
}
@Override
public boolean deleteByTime() {
return thrProductsExportLogDao.deleteByTime();
}
}

@ -6,12 +6,14 @@ import com.glxp.api.admin.entity.thrsys.ThrProductsImportDetailEntity;
import com.glxp.api.admin.req.basic.FilterUdiIpLogRequest;
import com.glxp.api.admin.service.thrsys.ThrProductsImportDetailService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
@Service
@Transactional(rollbackFor = Exception.class)
public class ThrProductsImportDetailServiceImpl implements ThrProductsImportDetailService {
@Resource
@ -54,4 +56,9 @@ public class ThrProductsImportDetailServiceImpl implements ThrProductsImportDeta
public boolean deleteByGenkey(String genKey) {
return thrProductsImportDetailDao.deleteByGenkey(genKey);
}
@Override
public boolean deleteByTime() {
return thrProductsImportDetailDao.deleteByTime();
}
}

@ -6,12 +6,14 @@ import com.glxp.api.admin.entity.thrsys.ThrProductsImportLogEntity;
import com.glxp.api.admin.req.basic.FilterUdiIpLogRequest;
import com.glxp.api.admin.service.thrsys.ThrProductsImportLogService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
@Service
@Transactional(rollbackFor = Exception.class)
public class ThrProductsImportLogServiceImpl implements ThrProductsImportLogService {
@Resource
ThrProductsImportLogDao thrProductsImportLogDao;
@ -54,4 +56,9 @@ public class ThrProductsImportLogServiceImpl implements ThrProductsImportLogServ
}
return null;
}
@Override
public boolean deleteByTime() {
return thrProductsImportLogDao.deleteByTime();
}
}

@ -0,0 +1,95 @@
package com.glxp.api.admin.thread;
import com.glxp.api.admin.dao.schedule.ScheduledDao;
import com.glxp.api.admin.entity.info.ScheduledEntity;
import com.glxp.api.admin.req.info.ScheduledRequest;
import com.glxp.api.admin.service.basic.BasicDownloadService;
import com.glxp.api.admin.service.basic.BasicExportService;
import com.glxp.api.admin.service.thrsys.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.SchedulingConfigurer;
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
import org.springframework.scheduling.support.CronTrigger;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
*
*/
@Slf4j
@Component
@EnableScheduling
public class CleanDataTask implements SchedulingConfigurer {
@Resource
private ScheduledDao scheduledDao;
@Resource
private BasicExportService basicExportService;
@Resource
private BasicDownloadService basicDownloadService;
@Resource
private ThrCorpExportLogService thrCorpExportLogService;
@Resource
private ThrCorpImportDetailService thrCorpImportDetailService;
@Resource
private ThrCorpImportLogService thrCorpImportLogService;
@Resource
private ThrImportLogService thrImportLogService;
@Resource
private ThrOrderDetailService thrOrderDetailService;
@Resource
private ThrOrderExportLogService thrOrderExportLogService;
@Resource
private ThrOrderImportDetailService thrOrderImportDetailService;
@Resource
private ThrOrderImportLogService thrOrderImportLogService;
@Resource
private ThrProductsImportLogService thrProductsImportLogService;
@Resource
private ThrProductsExportLogService thrProductsExportLogService;
@Resource
private ThrProductsImportDetailService thrProductsImportDetailService;
@Override
public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
taskRegistrar.addTriggerTask(() -> process(),
triggerContext -> {
ScheduledRequest scheduledRequest = new ScheduledRequest();
scheduledRequest.setCronName("ScheduledDeletion");
ScheduledEntity scheduledEntity = scheduledDao.findScheduled(scheduledRequest);
String cron = scheduledEntity.getCron();
if (cron.isEmpty()) {
log.error("cron is null");
}
return new CronTrigger(cron).nextExecutionTime(triggerContext);
});
}
private void process() {
log.info("开始清理 30 天前的历史数据");
//删除同步任务
log.info("开始删除同步任务历史记录");
basicExportService.deleteByTime();
//删除下载记录
log.info("开始删除下载记录");
basicDownloadService.deleteByTime();
//删除第三方数据
log.info("开始删除第三方数据");
thrCorpExportLogService.deleteByTime();
thrCorpImportDetailService.deleteByTime();
thrCorpImportLogService.deleteByTime();
thrImportLogService.deleteByTime();
thrOrderDetailService.deleteByTime();
thrOrderExportLogService.deleteByTime();
thrOrderImportDetailService.deleteByTime();
thrOrderImportLogService.deleteByTime();
thrProductsImportLogService.deleteByTime();
thrProductsExportLogService.deleteByTime();
thrProductsImportDetailService.deleteByTime();
log.info("历史数据清理完成");
}
}

@ -69,4 +69,8 @@
WHERE id = #{id}
</delete>
<delete id="deleteByTime">
Delete From basic_download_status
where date(startTime) &lt;= date(DATE_SUB(NOW(),INTERVAL 30 day))
</delete>
</mapper>

@ -67,4 +67,8 @@
WHERE id = #{id}
</delete>
<delete id="deleteByTime">
Delete From basic_export_status
where date(startTime) &lt;= date(DATE_SUB(NOW(),INTERVAL 30 day))
</delete>
</mapper>

@ -53,4 +53,8 @@
WHERE genKey = #{genKey}
</update>
<delete id="deleteByTime">
Delete From thr_corp_export_log
where date(updateTime) &lt;= date(DATE_SUB(NOW(),INTERVAL 30 day))
</delete>
</mapper>

@ -89,4 +89,8 @@
WHERE id = #{id}
</update>
<delete id="deleteByTime">
Delete From thr_corp_import_detail
where date(updateTime) &lt;= date(DATE_SUB(NOW(),INTERVAL 30 day))
</delete>
</mapper>

@ -55,4 +55,8 @@
WHERE genKey = #{genKey}
</update>
<delete id="deleteByTime">
Delete From thr_corp_import_log
where date(updateTime) &lt;= date(DATE_SUB(NOW(),INTERVAL 30 day))
</delete>
</mapper>

@ -59,4 +59,8 @@
WHERE genKey = #{genKey}
</update>
<delete id="deleteByTime">
Delete From thr_import_log
where date(updateTime) &lt;= date(DATE_SUB(NOW(),INTERVAL 30 day))
</delete>
</mapper>

@ -126,4 +126,8 @@
FROM thr_order_detail
</delete>
<delete id="deleteByTime">
Delete From thr_order_detail
where date(updateTime) &lt;= date(DATE_SUB(NOW(),INTERVAL 30 day))
</delete>
</mapper>

@ -50,4 +50,8 @@
WHERE genKey = #{genKey}
</update>
<delete id="deleteByTime">
Delete From thr_order_export_log
where date(updateTime) &lt;= date(DATE_SUB(NOW(),INTERVAL 30 day))
</delete>
</mapper>

@ -90,4 +90,8 @@
WHERE id = #{id}
</update>
<delete id="deleteByTime">
Delete From thr_order_import_log
where date(updateTime) &lt;= date(DATE_SUB(NOW(),INTERVAL 30 day))
</delete>
</mapper>

@ -54,4 +54,8 @@
WHERE genKey = #{genKey}
</update>
<delete id="deleteByTime">
Delete From thr_order_import_log
where date(updateTime) &lt;= date(DATE_SUB(NOW(),INTERVAL 30 day))
</delete>
</mapper>

@ -53,4 +53,8 @@
WHERE genKey = #{genKey}
</update>
<delete id="deleteByTime">
Delete From thr_products_export_log
where date(updateTime) &lt;= date(DATE_SUB(NOW(),INTERVAL 30 day))
</delete>
</mapper>

@ -102,4 +102,8 @@
WHERE id = #{id}
</update>
<delete id="deleteByTime">
Delete From thr_products_import_detail
where date(updateTime) &lt;= date(DATE_SUB(NOW(),INTERVAL 30 day))
</delete>
</mapper>

@ -54,4 +54,8 @@
WHERE genKey = #{genKey}
</update>
<delete id="deleteByTime">
Delete From thr_porducts_import_log
where date(updateTime) &lt;= date(DATE_SUB(NOW(),INTERVAL 30 day))
</delete>
</mapper>

@ -7,5 +7,13 @@ CALL Pro_Temp_ColumnWork ('io_order','wzUploadResult','varchar(255) ', 1);
CALL Pro_Temp_ColumnWork ('stock_order','noInvOut','tinyint', 1);
-- 新增数据
INSERT ignore INTO sys_scheduled(id, cronName, cron, customerId, remark)
VALUES
(16, 'ScheduledDeletion', '0 0 2 1/1 * ? ', NULL, '删除30天数据');
INSERT ignore INTO system_param_config ( id, parentId, paramName, paramKey, paramValue, paramStatus, paramType, paramExplain )
VALUES
( 20009, 0, '删除30天数据', 'ScheduledDeletion', '1', 1, 0, '1:是0' );
-- 创建表时必须 create table if not exists 表名
Loading…
Cancel
Save