Commit 9d6a3783 authored by 廖旭伟's avatar 廖旭伟

登录用户菜单默认添加一级菜单bug修改

parent f9dc2bbc
......@@ -127,21 +127,9 @@ public class MenuServiceImpl extends AbstractCRUDServiceImpl<MenuDao, MenuEntity
public List<MenuEntity> findTreeMenuByUser(IUser user) throws AppException {
if (!user.isAdmin()) {
List<MenuEntity> menuList = dao.selectMenuTreeByUserId(user.getId());
if(CollectionUtils.isNotEmpty(menuList)) {
//转换为树结构
List<MenuEntity> menuTreeList = getChildPerms(menuList, -1);
return menuTreeList;
}else {
MenuQuery query = new MenuQuery();
query.setStatus(YesNo.YES.getValue());
query.setParentId(-1l);
List<OrderCol> orderColList = new ArrayList<OrderCol>();
orderColList.add(new OrderCol("parentId"));
orderColList.add(new OrderCol("orderId"));
query.setOrderColList(orderColList);
List<MenuEntity> menuEntityList = this.find(query);
return menuEntityList;
}
//转换为树结构
List<MenuEntity> menuTreeList = getChildPerms(menuList, -1);
return menuTreeList;
} else {
return findAllEnable();
}
......
......@@ -15,12 +15,16 @@
<select id="selectMenuTreeByUserId" parameterType="paramDto" resultMap="MenuEntity-Map">
select <include refid="_columns"/>
from mortals_xhx_menu a
left join mortals_xhx_role_auth rm on a.id = rm.menuId
left join mortals_xhx_role_user ur on rm.roleId = ur.roleId
left join mortals_xhx_role ro on ur.roleId = ro.id
left join mortals_xhx_user u on ur.userId = u.id
where u.id = #{condition.userId} and a.menuType in ('0','1','2') and a.status = 1
FROM (
SELECT m.*
from mortals_xhx_menu m
left join mortals_xhx_role_auth rm on m.id = rm.menuId
left join mortals_xhx_role_user ur on rm.roleId = ur.roleId
left join mortals_xhx_role ro on ur.roleId = ro.id
where ur.userId = #{condition.userId} and m.menuType in ('0','1','2') and m.status = 1
UNION
SELECT * from mortals_xhx_menu where parentId =-1
) a
order by a.parentId, a.orderId
</select>
......
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