Search in sources :

Example 1 with RoleModel

use of org.lpw.ranch.editor.role.RoleModel in project ranch by heisedebaise.

the class EditorServiceImpl method queryUser.

@Override
public JSONObject queryUser() {
    PageList<RoleModel> roles = roleService.query(userHelper.id());
    JSONArray list = new JSONArray();
    roles.getList().forEach(role -> list.add(find(role.getEditor())));
    JSONObject object = roles.toJson(false);
    object.put("list", list);
    return object;
}
Also used : JSONObject(com.alibaba.fastjson.JSONObject) JSONArray(com.alibaba.fastjson.JSONArray) RoleModel(org.lpw.ranch.editor.role.RoleModel)

Example 2 with RoleModel

use of org.lpw.ranch.editor.role.RoleModel in project ranch by heisedebaise.

the class EditorServiceImpl method toJson.

private JSONObject toJson(EditorModel editor) {
    JSONObject object = modelHelper.toJson(editor);
    RoleModel role = roleService.find(userHelper.id(), editor.getId());
    if (role == null)
        return object;
    object.put("role", role.getType());
    return object;
}
Also used : JSONObject(com.alibaba.fastjson.JSONObject) RoleModel(org.lpw.ranch.editor.role.RoleModel)

Aggregations

JSONObject (com.alibaba.fastjson.JSONObject)2 RoleModel (org.lpw.ranch.editor.role.RoleModel)2 JSONArray (com.alibaba.fastjson.JSONArray)1