public void MyGroupList(){
AccountSession accountSession = ((AccountSession) getSessionObj("sessiongzlxadmin"));
accountSession.getAccountid();
//用户id查询分组
Map<String, Object> argMap = new HashMap<String, Object>();
argMap.put("accountid", accountSession.getAccountid());
//获取用户的分组
List<Object> grouplist = _gzlxService.selectAllByMapParam("T_GZLX_GROUP_selectAllByMapParam", argMap);
JSONArray jsonListFz = new JSONArray();
JSONObject jsonObejectfz = new JSONObject();
jsonObejectfz.put("id", "0");
jsonObejectfz.put("text", "我的分组");
JSONArray jsonArrayCy = new JSONArray();
for (int i = 0; i < grouplist.size(); i++) {
JSONObject jsonObejectZm = new JSONObject();
GroupInfo group=(GroupInfo)grouplist.get(i);
jsonObejectZm.put("id", group.getId());
jsonObejectZm.put("text", group.getGroupname());
jsonObejectZm.put("state", "closed");
Map<String, Object> argMap2 = new HashMap<String, Object>();
argMap2.put("groupid", group.getId());
List<Object> groupMemberlist = _gzlxService.selectAllByMapParam("T_GZLX_GROUP_MEMBER_selectAllByMapParam", argMap2);
//组名下成员
JSONArray jsonArrayMember = new JSONArray();
for (int j = 0; j < groupMemberlist.size(); j++) {
JSONObject jsonObejectPerson = new JSONObject();
GroupMemberInfo groupMemberInfo=(GroupMemberInfo)groupMemberlist.get(j);
jsonObejectPerson.put("id", groupMemberInfo.getAccountid());
jsonObejectPerson.put("text", groupMemberInfo.getLxrxm());
jsonArrayMember.add(jsonObejectPerson);
}
if(jsonArrayMember.size() == 0){
JSONObject jsonObejectPerson1 = new JSONObject();
jsonObejectPerson1.put("id", "0");
jsonObejectPerson1.put("text","无");
jsonArrayMember.add(jsonObejectPerson1);
}
jsonObejectZm.put("children", jsonArrayMember);
jsonArrayCy.add(jsonObejectZm);
}
jsonObejectfz.put("children",jsonArrayCy);
jsonListFz.add(jsonObejectfz);
System.out.println(jsonListFz.toString());
this.renderText(jsonListFz.toString());
}
java如何拼接json字符串数组 java拼装json
转载文章标签 java如何拼接json字符串数组 java拼装 json json List sed 文章分类 Java 后端开发
-
Java设置JSON字符串参数编码
本文详细介绍了如何在Java中创建JSON字符串以及在Java中设置JSON字符串参数编码的方法。
json 字符串 JSON Java -
java中字符串拼接的多种方式
java中字符串拼接的多种方式
java 字符串拼接 -
java中json如何拼接字符串数组 java json字符串转jsonobject
1. 使用google依赖<dependency> <groupId>com.vaadin.external.google</groupId> <artifactId>android-json</artifactId> <version>0.0.20131108.vaadin1</version&
java中json如何拼接字符串数组 JSONObject json字符串 json Test -
eventsystem识别不到物体
问题: 说明: 在处理向该请求提供服务所需的配置文件时出错。请检查下面的特定错误详细信息并适当地修改配置文件。 分析器错误信息: 无法识别的属性“type”。 原因: .NET的版本问题。如果将 IIS 网站的应用程序扩展映射到 Microsoft .NET Framework 1.1 或 Microsoft .NET Framework 1.0,则会出
eventsystem识别不到物体 asp.net microsoft .net internet