
package com.jeelowcode.core.framework.mapper;

import com.jeelowcode.core.framework.entity.LogRequestErrorApiEntity;
import com.baomidou.dynamic.datasource.annotation.Slave;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import java.util.Date;

/**
 * 请求错误日志，单独库
 */
@Slave
public interface LogApiErrorMapper extends BaseMapper<LogRequestErrorApiEntity> {

    //清除某一个日期前的api请求日志
    default Integer clearApiLog(Date clearDate){
        LambdaQueryWrapper<LogRequestErrorApiEntity> wrapper=new LambdaQueryWrapper<>();
        wrapper.le(LogRequestErrorApiEntity::getCreateTime,clearDate);
        return this.delete(wrapper);
    }
}
