关闭

@TreeResponseBody: 方法体注解。

94人阅读 评论(0) 收藏 举报
分类:
引用类名: com.sgcc.uap.rest.annotation.TreeResponseBody
返回树节点,该注解将节点信息的 list 集合转换为如下 json 格式:
{"nodes":[{"id":"","text":"","hasChild":true,"itemType":"","imgUrl":n

SG-UAP 高级开发手册
第 17 页/共 330 页
ull}]}
使用示例:
public @TreeResponseBody List<TreeNode> getRoot() {
List<MxDepartment> list = treeBizc.listRoot(MxDepartment.
class,
"superdepartmentid");//MxDepartmentpo
List<TreeNode> nodelist = new ArrayList<TreeNode>();
for (int i = 0; i < list.size(); i++) {
TreeNode node = 
new TreeNode();
MxDepartment mxdepartment = (MxDepartment) list.get(i);
node.setId(mxdepartment.getDepartId()); 
//主键的get方法
boolean hasChild =
treeBizc.hasChild( mxdepartment.getDepartId(),
MxDepartment.
class,"superdepartmentid");
node.setHasChildren(hasChild);
node.setText(mxdepartment.getDepartName()==
null?"":mxdepartmen
t.getDepartName());
//显示字段的get方法
node.setItemType("mxdepartment"); //根节点的itemType
nodelist.add(node);
}
return nodelist;
}
返回参数格式:
{
"successful":true,"resultValue":{"nodes":[{"id":"000000001","tex
t"
:"总经理工作部
","imageUrl":null,"hasChildren":false,"itemType":"mxdepartment","
displayMode"
:null,"childNodes":null,"customProps":null},{},{},
{},...]},
"resultHint":"","errorPage":"","type":""}

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:12488次
    • 积分:731
    • 等级:
    • 排名:千里之外
    • 原创:58篇
    • 转载:22篇
    • 译文:3篇
    • 评论:0条
    文章分类