/*package cn.com.countrygarden.bi.main.service.mediaResource;


import cn.com.countrygarden.bi.main.dao.mediaResource.BasicInfoMapper;

import java.util.LinkedList;
import java.util.List;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
public class CommonService {

	
	@Autowired
	private BasicInfoMapper basicInfoMapper;
	
	 public List<TreeNode> getCommTree(String userCode) {
	        List<TreeNode> tree = new LinkedList<>();
	        List<CommunityInfo> communityInfoList = basicInfoMapper.queryCommInfo();
	        List<Integer> commIds = basicInfoMapper.queryCommId(userCode);

	        TreeNode tempCompany = new TreeNode();
	        TreeNode tempOrgan = new TreeNode();
	        for (CommunityInfo info : communityInfoList) {
	            TreeNode communityTreeNode = new TreeNode(info.getCommID().toString(), info.getCommName());
	            for (Integer id : commIds) {
	                if (id.equals(info.getCommID())) {
	                    if (info.getCompanyCode().equals(tempCompany.getId())) {
	                        if (info.getOrganCode().equals(tempOrgan.getId())) {
	                            // 同一（城市）公司，同一区域，不同项目
	                            tempCompany.getChildren().get(tempCompany.getChildren().size() - 1)
	                                    .getChildren().add(communityTreeNode);
	                        } else {
	                            // 同一（城市）公司，不同区域
	                            tempOrgan = new TreeNode(info.getOrganCode(), info.getOrganName(), new LinkedList<>());
	                            tempOrgan.getChildren().add(communityTreeNode);
	                            tempCompany.getChildren().add(tempOrgan);
	                        }
	                    } else {
	                        // 将（城市）公司临时变量加入结果列表中，排除第一次循环
	                        if (!StringUtils.isEmpty(tempCompany.getId())) {
	                            tree.add(tempCompany);
	                        }

	                        // 从当前记录获取（城市）公司的编码和名称、区域的编码和名称、项目的ID和名称，并保存在临时变量中
	                        tempOrgan = new TreeNode(info.getOrganCode(), info.getOrganName(), new LinkedList<>());
	                        tempOrgan.getChildren().add(communityTreeNode);
	                        tempCompany = new TreeNode(info.getCompanyCode(), info.getCompanyName(), new LinkedList<>());
	                        tempCompany.getChildren().add(tempOrgan);
	                    }
	                }
	            }
	        }

	        // 最后一个（城市）公司临时变量也需加入到结果列表中
	        tree.add(tempCompany);

	        return tree;
	    }
}
*/