package com.jiayue.ipp.idp.service.impl.an;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jiayue.ipp.common.data.entity.an.ParsingLog;
import com.jiayue.ipp.idp.mapper.an.ParsingLogMapper;
import com.jiayue.ipp.idp.service.an.ParsingLogService;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * 解析记录业务层实现类
 *
 * @author tl
 * @date 2022-05-11 18:07:03
 */
@Service
public class ParsingLogServiceImpl extends ServiceImpl<ParsingLogMapper, ParsingLog> implements ParsingLogService {
    @Override
    public QueryWrapper<ParsingLog> getByStationCodeAndCreateTimeAndFileStatusAndFileType(String stationCode, Date startTime, Date endTime, String fileStatus, String fileType) {
        QueryWrapper<ParsingLog> wrapper = new QueryWrapper<>();
        if (stationCode != null && !stationCode.equals("")) {
            wrapper.eq("station_code", stationCode);
        }
        if (startTime != null && !startTime.equals("") && endTime != null && !endTime.equals("")) {
            wrapper.between("parsing_time", startTime, endTime);
        }
        if (fileStatus != null && !fileStatus.equals("")) {
            wrapper.eq("parsing_file_status", fileStatus);
        }
        if (fileType != null && !fileType.equals("")) {
            wrapper.eq("file_type", fileType);
        }
        return wrapper;
    }
}
