package com.cpp.web.service.datafactory.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cpp.web.domain.datafactory.ParsingLog;
import com.cpp.web.mapper.datafactory.ParsingLogMapper;
import com.cpp.web.service.datafactory.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("cpp_parsing_time", startTime, endTime);
        }
        if (fileStatus != null && !fileStatus.equals("")) {
            wrapper.eq("cpp_parsing_file_status", fileStatus);
        }
        if (fileType != null && !fileType.equals("")) {
            wrapper.eq("file_type", fileType);
        }
        return wrapper;
    }
}
