|
|
@@ -47,27 +47,27 @@ public class NewRoleApiController extends BaseApiController{
|
|
|
JSONObject jo = (JSONObject) JSON.parse(data);
|
|
|
if (jo != null) {
|
|
|
JSONArray permissions = jo.getJSONArray("permissions");
|
|
|
- List<String> permisionIds = new ArrayList<>();
|
|
|
+ List<String> permissionIds = new ArrayList<>();
|
|
|
for (int idx = 0; idx < permissions.size(); idx++) {
|
|
|
String pid = permissions.getString(idx);
|
|
|
- if(pid!=null)permisionIds.add(pid);
|
|
|
+ if(pid!=null)permissionIds.add(pid);
|
|
|
}
|
|
|
Role records = jo.toJavaObject(Role.class);
|
|
|
String newName=roleMapper.selectNameById(records.getId());
|
|
|
if(newName==null){
|
|
|
- String newid=roleMapper.selectIdByName(records.getRoleName());
|
|
|
- if(newid!=null){
|
|
|
+ String newId=roleMapper.selectIdByName(records.getRoleName());
|
|
|
+ if(newId!=null){
|
|
|
res.getError().add(buildError("","角色已存在"));
|
|
|
return res;
|
|
|
}
|
|
|
}else{
|
|
|
- String newid=roleMapper.selectIdByNamei(records);
|
|
|
- if(newid!=null){
|
|
|
+ String newId=roleMapper.selectIdByNamei(records);
|
|
|
+ if(newId!=null){
|
|
|
res.getError().add(buildError("","角色已存在,请更换名称"));
|
|
|
return res;
|
|
|
}
|
|
|
}
|
|
|
- res.setData(newRoleService.insert(records, permisionIds));
|
|
|
+ res.setData(newRoleService.insert(records, permissionIds));
|
|
|
} else {
|
|
|
res.getError().add(buildError("", "参数格式不正确"));
|
|
|
}
|