Feat: [后台]:完成编辑接口

This commit is contained in:
fanxb 2019-07-17 17:30:40 +08:00
parent 7e491ab10e
commit 67d95c4a28
4 changed files with 478 additions and 426 deletions

View File

@ -65,6 +65,21 @@ public class BookmarkController {
return Result.success(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: 批量删除 * Description: 批量删除
* *

View File

@ -59,6 +59,15 @@ public interface BookmarkDao {
*/ */
List<Bookmark> getListByUserId(int userId); List<Bookmark> getListByUserId(int userId);
/**
* Description: 根据userId和path查询path下的子节点
*
* @param userId userId
* @param path path
* @return java.util.List<com.fanxb.bookmark.common.entity.Bookmark>
* @author fanxb
* @date 2019/7/17 14:48
*/
List<Bookmark> getListByUserIdAndPath(@Param("userId") int userId, @Param("path") String path); List<Bookmark> getListByUserIdAndPath(@Param("userId") int userId, @Param("path") String path);
/** /**
@ -80,4 +89,13 @@ public interface BookmarkDao {
* @date 2019/7/12 17:24 * @date 2019/7/12 17:24
*/ */
void deleteUserBookmark(@Param("userId") int userId, @Param("bookmarkIds") List<Integer> bookmarkIds); void deleteUserBookmark(@Param("userId") int userId, @Param("bookmarkIds") List<Integer> bookmarkIds);
/**
* Description: 编辑书签
*
* @author fanxb
* @date 2019/7/17 14:49
* @param bookmark bookmark
*/
void editBookmark(Bookmark bookmark);
} }

View File

@ -121,6 +121,19 @@ public class BookmarkService {
return bookmark; 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节点解析出文件夹和书签 * Description: 处理html节点解析出文件夹和书签

View File

@ -75,5 +75,11 @@
</foreach> </foreach>
</delete> </delete>
<update id="editBookmark" parameterType="com.fanxb.bookmark.common.entity.Bookmark">
update bookmark
set name = #{name}, url = #{url}
where bookmarkId = #{bookmarkId} and userId = #{userId}
</update>
</mapper> </mapper>