增加用户列表接口

This commit is contained in:
季圣华
2020-11-03 00:42:31 +08:00
parent 9be0bcc80c
commit ab31aed434

View File

@@ -259,6 +259,31 @@ public class UserController {
return res; return res;
} }
/**
* 用户列表,用于用户下拉框
* @param request
* @return
* @throws Exception
*/
@GetMapping(value = "/getUserList")
public JSONArray getUserList(HttpServletRequest request)throws Exception {
JSONArray dataArray = new JSONArray();
try {
List<User> dataList = userService.getUser();
if (null != dataList) {
for (User user : dataList) {
JSONObject item = new JSONObject();
item.put("id", user.getId());
item.put("userName", user.getUsername());
dataArray.add(item);
}
}
} catch(Exception e){
e.printStackTrace();
}
return dataArray;
}
/** /**
* create by: cjl * create by: cjl
* description: * description: