com.fastchar.systemtool.entity.FinalLogActionRequestEntity Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fastchar-systemtool Show documentation
Show all versions of fastchar-systemtool Show documentation
FastChar-SystemTool is a FastChar-ExtJs plugin.
package com.fastchar.systemtool.entity;
import com.fastchar.core.FastChar;
import com.fastchar.extjs.FastExtHelper;
import com.fastchar.extjs.core.FastExtEntity;
import com.fastchar.database.FastPage;
import com.fastchar.database.info.FastSqlInfo;
import com.fastchar.utils.FastDateUtils;
import java.text.SimpleDateFormat;
import java.util.Calendar;
public class FinalLogActionRequestEntity extends FastExtEntity {
private static final long serialVersionUID = 1L;
public static FinalLogActionRequestEntity dao() {
return FastChar.getOverrides().singleInstance(FinalLogActionRequestEntity.class);
}
public static FinalLogActionRequestEntity newInstance() {
return FastChar.getOverrides().newInstance(FinalLogActionRequestEntity.class);
}
@Override
public String getTableName() {
return "final_log_action_request";
}
@Override
public String getTableDetails() {
return "系统请求日志";
}
@Override
public String getEntityCode() {
return this.getClass().getSimpleName();
}
@Override
public FastPage showList(int page, int pageSize) {
String sqlStr = "select t.*" +
" from final_log_action_request as t" +
" ";
FastSqlInfo sqlInfo = toSelectSql(sqlStr);
return selectBySql(page, pageSize, sqlInfo.getSql(), sqlInfo.toParams());
}
@Override
public void setDefaultValue() {
set("logDateTime", FastDateUtils.getDateString());
}
@Override
public void convertValue() {
super.convertValue();
}
public void clearData(int keepDay) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
Calendar minCalendar = Calendar.getInstance();
minCalendar.add(Calendar.DAY_OF_MONTH, -(keepDay + 1));
String sqlStr = "delete from final_log_action_request where date_format(logDateTime,'%Y-%m-%d') <= ? ";
String format = simpleDateFormat.format(minCalendar.getTime());
int updateBySql = updateBySql(sqlStr, format);
if (updateBySql > 0) {
FastExtHelper.addWaitInfo("系统请求日志清除", "已成功删除" +
format + "之前的" + updateBySql + "条系统请求日志!");
}
}
}