Commit 5cf9633b authored by 赵啸非's avatar 赵啸非

修改用户列表查询

parent bb9ec0e5
......@@ -48,7 +48,7 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity
private RoleService roleService;
@Override
/* @Override
protected void findAfter(UserEntity entity, PageInfo pageInfo, Context context, List<UserEntity> list) throws AppException {
Map<Long, String> roleMap = roleService.find(new RoleQuery()).stream().collect(Collectors.toMap(x -> x.getId(), y -> y.getName()));
List<Long> userIdList = list.stream().map(item -> item.getId()).collect(Collectors.toList());
......@@ -62,7 +62,7 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity
}
});
super.findAfter(entity, pageInfo, context, list);
}
}*/
private void doHandlerUser(UserEntity entity) throws AppException {
if (StringUtils.isNotEmpty(entity.getLoginPwd())) {
......@@ -79,6 +79,9 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity
} else {
entity.setUserType(UserType.CUSTOMER.getValue());
}
}
@Override
......@@ -92,6 +95,12 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity
throw new AppException("你没有权限执行该操作");
}
this.doHandlerUser(entity);
if(!ObjectUtils.isEmpty(entity.getRoleId())){
RoleUserQuery roleUserQuery = new RoleUserQuery();
roleUserQuery.setUserId(entity.getId());
roleUserQuery.setRoleIdList(Arrays.asList(Long.parseLong(entity.getRoleId())));
roleUserService.assignRoleToUser(roleUserQuery);
}
}
......@@ -194,4 +203,19 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity
}
@Override
protected void saveAfter(UserEntity entity, Context context) throws AppException {
super.saveAfter(entity, context);
if(!ObjectUtils.isEmpty(entity.getRoleId())){
RoleUserQuery roleUserQuery = new RoleUserQuery();
roleUserQuery.setUserId(entity.getId());
roleUserQuery.setRoleIdList(Arrays.asList(Long.parseLong(entity.getRoleId())));
roleUserService.assignRoleToUser(roleUserQuery);
}
}
@Override
protected void updateAfter(UserEntity entity, Context context) throws AppException {
super.updateAfter(entity, context);
}
}
\ No newline at end of file
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