package org.example.background.dao;

import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.UpdateProvider;
import org.example.background.condition.ElectricityDataCondition;
import org.example.background.entity.ElectricityData;

public interface ElectricityDataDao {

    @InsertProvider(type = ElectricityDataCondition.class, method = "insert")
    Integer insert(ElectricityData data);

    @Select("SELECT * FROM electricity_data WHERE zd_id = #{zdId} AND acquisition_time = #{acquisitionTime} ORDER BY create_time LIMIT 1")
    ElectricityData select(ElectricityData data);

    @UpdateProvider(type = ElectricityDataCondition.class, method = "updateByPrimaryKey")
    Integer updateByPrimaryKey(ElectricityData data);
}
