日期:2014-05-20 浏览次数:20746 次
public class SpecMchnFloorEntity { private Integer mchnId; private Integer floorId; private String stopType; public void setMchnId(Integer mchnId) { this.mchnId = mchnId; } public Integer getMchnId() { return mchnId; } public void setFloorId(Integer floorId) { this.floorId = floorId; } public Integer getFloorId() { return floorId; } public void setStopType(String stopType) { this.stopType = stopType; } public String getStopType() { return stopType; } }
public class SpecBankFloorEntity { private Integer floorId; private String floorName; private List<SpecMchnFloorEntity> newSpecMchnFloorEntityList; public void setFloorId(Integer floorId) { this.floorId = floorId; } public Integer getFloorId() { return floorId; } public void setFloorName(String floorName) { this.floorName = floorName; } public String getFloorName() { return floorName; } public void setNewSpecMchnFloorEntityList( List<SpecMchnFloorEntity> newSpecMchnFloorEntityList) { this.newSpecMchnFloorEntityList = newSpecMchnFloorEntityList; } public List<SpecMchnFloorEntity> getNewSpecMchnFloorEntityList() { return newSpecMchnFloorEntityList; } }
public class SpecMchnEntity { private Integer mchnId; private String mchnName; public void setMchnId(Integer mchnId) { this.mchnId = mchnId; } public Integer getMchnId() { return mchnId; } public void setMchnName(String mchnName) { this.mchnName = mchnName; } public String getMchnName() { return mchnName; } }
import java.util.ArrayList; import java.util.List; public class SpecTest { public static void main(String[] args) { List<SpecMchnEntity> specMchnEntityList = setSpecMchnEntity(); for (SpecMchnEntity specMchnEntity : specMchnEntityList) { System.out.print(" " + specMchnEntity.getMchnName() + " "); } System.out.println(); List<SpecBankFloorEntity> SpecBankFloorEntityList = setSpecMchnFloorEntity(); for (SpecBankFloorEntity specBankFloorEntity : SpecBankFloorEntityList) { List<SpecMchnFloorEntity> specMchnFloorEntityList = specBankFloorEntity.getNewSpecMchnFloorEntityList(); System.out.print(specBankFloorEntity.getFloorName()); for (SpecMchnFloorEntity specMchnFloorEntity : specMchnFloorEntityList) { System.out.print(" " + specMchnFloorEntity.getStopType() + " "); } System.out.println(); } } private static List<SpecMchnEntity> setSpecMchnEntity() { List<SpecMchnEntity> specMchnEntityList = new ArrayList<SpecMchnEntity>(); SpecMchnEntity s = new SpecMchnEntity(); s.setMchnName("01"); specMchnEntityList.add(s); s = new SpecMchnEntity(); s.setMchnName("02"); specMchnEntityList.add(s); s = new SpecMchnEntity(); s.setMchnName("03"); specMchnEntityList.add(s); return specMchnEntityList; } private static List<SpecBankFloorEntity> setSpecMchnFloorEntity() { List<SpecBankFloorEntity> specMchnFloorEntityList = new ArrayList<SpecBankFloorEntity>(); SpecBankFloorEntity sbf = new SpecBankFloorEntity(); sbf.setFloorName("18"); List<SpecMchnFloorEntity> newSpecMchnFloorEntityList = new ArrayList<SpecMchnFloorEntity>(); SpecMchnFloorEntity smf = new SpecMchnFloorEntity(); smf.setStopType("1"); newSpecMchnFloorEntityList.add(smf); smf = new SpecMchnFloorEntity(); smf.setStopType("3"); newSpecMchnFloorEntityList.add(smf); smf = new SpecMchnFloorEntity(); smf.setStopType("4"); newSpecMchnFloorEntityList.add(smf); sbf.setNewSpecMchnFloorEntityList(newSpecMchnFloorEntityList); specMchnFloorEntityList.add(sbf); sbf = new SpecBankFloorEntity(); sbf.setFloorName("17"); newSpecMchnFloorEntityList = new ArrayList<SpecMchnFloorEntity>(); smf = new SpecMchnFloorEntity(); smf.setStopType("2"); newSpecMchnFloorEntityList.add(smf); smf = new SpecMchnFloorEntity(); smf.setStopType("3"); newSpecMchnFloorEntityList.add(smf); smf = new SpecMchnFloorEntity(); smf.setStopType("4"); newSpecMchnFloorEntityList.add(smf); sbf.setNewSpecMchnFloorEntityList(newSpecMchnFloorEntityList); specMchnFloorEntityList.add(sbf); sbf = new SpecBankFloorEntity(); sbf.setFloorName("16"); newSpecMchnFloorEntityList = new ArrayList<SpecMchnFloorEntity>(); smf = new SpecMchnFloorEntity(); smf.setStopType("3"); newSpecMchnFloorEntityList.add(smf); smf = new SpecMchnFloorEntity(); smf.setStopType("3"); newSpecMchnFloorEntityList.add(smf); smf = new SpecMchnFloorEntity(); smf.setStopType("4"); newSpecMchnFloorEntityList.add(smf); sbf.setNewSpecMchnFloorEntityList(newSpecMchnFloorEntityList); specMchnFloorEntityList.add(sbf); sbf = new SpecBankFloorEntity(); sbf.setFloorName("15"); newSpecMchnFloorEntityList = new ArrayList<SpecMchnFloorEntity>(); smf = new SpecMchnFloorEntity(); smf.setStopType("3"); newSpecMchnFloorEntityList.add(smf); smf = new SpecMchnFloorEntity(); smf.setStopType("3"); newSpecMchnFloorEntityList.add(smf); smf = new SpecMchnFloorEntity(); smf.setStopType("4"); newSpecMchnFloorEntityList.add(smf); sbf.setNewSpecMchnFloorEntityList(newSpecMchnFloorEntityList); specMchnFloorEntityList.add(sbf); return specMchnFloorEntityList; } }