package com.yeejoin.amos.knowledgebase.face.util;

import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.model.BaseModel;
import org.typroject.tyboot.core.rdbms.orm.entity.BaseEntity;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
 * <h1><h1>
 *
 * @author tiantao
 * @date 2020/12/7 11:47
 */
public class BaseUtil {

    public static List<Long> getEntityIds(Collection<? extends BaseEntity> entityList){
        List<Long> idList = new ArrayList<>();
        if (!ValidationUtil.isEmpty(entityList)) {
            entityList.forEach(entity -> idList.add(entity.getSequenceNbr()));
        }
        return idList;
    }


    public static List<Long> getModelIds(Collection<? extends BaseModel> entityList){
        List<Long> idList = new ArrayList<>();
        if (!ValidationUtil.isEmpty(entityList)) {
            entityList.forEach(entity -> idList.add(entity.getSequenceNbr()));
        }
        return idList;
    }
}
