package com.njcn.prepare.harmonic.service.mysql.Impl.line;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
import com.njcn.harmonic.pojo.po.RMpEventDetailDPO;
import com.njcn.prepare.harmonic.mapper.mysql.line.RMpEventDetailDMapper;
import com.njcn.prepare.harmonic.service.mysql.line.RMpEventDetailDService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 
 * Description:
 * 接口文档访问地址：http://serverIP:port/swagger-ui.html
 * Date: 2022/12/28  14:58【需求编号】
 *
 * @author clam
 * @version V1.0.0
 */
@Service
@AllArgsConstructor
public class RMpEventDetailDServiceImpl extends MppServiceImpl<RMpEventDetailDMapper, RMpEventDetailDPO> implements RMpEventDetailDService{


    private final RMpEventDetailDMapper rMpEventDetailDMapper;

    /**
     * @param lineId
     * @param dataDate
     * @Description: queryOneMothData
     * @Param: [lineId, dataDate]
     * @return: java.util.List<com.njcn.prepare.harmonic.pojo.mysql.po.line.RMpEventDetailDPO>
     * @Author: clam
     * @Date: 2022/12/28
     */
    @Override
    public List<RMpEventDetailDPO> queryOneMothData(String lineId, String dataDate) {

        QueryWrapper<RMpEventDetailDPO> queryWrapper = new QueryWrapper<> ();
        queryWrapper.eq ("measurement_point_id", lineId).
                eq("DATE_FORMAT( data_date ,'%Y-%m')",dataDate.substring (0, 7));
        List<RMpEventDetailDPO> list = rMpEventDetailDMapper.selectList (queryWrapper);
        return list;
    }
}
