package com.huatek.busi.dao;

import com.huatek.busi.entity.TransformerInfraredMonitoringCache;
import com.huatek.busi.entity.TransformerWindingTemperatureCache;
import com.huatek.torch.sql.dao.impl.BaseDao;
import com.huatek.torch.util.uuid.Uuid;
import org.springframework.stereotype.Repository;
import org.springframework.util.StringUtils;

/**
 * 变压器绕组监测暂存数据 Dao
 *
 * @author anker_cheng
 * @date Jun 28, 2019 1:20:56 PM
 */
@Repository
public class TransformerWindingTemperatureCacheDao extends BaseDao<TransformerWindingTemperatureCache, String> {

    public int saveOrUpdate(TransformerWindingTemperatureCache transformerWindingTemperatureCache) {
        if(StringUtils.isEmpty(transformerWindingTemperatureCache.getId())) {
            transformerWindingTemperatureCache.setId(Uuid.getUUID());
            return this.add(transformerWindingTemperatureCache);
        }
        return this.updateLocal(transformerWindingTemperatureCache);
    }
}

