日期:2014-05-18 浏览次数:20810 次
public String listValueStandard(){
System.out.println("listValueStandard");
List<ValueStandard> types=basicNormService.getAllValueStandard();
List<TreeJson> trees = new ArrayList<TreeJson>();
for(int i=0;i<types.size();i++){
TreeJson json = new TreeJson();
json.setId(types.get(i).getValueStandardId()+"");
System.out.println("pid"+types.get(i).getParentId());
if(types.get(i).getParentId()==null){
json.setPid(null);
}else{
json.setPid(types.get(i).getParentId()+"");
}
json.setText(types.get(i).getName());
trees.add(json);
}
List<TreeJson> jsons = ListToTree.formatTree(trees);
JSONArray jsonarray=JSONArray.fromObject(types);
listValueStandard=jsonarray.toString();
return "tovaluestandard";
}
public class ValueStandard implements java.io.Serializable {
// Fields
private Integer valueStandardId;
private Integer parentId;
private String name;
private String note;
private String sequence;
// Constructors
/** default constructor */
public ValueStandard() {
}
/** minimal constructor */
public ValueStandard(Integer parentId) {
this.parentId = parentId;
}
/** full constructor */
public ValueStandard(Integer parentId, String name, String note,
String sequence) {
this.parentId = parentId;
this.name = name;
this.note = note;
this.sequence = sequence;
}
// Property accessors
public Integer getValueStandardId() {
return this.valueStandardId;
}
public void setValueStandardId(Integer valueStandardId) {
this.valueStandardId = valueStandardId;
}
public Integer getParentId() {
return this.parentId;
}
public void setParentId(Integer parentId) {
this.parentId = parentId;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public String getNote() {
return this.note;
}
public void setNote(String note) {
this.note = note;
}
public String getSequence() {
return this.sequence;
}
public void setSequence(String sequence) {
this.sequence = sequence;
}
}