Commit 9674ad06 authored by 赵啸非's avatar 赵啸非

添加角色列表携带menuIds

parent 54581131
......@@ -1273,6 +1273,7 @@ data|object|数据对象
  createTime|Date|创建时间
  createUserId|Long|创建用户
  createUserName|String|创建用户名称
  childList|Arrays|菜单子列表
dict|object|字典对象
 linkType|object|字典属性对象,详见附录
 visible|object|字典属性对象,详见附录
......
......@@ -14,4 +14,7 @@ import java.util.List;
@Data
public class RoleVo extends BaseEntityLong {
/** 菜单ID列表 */
private List <Long> menuIdList;
}
\ No newline at end of file
......@@ -21,6 +21,8 @@ import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
* <p>Title: 角色信息</p>
......@@ -39,6 +41,17 @@ public class RoleServiceImpl extends AbstractCRUDServiceImpl<RoleDao, RoleEntity
@Autowired
private RoleUserService roleUserService;
@Override
protected void findAfter(RoleEntity entity, Context context, List<RoleEntity> list) throws AppException {
list.stream().forEach(item->{
List<Long> menuIds = roleAuthService.find(new RoleAuthQuery().roleId(item.getId())).stream().map(m -> m.getMenuId()).collect(Collectors.toList());
if(!ObjectUtils.isEmpty(menuIds)){
item.setMenuIdList(menuIds);
}
});
super.findAfter(entity, context, list);
}
@Override
protected void removeAfter(Long[] ids, Context context, int result) throws AppException {
RoleAuthQuery roleAuthQuery = new RoleAuthQuery();
......
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