springmvc从数据库中读取数据并且显示成选择框
来源:互联网 发布:美业邦软件的弊端 编辑:程序博客网 时间:2024/05/23 19:38
@RequestMapping(value = "/roleList/{userUuid}", method = RequestMethod.GET)
@ResponseBody
public String getAllRoles(@PathVariable("userUuid") String userUuid) {
RestEasyResponse<AccountRoleListResponse> restEasyResponse =accountAPI.getAllRoles();
AccountRoleListResponse allRoles = restEasyResponse.getEntity();
RestEasyResponse<AccountRoleListResponse> restEasyRsp =accountAPI.getUserRoles(userUuid);
AccountRoleListResponse userRoles = restEasyRsp.getEntity();
JSONObject object = new JSONObject();
if(allRoles.getList()!=null&&userRoles.getList()!=null){
object.put("success", true);
List<Map<String,Object>> list = new ArrayList<Map<String, Object>>();
for(AccountRoleResponse x:allRoles.getList()) {
Map<String, Object> item = new HashMap<String , Object>();
String id = x.getUuid();
String name = x.getName();
String pId = null;
item.put("id", id == null?"":id.trim());
item.put("name", name == null?"":name.trim());
item.put("pId", pId == null?"":pId.trim());
item.put("open", false);
AccountRoleResponse checked = null;
for(AccountRoleResponse y:userRoles.getList()) {
if(x.getUuid().equals(y.getUuid())) {
item.put("checked", true);
checked = y;
}
}
userRoles.getList().remove(checked);
list.add(item);
}
object.put("dimList", list);
} else {
object.put("success", false);
object.put("msg", "获取数据失败");
}
return object.toString();
}
@ResponseBody
public String getAllRoles(@PathVariable("userUuid") String userUuid) {
RestEasyResponse<AccountRoleListResponse> restEasyResponse =accountAPI.getAllRoles();
AccountRoleListResponse allRoles = restEasyResponse.getEntity();
RestEasyResponse<AccountRoleListResponse> restEasyRsp =accountAPI.getUserRoles(userUuid);
AccountRoleListResponse userRoles = restEasyRsp.getEntity();
JSONObject object = new JSONObject();
if(allRoles.getList()!=null&&userRoles.getList()!=null){
object.put("success", true);
List<Map<String,Object>> list = new ArrayList<Map<String, Object>>();
for(AccountRoleResponse x:allRoles.getList()) {
Map<String, Object> item = new HashMap<String , Object>();
String id = x.getUuid();
String name = x.getName();
String pId = null;
item.put("id", id == null?"":id.trim());
item.put("name", name == null?"":name.trim());
item.put("pId", pId == null?"":pId.trim());
item.put("open", false);
AccountRoleResponse checked = null;
for(AccountRoleResponse y:userRoles.getList()) {
if(x.getUuid().equals(y.getUuid())) {
item.put("checked", true);
checked = y;
}
}
userRoles.getList().remove(checked);
list.add(item);
}
object.put("dimList", list);
} else {
object.put("success", false);
object.put("msg", "获取数据失败");
}
return object.toString();
}
阅读全文
1 0
- springmvc从数据库中读取数据并且显示成选择框
- springmvc从数据库中读取数据并且显示成选择框工具类
- C#从数据库中读取二进制数据,并显示图片
- 从数据库中读取数据显示到树
- jsonp从服务器读取数据并且予以显示
- 使用原生JDBC从数据库读取数据并且封装
- SpringMVC从数据库中读取图片显示到JSP页面上
- SpringMVC从数据库中读取图片显示到JSP页面上
- 从cmos中读取数据并显示
- ASP.net 从数据库中读取html格式的数据并显示在页面中
- 从数据库中读取出的数据如何在GridView显示成我们所需要的内容?
- 从数据库中读取数据创建菜单
- 从数据库中读取XML数据
- 从数据库中读取序列化数据
- 从数据库中读取数据到Excel
- 幻灯片从数据库中读取数据
- 如何从数据库中读取数据
- HighCharts从数据库中读取数据
- 118. Pascal's Triangle
- Spring Boot 日志配置(超详细)
- Opencv 中cv开头的函数和没有cv的区别,例如cvWaitkey()和waitKey()的区别
- 自定义控件之自定义xmlns
- linux c++ 简易聊天室
- springmvc从数据库中读取数据并且显示成选择框
- Crontab 使用说明
- mysql5.7设置密码安全级别 ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
- 遥感影像镶嵌软件功能介绍
- PyQt5中文基础教程12 俄罗斯方块游戏
- TCP/IP学习笔记(一)基础知识
- 原型模式
- hdu 2586 How far away? 【LCA】 解题报告
- V4的NotificationManagerCompat,v7的NotificationCompat