package com.gaowj.util;

import java.util.List;
import java.util.Map;

import org.apache.commons.lang.StringUtils;

public class TakeUnitsUtils {
	
	public static String getp(List<Map<String, Object>> list, String uuid){
		String ret="";
		while(true){
			String is_parent_id = getParentIdUtils(list,uuid);
			if(StringUtils.isEmpty(is_parent_id)){
				break;
			}else{
				ret = ret+is_parent_id+",";
				uuid = is_parent_id;
			}
		}
		if(ret.length()>0){
			ret = ret.substring(0,ret.length() -1);
		}
		return ret;
	}
	
	public static String getParentIdUtils(List<Map<String, Object>> list, String uuid) {
		String ret = null;
    	for(Map<String, Object> map : list){
			if(map.get("UUID").equals(uuid)){
				ret = (String) map.get("PARENT_ID");
				break;
			}
			
		}
		return  ret;
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
