定时清理日志
This commit is contained in:
@@ -6,6 +6,8 @@ import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
/**
|
||||
* 自动清除日志(操作日志、异常日志)数据
|
||||
*/
|
||||
@@ -18,8 +20,11 @@ public class CleanLog {
|
||||
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");
|
||||
WQLObject sys_interface_log = WQLObject.getWQLObject("sys_interface_log");
|
||||
int days = Integer.parseInt(paramService.findByCode("log_day").getValue());
|
||||
logTab.delete("DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL " + days + " day))");
|
||||
sys_interface_log.delete("DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL " + days + " day))");
|
||||
|
||||
log.info("自动清理日志执行成功...!");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user