package cn.cecep.talroad.service.impl.analysis;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import cn.cecep.talroad.common.core.utils.DateUtils;
import cn.cecep.talroad.domain.analysis.SRaGasPermittedEmissions;
import cn.cecep.talroad.domain.analysis.SRaWaterPermittedEmissions;
import cn.cecep.talroad.mapper.analysis.SRaWaterPermittedEmissionsMapper;
import cn.cecep.talroad.service.analysis.ISRaWaterPermittedEmissionsService;
import cn.cecep.talroad.vo.query.analysis.SRaWaterPermittedEmissionsQuery;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;




/**
 * 许可排放量废水明细Service业务层处理
 *
 * @author szhpt
 * @date 2023-06-02*/
@Service
public class SRaWaterPermittedEmissionsServiceImpl extends ServiceImpl<SRaWaterPermittedEmissionsMapper, SRaWaterPermittedEmissions> implements ISRaWaterPermittedEmissionsService
{
    @Autowired
    private SRaWaterPermittedEmissionsMapper sRaWaterPermittedEmissionsMapper;

    /**
     * 查询许可排放量废水明细列表
     *
     * @return 许可排放量废水明细
     */
    @Override
    public List<SRaWaterPermittedEmissions> selectSRaWaterPermittedEmissionsList(SRaWaterPermittedEmissionsQuery lambdaQueryWrapper)
    {
        if(StringUtils.isBlank(lambdaQueryWrapper.getInvalidDataCalculated())){
            lambdaQueryWrapper.setInvalidDataCalculated("0");
        }
        if(StringUtils.isNotBlank(lambdaQueryWrapper.getDataFlag())){
            lambdaQueryWrapper.setDataFlagArr(Arrays.asList(lambdaQueryWrapper.getDataFlag().split(",")));
        }
        Page<SRaWaterPermittedEmissions> page = new Page<>(1, 999999);
        List<SRaWaterPermittedEmissions> list=sRaWaterPermittedEmissionsMapper.selectSRaWaterPermittedEmissionsListBy(page,lambdaQueryWrapper);
        return list;
    }

    @Override
    public IPage<SRaWaterPermittedEmissions> selectSRaWaterPermittedEmissionsListBy(SRaWaterPermittedEmissionsQuery lambdaQueryWrapper) {
        if(StringUtils.isBlank(lambdaQueryWrapper.getInvalidDataCalculated())){
            lambdaQueryWrapper.setInvalidDataCalculated("0");
        }
        if(StringUtils.isNotBlank(lambdaQueryWrapper.getDataFlag())){
            lambdaQueryWrapper.setDataFlagArr(Arrays.asList(lambdaQueryWrapper.getDataFlag().split(",")));
        }
        Page<SRaWaterPermittedEmissions> page = new Page<>(lambdaQueryWrapper.getPageNum(), lambdaQueryWrapper.getPageSize());
        List<SRaWaterPermittedEmissions> list=sRaWaterPermittedEmissionsMapper.selectSRaWaterPermittedEmissionsListBy(page,lambdaQueryWrapper);
        page.setRecords(list);
        return page;
    }
    @Override
    public List<Map<String, Object>> pullMonitorNameOptions(String factoryName) {
        return sRaWaterPermittedEmissionsMapper.pullMonitorNameOptions(factoryName);
    }
}
