package com.huatek.busi.dao;

import com.huatek.frame.base.util.Constants;
import org.springframework.stereotype.Repository;
import org.springframework.util.StringUtils;

import com.huatek.busi.entity.BusiOfflineGisBrand;
import com.huatek.torch.sql.dao.impl.BaseDao;
import com.huatek.torch.util.uuid.Uuid;

import java.time.LocalDateTime;

/**
 * GIS标牌信息表 Dao
 *
 * @author walker_wang
 * @date Jul 4, 2019 1:50:06 PM
 */
@Repository
public class  BusiOfflineGisBrandDao extends BaseDao<BusiOfflineGisBrand, String> {

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

    public int insert(BusiOfflineGisBrand busiOfflineGisBrand){
        busiOfflineGisBrand.setId(Uuid.getUUID());
        busiOfflineGisBrand.setCreateTime(LocalDateTime.now());
        busiOfflineGisBrand.setStatus(Constants.DEFAULT_YES);
        return this.add(busiOfflineGisBrand);
    }
}

