From d869b770e3f291bfce226c32664d7fa924817302 Mon Sep 17 00:00:00 2001
From: WangHao <43278047@qq.com>
Date: Fri, 2 Oct 2020 23:39:54 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=8F=9C=E5=8D=95=E6=A0=91?=
 =?UTF-8?q?=E7=9A=84=E8=AF=B7=E6=B1=82=E5=87=8F=E5=B0=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 ruoyi-ui/src/views/bookmark/index/index.vue           |  9 +++++++++
 .../bookmark/service/impl/SqBookmarkServiceImpl.java  | 11 +++++++++--
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/ruoyi-ui/src/views/bookmark/index/index.vue b/ruoyi-ui/src/views/bookmark/index/index.vue
index 4c9c231d9..3f785a268 100644
--- a/ruoyi-ui/src/views/bookmark/index/index.vue
+++ b/ruoyi-ui/src/views/bookmark/index/index.vue
@@ -479,6 +479,7 @@
       /** 新增书签Url操作 */
       addbookmarkurl:function(){
           this.reset();
+          this.getTreeselect();
           this.addopen = true;
 
         // getMenu(e.getAttribute("data-menuId")).then(response => {
@@ -548,6 +549,14 @@
       },
       /** 查询部门下拉树结构 */
       getTreeselect() {
+        if (this.zNodes!=null&&this.zNodes.length!=0){
+          this.menuOptions = [];
+          const data = { menuId: 0, menuName: '顶级菜单', children: [] };
+          data.children = this.handleTree(this.zNodes, "menuId", "parentId");
+          this.menuOptions.push(data);
+          return;
+        }
+
         listMenuByUserId().then(response => {
           this.menuOptions = [];
           const data = { menuId: 0, menuName: '顶级菜单', children: [] };
diff --git a/ruoyi-yunbookmark/src/main/java/com/ruoyi/bookmark/service/impl/SqBookmarkServiceImpl.java b/ruoyi-yunbookmark/src/main/java/com/ruoyi/bookmark/service/impl/SqBookmarkServiceImpl.java
index f87f4012f..151f9297b 100644
--- a/ruoyi-yunbookmark/src/main/java/com/ruoyi/bookmark/service/impl/SqBookmarkServiceImpl.java
+++ b/ruoyi-yunbookmark/src/main/java/com/ruoyi/bookmark/service/impl/SqBookmarkServiceImpl.java
@@ -6,7 +6,9 @@ import java.util.*;
 import cn.hutool.core.date.DateUtil;
 import com.ruoyi.bookmark.domain.SqBookmarkTag;
 
+import com.ruoyi.bookmark.domain.SqMenu;
 import com.ruoyi.bookmark.mapper.SqBookmarkTagMapper;
+import com.ruoyi.bookmark.mapper.SqMenuMapper;
 import com.ruoyi.bookmark.mapper.SqTagMapper;
 
 import com.ruoyi.bookmark.service.ISqTagService;
@@ -39,6 +41,9 @@ public class SqBookmarkServiceImpl implements ISqBookmarkService
     @Autowired
     private SqTagMapper sqTagMapper;
 
+    @Autowired
+    private SqMenuMapper sqMenuMapper;
+
 
     @Autowired
     private ISqTagService iSqTagService;
@@ -132,8 +137,10 @@ public class SqBookmarkServiceImpl implements ISqBookmarkService
             sqBookmarkTagMapper.insertSqBookmarkTag(bookamrktag);
         }
 
-
-
+        //给对应目录 +1
+        Long[] menuIds= new Long[1];
+        menuIds[0]=sqBookmark.getMenuId();
+        sqMenuMapper.updateCountAdd(menuIds,1);
         return i;
     }