package com.njcn.prepare.harmonic.service.oracle.Impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
import com.njcn.prepare.harmonic.mapper.mysql.area.PqsEventdetailMapper;
import com.njcn.prepare.harmonic.pojo.oracle.PqsEventdetailPO;
import com.njcn.prepare.harmonic.service.oracle.PqsEventdetailService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
/**
 * 
 * Description:
 * 接口文档访问地址：http://serverIP:port/swagger-ui.html
 * Date: 2022/12/28  13:46【需求编号】
 *
 * @author clam
 * @version V1.0.0
 */
@Service
@DS ("oracle")
@RequiredArgsConstructor
public class PqsEventdetailServiceImpl extends MppServiceImpl<PqsEventdetailMapper, PqsEventdetailPO> implements PqsEventdetailService{



    private final
    PqsEventdetailMapper pqsEventdetailMapper;

    /**
     * @param lineId
     * @param dataDate
     * @param sag
     * @Description: 根据条件查询监测点超标次数
     * @Param: [lineId, dataDate, sag]
     * @return: java.lang.Integer
     * @Author: clam
     * @Date: 2022/12/28
     */
    @Override
    public Integer queryByCondition(Integer lineId, String dataDate, Integer sag) {
        QueryWrapper<PqsEventdetailPO> queryWrapper = new QueryWrapper ( );
        queryWrapper.select ("1").
                eq ("lineid", lineId).
                eq ("WAVETYPE",sag).
                eq("TO_CHAR(TIMEID, 'yyyy-mm-dd')",dataDate);

        Integer integer = pqsEventdetailMapper.selectCount (queryWrapper);

        return integer;
    }
}
