package com.gyee.wisdom.dao.sql.control;

import com.gyee.wisdom.common.data.control.ControlLog;
import com.gyee.wisdom.dao.control.IControlLogDao;
import com.gyee.wisdom.dao.sql.control.entity.ControlLogEntity;
import com.gyee.wisdom.dao.sql.control.repository.ControlLogRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.List;
import java.util.logging.LogManager;
import java.util.logging.Logger;

/**
 * @descrition:
 * @author:Wanghs
 * @date:2019-09-10
 */
@Component
public class JpaControlLogDao implements IControlLogDao {


    @Autowired
    private ControlLogRepository controlLogRepository;

    @Override
    public List<ControlLog> getLog(String windturbineId, String stationId, int type, Date startTime, Date endTime) {
        return null;
    }

    @Override
    public boolean writeLog(ControlLog logData) {
        boolean result = false;
        try {
            ControlLogEntity entity = new ControlLogEntity(logData);
            controlLogRepository.save(entity);
            result = true;
        } catch (Exception ex) {
           System.out.println("日志写入异常");
        } finally {
            return result;
        }
    }
}
