这几天有个新需求,无聊的报表,通过各种维度组合成一个树,点击数的节点,组合各种条件去查询数据,由于在树的不同层级,需要向上查找父节点,直到根节点的各种组合条件。所以一个基本的想法是从叶子节点向上递归得到各种条件.
给Team的人写了个简单的测试,包括一个树的VO, 条件的类.还有一个主类,测试用的
1. 定义 TreeVOpublic class TreeVO {
private int pid;
private int id;
private String name;
private String type;
private String code;
private Listchild = new ArrayList();
//...省去各种get,set.
}
2. 得到各种查询条件的类Condiction类,包含了各种维度
public class Condiction {
private String project;
private String region;
private String subcon;
//...省去set,get
}
3. 主要测试类:
public class MainClass {
public static void main(String[] args) {
MaptreeMap = new HashMap();
TreeVO tree = new TreeVO();
tree.setId(1);
tree.