From 67d95c4a28af3e9c17363737a2ef4c558187781c Mon Sep 17 00:00:00 2001 From: fanxb Date: Wed, 17 Jul 2019 17:30:40 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Feat:=20[=E5=90=8E=E5=8F=B0]:?= =?UTF-8?q?=E5=AE=8C=E6=88=90=E7=BC=96=E8=BE=91=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/BookmarkController.java | 179 +++++---- .../business/bookmark/dao/BookmarkDao.java | 184 +++++---- .../bookmark/service/BookmarkService.java | 379 +++++++++--------- .../mapper/bookmark-bookmarkMapper.xml | 162 ++++---- 4 files changed, 478 insertions(+), 426 deletions(-) diff --git a/bookMarkService/business/bookmark/src/main/java/com/fanxb/bookmark/business/bookmark/controller/BookmarkController.java b/bookMarkService/business/bookmark/src/main/java/com/fanxb/bookmark/business/bookmark/controller/BookmarkController.java index ba21010..379b057 100644 --- a/bookMarkService/business/bookmark/src/main/java/com/fanxb/bookmark/business/bookmark/controller/BookmarkController.java +++ b/bookMarkService/business/bookmark/src/main/java/com/fanxb/bookmark/business/bookmark/controller/BookmarkController.java @@ -1,82 +1,97 @@ -package com.fanxb.bookmark.business.bookmark.controller; - -import com.fanxb.bookmark.business.bookmark.entity.BatchDeleteBody; -import com.fanxb.bookmark.business.bookmark.service.BookmarkService; -import com.fanxb.bookmark.common.entity.Bookmark; -import com.fanxb.bookmark.common.entity.Result; -import com.fanxb.bookmark.common.util.UserContextHolder; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -/** - * 类功能简述: - * 类功能详述: - * - * @author fanxb - * @date 2019/7/8 15:12 - */ -@RestController -@RequestMapping("/bookmark") -public class BookmarkController { - - @Autowired - private BookmarkService bookmarkService; - - /** - * Description: 获取路径为path的书签数据 - * - * @param path 路径 - * @return com.fanxb.bookmark.common.entity.Result - * @author fanxb - * @date 2019/7/15 13:36 - */ - @GetMapping("/currentUser/path") - public Result getCurrentBookmarkList(String path) { - return Result.success(bookmarkService.getBookmarkListByPath(UserContextHolder.get().getUserId(), path)); - } - - /** - * Description: 上传书签备份文件,并解析 - * - * @param file 文件 - * @param path 存放节点路径(根节点为空字符串) - * @return com.fanxb.bookmark.common.entity.Result - * @author fanxb - * @date 2019/7/8 15:17 - */ - @PutMapping("/uploadBookmarkFile") - public Result uploadFile(@RequestParam("file") MultipartFile file, @RequestParam("path") String path) throws Exception { - bookmarkService.parseBookmarkFile(UserContextHolder.get().getUserId(), file.getInputStream(), path); - return Result.success(null); - } - - /** - * Description: 新增一条书签 - * - * @param bookmark 书签信息 - * @return com.fanxb.bookmark.common.entity.Result - * @author fanxb - * @date 2019/7/12 17:28 - */ - @PutMapping("") - public Result addOne(@RequestBody Bookmark bookmark) { - bookmark = bookmarkService.addOne(bookmark); - return Result.success(bookmark); - } - - /** - * Description: 批量删除 - * - * @param body 批量删除表单 - * @return com.fanxb.bookmark.common.entity.Result - * @author fanxb - * @date 2019/7/12 17:28 - */ - @PostMapping("/batchDelete") - public Result batchDelete(@RequestBody BatchDeleteBody body) { - bookmarkService.batchDelete(UserContextHolder.get().getUserId(), body.getFolderIdList(), body.getBookmarkIdList()); - return Result.success(null); - } - -} +package com.fanxb.bookmark.business.bookmark.controller; + +import com.fanxb.bookmark.business.bookmark.entity.BatchDeleteBody; +import com.fanxb.bookmark.business.bookmark.service.BookmarkService; +import com.fanxb.bookmark.common.entity.Bookmark; +import com.fanxb.bookmark.common.entity.Result; +import com.fanxb.bookmark.common.util.UserContextHolder; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +/** + * 类功能简述: + * 类功能详述: + * + * @author fanxb + * @date 2019/7/8 15:12 + */ +@RestController +@RequestMapping("/bookmark") +public class BookmarkController { + + @Autowired + private BookmarkService bookmarkService; + + /** + * Description: 获取路径为path的书签数据 + * + * @param path 路径 + * @return com.fanxb.bookmark.common.entity.Result + * @author fanxb + * @date 2019/7/15 13:36 + */ + @GetMapping("/currentUser/path") + public Result getCurrentBookmarkList(String path) { + return Result.success(bookmarkService.getBookmarkListByPath(UserContextHolder.get().getUserId(), path)); + } + + /** + * Description: 上传书签备份文件,并解析 + * + * @param file 文件 + * @param path 存放节点路径(根节点为空字符串) + * @return com.fanxb.bookmark.common.entity.Result + * @author fanxb + * @date 2019/7/8 15:17 + */ + @PutMapping("/uploadBookmarkFile") + public Result uploadFile(@RequestParam("file") MultipartFile file, @RequestParam("path") String path) throws Exception { + bookmarkService.parseBookmarkFile(UserContextHolder.get().getUserId(), file.getInputStream(), path); + return Result.success(null); + } + + /** + * Description: 新增一条书签 + * + * @param bookmark 书签信息 + * @return com.fanxb.bookmark.common.entity.Result + * @author fanxb + * @date 2019/7/12 17:28 + */ + @PutMapping("") + public Result addOne(@RequestBody Bookmark bookmark) { + bookmark = bookmarkService.addOne(bookmark); + return Result.success(bookmark); + } + + + /** + * Description: 编辑当前用户的一个书签节点 + * + * @param bookmark bookmark + * @return com.fanxb.bookmark.common.entity.Result + * @author fanxb + * @date 2019/7/17 14:40 + */ + @PostMapping("/updateOne") + public Result editCurrentUserBookmark(@RequestBody Bookmark bookmark) { + bookmarkService.updateOne(UserContextHolder.get().getUserId(), bookmark); + return Result.success(null); + } + + /** + * Description: 批量删除 + * + * @param body 批量删除表单 + * @return com.fanxb.bookmark.common.entity.Result + * @author fanxb + * @date 2019/7/12 17:28 + */ + @PostMapping("/batchDelete") + public Result batchDelete(@RequestBody BatchDeleteBody body) { + bookmarkService.batchDelete(UserContextHolder.get().getUserId(), body.getFolderIdList(), body.getBookmarkIdList()); + return Result.success(null); + } + +} diff --git a/bookMarkService/business/bookmark/src/main/java/com/fanxb/bookmark/business/bookmark/dao/BookmarkDao.java b/bookMarkService/business/bookmark/src/main/java/com/fanxb/bookmark/business/bookmark/dao/BookmarkDao.java index 350d52c..e8191b4 100644 --- a/bookMarkService/business/bookmark/src/main/java/com/fanxb/bookmark/business/bookmark/dao/BookmarkDao.java +++ b/bookMarkService/business/bookmark/src/main/java/com/fanxb/bookmark/business/bookmark/dao/BookmarkDao.java @@ -1,83 +1,101 @@ -package com.fanxb.bookmark.business.bookmark.dao; - -import com.fanxb.bookmark.common.entity.Bookmark; -import org.apache.ibatis.annotations.Param; -import org.springframework.stereotype.Component; - -import java.util.List; - -/** - * 类功能简述: - * 类功能详述: - * - * @author fanxb - * @date 2019/7/8 16:39 - */ -@Component -public interface BookmarkDao { - - /** - * Description: 插入一条书签记录 - * - * @param node node - * @return void - * @author fanxb - * @date 2019/7/8 16:49 - */ - void insertOne(Bookmark node); - - /** - * Description: 根据用户名和name获取节点id - * - * @param userId 用户名 - * @param name 姓名 - * @param path 当前节点路径 - * @return Integer - * @author fanxb - * @date 2019/7/8 17:18 - */ - Integer selectIdByUserIdAndNameAndPath(@Param("userId") int userId, @Param("name") String name, @Param("path") String path); - - /** - * Description: - * - * @param userId 用户id - * @param path 父节点路径 - * @return java.lang.Integer - * @author fanxb - * @date 2019/7/8 17:35 - */ - Integer selectMaxSort(@Param("userId") int userId, @Param("path") String path); - - /** - * Description: 根据用户id获取其所有数据 - * - * @param userId userid - * @return java.util.List - * @author fanxb - * @date 2019/7/9 18:55 - */ - List getListByUserId(int userId); - - List getListByUserIdAndPath(@Param("userId") int userId,@Param("path") String path); - - /** - * Description: 删除某用户某个书签文件下所有数据 - * - * @param userId 用户id - * @param folderId 文件夹id - * @author fanxb - * @date 2019/7/12 14:13 - */ - void deleteUserFolder(@Param("userId") int userId, @Param("folderId") int folderId); - - /** - * Description: 删除用户书签 - * - * @param userId 用户id - * @param bookmarkIds 书签id - * @author fanxb - * @date 2019/7/12 17:24 - */ - void deleteUserBookmark(@Param("userId") int userId, @Param("bookmarkIds") List bookmarkIds); -} +package com.fanxb.bookmark.business.bookmark.dao; + +import com.fanxb.bookmark.common.entity.Bookmark; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Component; + +import java.util.List; + +/** + * 类功能简述: + * 类功能详述: + * + * @author fanxb + * @date 2019/7/8 16:39 + */ +@Component +public interface BookmarkDao { + + /** + * Description: 插入一条书签记录 + * + * @param node node + * @return void + * @author fanxb + * @date 2019/7/8 16:49 + */ + void insertOne(Bookmark node); + + /** + * Description: 根据用户名和name获取节点id + * + * @param userId 用户名 + * @param name 姓名 + * @param path 当前节点路径 + * @return Integer + * @author fanxb + * @date 2019/7/8 17:18 + */ + Integer selectIdByUserIdAndNameAndPath(@Param("userId") int userId, @Param("name") String name, @Param("path") String path); + + /** + * Description: + * + * @param userId 用户id + * @param path 父节点路径 + * @return java.lang.Integer + * @author fanxb + * @date 2019/7/8 17:35 + */ + Integer selectMaxSort(@Param("userId") int userId, @Param("path") String path); + + /** + * Description: 根据用户id获取其所有数据 + * + * @param userId userid + * @return java.util.List + * @author fanxb + * @date 2019/7/9 18:55 + */ + List getListByUserId(int userId); + + /** + * Description: 根据userId和path查询path下的子节点 + * + * @param userId userId + * @param path path + * @return java.util.List + * @author fanxb + * @date 2019/7/17 14:48 + */ + List getListByUserIdAndPath(@Param("userId") int userId, @Param("path") String path); + + /** + * Description: 删除某用户某个书签文件下所有数据 + * + * @param userId 用户id + * @param folderId 文件夹id + * @author fanxb + * @date 2019/7/12 14:13 + */ + void deleteUserFolder(@Param("userId") int userId, @Param("folderId") int folderId); + + /** + * Description: 删除用户书签 + * + * @param userId 用户id + * @param bookmarkIds 书签id + * @author fanxb + * @date 2019/7/12 17:24 + */ + void deleteUserBookmark(@Param("userId") int userId, @Param("bookmarkIds") List bookmarkIds); + + /** + * Description: 编辑书签 + * + * @author fanxb + * @date 2019/7/17 14:49 + * @param bookmark bookmark + */ + void editBookmark(Bookmark bookmark); +} diff --git a/bookMarkService/business/bookmark/src/main/java/com/fanxb/bookmark/business/bookmark/service/BookmarkService.java b/bookMarkService/business/bookmark/src/main/java/com/fanxb/bookmark/business/bookmark/service/BookmarkService.java index c4d240e..1bda96e 100644 --- a/bookMarkService/business/bookmark/src/main/java/com/fanxb/bookmark/business/bookmark/service/BookmarkService.java +++ b/bookMarkService/business/bookmark/src/main/java/com/fanxb/bookmark/business/bookmark/service/BookmarkService.java @@ -1,183 +1,196 @@ -package com.fanxb.bookmark.business.bookmark.service; - -import com.fanxb.bookmark.business.bookmark.dao.BookmarkDao; -import com.fanxb.bookmark.common.entity.Bookmark; -import com.fanxb.bookmark.common.exception.CustomException; -import com.fanxb.bookmark.common.util.UserContextHolder; -import org.jsoup.Jsoup; -import org.jsoup.nodes.Document; -import org.jsoup.nodes.Element; -import org.jsoup.select.Elements; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.dao.DuplicateKeyException; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.io.InputStream; -import java.util.List; - -/** - * 类功能简述: - * 类功能详述: - * - * @author fanxb - * @date 2019/7/8 15:00 - */ -@Service -public class BookmarkService { - /** - * chrome导出书签tag - */ - private static final String DT = "dt"; - private static final String A = "a"; - - @Autowired - private BookmarkDao bookmarkDao; - - /** - * Description: 解析书签文件 - * - * @param stream 输入流 - * @param path 存放路径 - * @author fanxb - * @date 2019/7/9 18:44 - */ - @Transactional(rollbackFor = Exception.class) - public void parseBookmarkFile(int userId, InputStream stream, String path) throws Exception { - Document doc = Jsoup.parse(stream, "utf-8", ""); - Elements elements = doc.select("html>body>dl>dt"); - //获取当前层sort最大值 - Integer sortBase = bookmarkDao.selectMaxSort(1, path); - if (sortBase == null) { - sortBase = 0; - } - int count = 0; - for (int i = 0, length = elements.size(); i < length; i++) { - if (i == 0) { - Elements firstChildren = elements.get(0).child(1).children(); - count = firstChildren.size(); - for (int j = 0; j < count; j++) { - dealBookmark(userId, firstChildren.get(j), path, sortBase + j); - } - } else { - dealBookmark(userId, elements.get(i), path, sortBase + count + i - 1); - } - } - } - - - /** - * Description: 根据userId和path获取书签列表 - * - * @param userId userId - * @param path path - * @return java.util.List - * @author fanxb - * @date 2019/7/15 13:40 - */ - public List getBookmarkListByPath(int userId, String path) { - return bookmarkDao.getListByUserIdAndPath(userId, path); - } - - - /** - * Description: 批量删除书签 - * - * @param userId 用户id - * @param folderIdList 书签文件夹id list - * @param bookmarkIdList 书签id list - * @author fanxb - * @date 2019/7/12 14:09 - */ - @Transactional(rollbackFor = Exception.class) - public void batchDelete(int userId, List folderIdList, List bookmarkIdList) { - for (Integer item : folderIdList) { - bookmarkDao.deleteUserFolder(userId, item); - bookmarkIdList.add(item); - } - bookmarkDao.deleteUserBookmark(userId, bookmarkIdList); - } - - /** - * Description: 详情 - * - * @param bookmark 插入一条记录 - * @return com.fanxb.bookmark.common.entity.Bookmark - * @author fanxb - * @date 2019/7/12 17:18 - */ - public Bookmark addOne(Bookmark bookmark) { - int userId = UserContextHolder.get().getUserId(); - Integer sort = bookmarkDao.selectMaxSort(userId, bookmark.getPath()); - bookmark.setSort(sort == null ? 1 : sort + 1); - bookmark.setUserId(userId); - bookmark.setCreateTime(System.currentTimeMillis()); - bookmark.setAddTime(bookmark.getCreateTime()); - try { - bookmarkDao.insertOne(bookmark); - } catch (DuplicateKeyException e) { - throw new CustomException("同级目录下不能存在相同名称的数据"); - } - return bookmark; - } - - - /** - * Description: 处理html节点,解析出文件夹和书签 - * - * @param ele 待处理节点 - * @param path 节点路径,不包含自身 - * @param sort 当前层级中的排序序号 - * @author fanxb - * @date 2019/7/8 14:49 - */ - private void dealBookmark(int userId, Element ele, String path, int sort) { - if (!DT.equalsIgnoreCase(ele.tagName())) { - return; - } - Element first = ele.child(0); - if (A.equalsIgnoreCase(first.tagName())) { - //说明为链接 - Bookmark node = new Bookmark(userId, path, first.ownText(), first.attr("href"), first.attr("icon") - , Long.valueOf(first.attr("add_date")) * 1000, sort); - //存入数据库 - insertOne(node); - } else { - //说明为文件夹 - Bookmark node = new Bookmark(userId, path, first.ownText(), Long.valueOf(first.attr("add_date")) * 1000, sort); - Integer sortBase = 0; - if (insertOne(node)) { - sortBase = bookmarkDao.selectMaxSort(node.getUserId(), path); - if (sortBase == null) { - sortBase = 0; - } - } - String childPath = path + "." + node.getBookmarkId(); - Elements children = ele.child(1).children(); - for (int i = 0, size = children.size(); i < size; i++) { - dealBookmark(userId, children.get(i), childPath, sortBase + i + 1); - } - } - } - - /** - * Description: 插入一条书签,如果已经存在同名书签将跳过 - * - * @param node node - * @return boolean 如果已经存在返回true,否则false - * @author fanxb - * @date 2019/7/8 17:25 - */ - private boolean insertOne(Bookmark node) { - //先根据name,userId,parentId获取此节点id - Integer id = bookmarkDao.selectIdByUserIdAndNameAndPath(node.getUserId(), node.getName(), node.getPath()); - if (id == null) { - bookmarkDao.insertOne(node); - return false; - } else { - node.setBookmarkId(id); - return true; - } - } - -} +package com.fanxb.bookmark.business.bookmark.service; + +import com.fanxb.bookmark.business.bookmark.dao.BookmarkDao; +import com.fanxb.bookmark.common.entity.Bookmark; +import com.fanxb.bookmark.common.exception.CustomException; +import com.fanxb.bookmark.common.util.UserContextHolder; +import org.jsoup.Jsoup; +import org.jsoup.nodes.Document; +import org.jsoup.nodes.Element; +import org.jsoup.select.Elements; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.dao.DuplicateKeyException; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.io.InputStream; +import java.util.List; + +/** + * 类功能简述: + * 类功能详述: + * + * @author fanxb + * @date 2019/7/8 15:00 + */ +@Service +public class BookmarkService { + /** + * chrome导出书签tag + */ + private static final String DT = "dt"; + private static final String A = "a"; + + @Autowired + private BookmarkDao bookmarkDao; + + /** + * Description: 解析书签文件 + * + * @param stream 输入流 + * @param path 存放路径 + * @author fanxb + * @date 2019/7/9 18:44 + */ + @Transactional(rollbackFor = Exception.class) + public void parseBookmarkFile(int userId, InputStream stream, String path) throws Exception { + Document doc = Jsoup.parse(stream, "utf-8", ""); + Elements elements = doc.select("html>body>dl>dt"); + //获取当前层sort最大值 + Integer sortBase = bookmarkDao.selectMaxSort(1, path); + if (sortBase == null) { + sortBase = 0; + } + int count = 0; + for (int i = 0, length = elements.size(); i < length; i++) { + if (i == 0) { + Elements firstChildren = elements.get(0).child(1).children(); + count = firstChildren.size(); + for (int j = 0; j < count; j++) { + dealBookmark(userId, firstChildren.get(j), path, sortBase + j); + } + } else { + dealBookmark(userId, elements.get(i), path, sortBase + count + i - 1); + } + } + } + + + /** + * Description: 根据userId和path获取书签列表 + * + * @param userId userId + * @param path path + * @return java.util.List + * @author fanxb + * @date 2019/7/15 13:40 + */ + public List getBookmarkListByPath(int userId, String path) { + return bookmarkDao.getListByUserIdAndPath(userId, path); + } + + + /** + * Description: 批量删除书签 + * + * @param userId 用户id + * @param folderIdList 书签文件夹id list + * @param bookmarkIdList 书签id list + * @author fanxb + * @date 2019/7/12 14:09 + */ + @Transactional(rollbackFor = Exception.class) + public void batchDelete(int userId, List folderIdList, List bookmarkIdList) { + for (Integer item : folderIdList) { + bookmarkDao.deleteUserFolder(userId, item); + bookmarkIdList.add(item); + } + bookmarkDao.deleteUserBookmark(userId, bookmarkIdList); + } + + /** + * Description: 详情 + * + * @param bookmark 插入一条记录 + * @return com.fanxb.bookmark.common.entity.Bookmark + * @author fanxb + * @date 2019/7/12 17:18 + */ + public Bookmark addOne(Bookmark bookmark) { + int userId = UserContextHolder.get().getUserId(); + Integer sort = bookmarkDao.selectMaxSort(userId, bookmark.getPath()); + bookmark.setSort(sort == null ? 1 : sort + 1); + bookmark.setUserId(userId); + bookmark.setCreateTime(System.currentTimeMillis()); + bookmark.setAddTime(bookmark.getCreateTime()); + try { + bookmarkDao.insertOne(bookmark); + } catch (DuplicateKeyException e) { + throw new CustomException("同级目录下不能存在相同名称的数据"); + } + return bookmark; + } + + /** + * Description: 编辑某个用户的某个书签 + * + * @author fanxb + * @date 2019/7/17 14:42 + * @param userId userId + * @param bookmark bookmark + */ + public void updateOne(int userId,Bookmark bookmark){ + bookmark.setUserId(userId); + bookmarkDao.editBookmark(bookmark); + } + + + /** + * Description: 处理html节点,解析出文件夹和书签 + * + * @param ele 待处理节点 + * @param path 节点路径,不包含自身 + * @param sort 当前层级中的排序序号 + * @author fanxb + * @date 2019/7/8 14:49 + */ + private void dealBookmark(int userId, Element ele, String path, int sort) { + if (!DT.equalsIgnoreCase(ele.tagName())) { + return; + } + Element first = ele.child(0); + if (A.equalsIgnoreCase(first.tagName())) { + //说明为链接 + Bookmark node = new Bookmark(userId, path, first.ownText(), first.attr("href"), first.attr("icon") + , Long.valueOf(first.attr("add_date")) * 1000, sort); + //存入数据库 + insertOne(node); + } else { + //说明为文件夹 + Bookmark node = new Bookmark(userId, path, first.ownText(), Long.valueOf(first.attr("add_date")) * 1000, sort); + Integer sortBase = 0; + if (insertOne(node)) { + sortBase = bookmarkDao.selectMaxSort(node.getUserId(), path); + if (sortBase == null) { + sortBase = 0; + } + } + String childPath = path + "." + node.getBookmarkId(); + Elements children = ele.child(1).children(); + for (int i = 0, size = children.size(); i < size; i++) { + dealBookmark(userId, children.get(i), childPath, sortBase + i + 1); + } + } + } + + /** + * Description: 插入一条书签,如果已经存在同名书签将跳过 + * + * @param node node + * @return boolean 如果已经存在返回true,否则false + * @author fanxb + * @date 2019/7/8 17:25 + */ + private boolean insertOne(Bookmark node) { + //先根据name,userId,parentId获取此节点id + Integer id = bookmarkDao.selectIdByUserIdAndNameAndPath(node.getUserId(), node.getName(), node.getPath()); + if (id == null) { + bookmarkDao.insertOne(node); + return false; + } else { + node.setBookmarkId(id); + return true; + } + } + +} diff --git a/bookMarkService/business/bookmark/src/main/resources/mapper/bookmark-bookmarkMapper.xml b/bookMarkService/business/bookmark/src/main/resources/mapper/bookmark-bookmarkMapper.xml index 38be6b9..4157b0f 100644 --- a/bookMarkService/business/bookmark/src/main/resources/mapper/bookmark-bookmarkMapper.xml +++ b/bookMarkService/business/bookmark/src/main/resources/mapper/bookmark-bookmarkMapper.xml @@ -1,79 +1,85 @@ - - - - - - - insert into bookmark(userId,path,type,name,url,icon,sort,addTime,createTime) - value - ( #{userId},#{path},#{type},#{name}, - - "","", - - - #{url},#{icon}, - - #{sort},#{addTime},#{createTime}) - - - - - - - - - - - - DELETE - FROM - bookmark - WHERE - userId = #{userId} - and path LIKE (SELECT a.path - FROM (SELECT CONCAT(path, '.', '${folderId}', '%') AS path - FROM bookmark - WHERE bookmarkId = #{folderId}) a); - - - - delete from bookmark where userId = #{userId} and bookmarkId in - - #{item} - - - - + + + + + + + insert into bookmark(userId,path,type,name,url,icon,sort,addTime,createTime) + value + ( #{userId},#{path},#{type},#{name}, + + "","", + + + #{url},#{icon}, + + #{sort},#{addTime},#{createTime}) + + + + + + + + + + + + DELETE + FROM + bookmark + WHERE + userId = #{userId} + and path LIKE (SELECT a.path + FROM (SELECT CONCAT(path, '.', '${folderId}', '%') AS path + FROM bookmark + WHERE bookmarkId = #{folderId}) a); + + + + delete from bookmark where userId = #{userId} and bookmarkId in + + #{item} + + + + + update bookmark + set name = #{name}, url = #{url} + where bookmarkId = #{bookmarkId} and userId = #{userId} + + + \ No newline at end of file