"sql/ry_20220808.sql" did not exist on "eab1b450d52782737aad6b0d1bed3e6884ec3a2f"
Commit ba4819f3 authored by 季圣华's avatar 季圣华
Browse files

权限控制

parent b2f5ef03
......@@ -140,8 +140,11 @@ public class UserController {
logService.insertLogWithUserId(user.getId(), user.getTenantId(), "用户",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_LOGIN).append(user.getLoginName()).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
JSONArray btnStrArr = userService.getBtnStrArrById(user.getId());
data.put("token", token);
data.put("user", user);
//用户的按钮权限
data.put("userBtn", btnStrArr);
}
res.code = 200;
res.data = data;
......
......@@ -754,4 +754,29 @@ public class UserService {
}
return userId;
}
/**
* 用户的按钮权限
* @param userId
* @return
* @throws Exception
*/
public JSONArray getBtnStrArrById(Long userId) throws Exception {
JSONArray btnStrArr = new JSONArray();
List<UserBusiness> userRoleList = userBusinessService.getBasicData(userId.toString(), "UserRole");
if(userRoleList!=null && userRoleList.size()>0) {
String roleValue = userRoleList.get(0).getValue();
if(StringUtil.isNotEmpty(roleValue) && roleValue.indexOf("[")>-1 && roleValue.indexOf("]")>-1){
roleValue = roleValue.replace("[", "").replace("]", ""); //角色id-单个
List<UserBusiness> roleFunctionsList = userBusinessService.getBasicData(roleValue, "RoleFunctions");
if(roleFunctionsList!=null && roleFunctionsList.size()>0) {
String btnStr = roleFunctionsList.get(0).getBtnStr();
if(StringUtil.isNotEmpty(btnStr)){
btnStrArr = JSONArray.parseArray(btnStr);
}
}
}
}
return btnStrArr;
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment