2 changed files with 52 additions and 0 deletions
@ -0,0 +1,26 @@ |
|||||
|
package org.nl.wms.autotask; |
||||
|
|
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.nl.modules.system.service.ParamService; |
||||
|
import org.nl.modules.wql.core.bean.WQLObject; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
/** |
||||
|
* 自动清除日志(操作日志、异常日志)数据 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Component |
||||
|
@RequiredArgsConstructor |
||||
|
public class CleanLog { |
||||
|
private final ParamService paramService; |
||||
|
|
||||
|
public void run(){ |
||||
|
//delete from sys_log where DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL 30 day)) limit 10;
|
||||
|
WQLObject logTab = WQLObject.getWQLObject("sys_log"); |
||||
|
int days = Integer.parseInt(paramService.findByCode("log_day").getValue()); |
||||
|
logTab.delete("DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL " + days + " day))"); |
||||
|
log.info("自动清理日志执行成功...!"); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,26 @@ |
|||||
|
package org.nl.wms.autotask; |
||||
|
|
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.nl.modules.system.service.ParamService; |
||||
|
import org.nl.modules.wql.core.bean.WQLObject; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
/** |
||||
|
* 自动清除日志(操作日志、异常日志)数据 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Component |
||||
|
@RequiredArgsConstructor |
||||
|
public class CleanLog { |
||||
|
private final ParamService paramService; |
||||
|
|
||||
|
public void run(){ |
||||
|
//delete from sys_log where DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL 30 day)) limit 10;
|
||||
|
WQLObject logTab = WQLObject.getWQLObject("sys_log"); |
||||
|
int days = Integer.parseInt(paramService.findByCode("log_day").getValue()); |
||||
|
logTab.delete("DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL " + days + " day))"); |
||||
|
log.info("自动清理日志执行成功...!"); |
||||
|
} |
||||
|
|
||||
|
} |
Loading…
Reference in new issue