package com.njcn.mysql.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.njcn.mysql.service.OracleDataService;
import com.njcn.oracle.bo.po.*;
import com.njcn.oracle.mapper.*;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

/**
 * @author xy
 */
@Service
@AllArgsConstructor
public class OracleDataServiceImpl implements OracleDataService {

    private final DayHarmrateVMapper dayHarmrateVMapper;
    private final PqsIntegrityMapper pqsIntegrityMapper;
    private final DayVMapper dayVMapper;
    private final PqsComAssesMapper pqsComAssesMapper;
    private final PqsAssesMapper pqsAssesMapper;
    private final DayIMapper dayIMapper;
    private final LimitRateMapper limitRateMapper;
    private final LimitTargetMapper limitTargetMapper;
    private final DayPltMapper dayPltMapper;
    private final DayFlickerMapper dayFlickerMapper;
    private final DayInharmVMapper dayInharmVMapper;
    private final LineMapper lineMapper;
    private final LineDetailMapper lineDetailMapper;



    @Override
    public List<DayHarmrateV> getDayHarmRate(String time) {
        LambdaQueryWrapper<DayHarmrateV> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.apply("TIMEID = to_date({0},'yyyy-mm-dd')",time);
        return dayHarmrateVMapper.selectList(lambdaQueryWrapper);
    }

    @Override
    public List<PqsIntegrity> getPqsIntegrity(String time) {
        LambdaQueryWrapper<PqsIntegrity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.apply("TIMEID = to_date({0},'yyyy-mm-dd')",time);
        return pqsIntegrityMapper.selectList(lambdaQueryWrapper);
    }

    @Override
    public List<DayV> getDayV(String time) {
        LambdaQueryWrapper<DayV> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.apply("TIMEID = to_date({0},'yyyy-mm-dd')",time);
        return dayVMapper.selectList(lambdaQueryWrapper);
    }

    @Override
    public List<LimitRate> getLimitRate(String time) {
        LambdaQueryWrapper<LimitRate> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.apply("TIMEID = to_date({0},'yyyy-mm-dd')",time);
        return limitRateMapper.selectList(lambdaQueryWrapper);
    }

    @Override
    public List<LimitTarget> getLimitTarget(String time) {
        LambdaQueryWrapper<LimitTarget> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.apply("TIMEID = to_date({0},'yyyy-mm-dd')",time);
        return limitTargetMapper.selectList(lambdaQueryWrapper);
    }

    @Override
    public List<PqsComAsses> getPqsComAsses(String time) {
        LambdaQueryWrapper<PqsComAsses> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.apply("TIMEID = to_date({0},'yyyy-mm-dd')",time);
        return pqsComAssesMapper.selectList(lambdaQueryWrapper);
    }

    @Override
    public List<PqsAsses> getPqsAsses(String time) {
        LambdaQueryWrapper<PqsAsses> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.apply("TIMEID = to_date({0},'yyyy-mm-dd')",time);
        return pqsAssesMapper.selectList(lambdaQueryWrapper);
    }

    @Override
    public List<DayI> getDayI(String time) {
        LambdaQueryWrapper<DayI> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.apply("TIMEID = to_date({0},'yyyy-mm-dd')",time);
        return dayIMapper.selectList(lambdaQueryWrapper);
    }

    @Override
    public List<DayPlt> getDayPlt(String time) {
        LambdaQueryWrapper<DayPlt> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.apply("TIMEID = to_date({0},'yyyy-mm-dd')",time);
        return dayPltMapper.selectList(lambdaQueryWrapper);
    }

    @Override
    public List<DayFlicker> getDayFlicker(String time) {
        LambdaQueryWrapper<DayFlicker> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.apply("TIMEID = to_date({0},'yyyy-mm-dd')",time);
        return dayFlickerMapper.selectList(lambdaQueryWrapper);
    }

    @Override
    public List<DayInharmV> getDayInHarmV(String time) {
        LambdaQueryWrapper<DayInharmV> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.apply("TIMEID = to_date({0},'yyyy-mm-dd')",time);
        return dayInharmVMapper.selectList(lambdaQueryWrapper);
    }

    @Override
    public List<Line> getLineList() {
        return lineMapper.selectList(new LambdaQueryWrapper<>());
    }

    @Override
    public List<LineDetail> getLineDetail() {
        return lineDetailMapper.selectList(new LambdaQueryWrapper<>());
    }
}
