Commit fbb8ce10 authored by 赵啸非's avatar 赵啸非

添加更新角色权限

parent d40a0024
......@@ -123,6 +123,29 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
this.doHandlerUser(entity);
}
@Override
protected void saveAfter(UserEntity entity, Context context) throws AppException {
//新增角色
updateUserRole(entity);
super.saveAfter(entity, context);
}
@Override
protected void updateAfter(UserEntity entity, Context context) throws AppException {
updateUserRole(entity);
super.updateAfter(entity, context);
}
private void updateUserRole(UserEntity entity) {
if (!ObjectUtils.isEmpty(entity.getId()) && entity.getId().longValue() != SysConstains.ADMIN_ID && !ObjectUtils.isEmpty(entity.getRoleIds())) {
RoleUserQuery roleUserQuery = new RoleUserQuery();
roleUserQuery.setUserId(entity.getId());
List<Long> idList = Arrays.asList(entity.getRoleIds().split(",")).stream().map(Long::parseLong).collect(Collectors.toList());
roleUserQuery.setRoleIdList(idList);
roleUserService.doDistributionRole(roleUserQuery);
}
}
@Override
protected UserEntity findBefore(UserEntity params, Context context) throws AppException {
// if (StringUtils.isNotEmpty(params.getDeptIds())) {
......
......@@ -59,13 +59,13 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic
}
}
@Override
/* @Override
protected void saveBefore(UserEntity entity, Map<String, Object> model, Context context) throws AppException {
if (!ObjectUtils.isEmpty(entity.getLoginName())&&service.existUser(entity.getLoginName(), entity.getId())) {
throw new AppException("登录名已存在!");
}
super.saveBefore(entity, model, context);
}
}*/
@RequestMapping(value = "change/password", method = RequestMethod.POST)
......
Markdown is supported
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