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

添加角色列表携带menuIds

parent 54581131
...@@ -1273,6 +1273,7 @@ data|object|数据对象 ...@@ -1273,6 +1273,7 @@ data|object|数据对象
  createTime|Date|创建时间   createTime|Date|创建时间
  createUserId|Long|创建用户   createUserId|Long|创建用户
  createUserName|String|创建用户名称   createUserName|String|创建用户名称
  childList|Arrays|菜单子列表
dict|object|字典对象 dict|object|字典对象
 linkType|object|字典属性对象,详见附录  linkType|object|字典属性对象,详见附录
 visible|object|字典属性对象,详见附录  visible|object|字典属性对象,详见附录
......
...@@ -14,4 +14,7 @@ import java.util.List; ...@@ -14,4 +14,7 @@ import java.util.List;
@Data @Data
public class RoleVo extends BaseEntityLong { 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; ...@@ -21,6 +21,8 @@ import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/** /**
* <p>Title: 角色信息</p> * <p>Title: 角色信息</p>
...@@ -39,6 +41,17 @@ public class RoleServiceImpl extends AbstractCRUDServiceImpl<RoleDao, RoleEntity ...@@ -39,6 +41,17 @@ public class RoleServiceImpl extends AbstractCRUDServiceImpl<RoleDao, RoleEntity
@Autowired @Autowired
private RoleUserService roleUserService; 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 @Override
protected void removeAfter(Long[] ids, Context context, int result) throws AppException { protected void removeAfter(Long[] ids, Context context, int result) throws AppException {
RoleAuthQuery roleAuthQuery = new RoleAuthQuery(); 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