新增 通过url查询用户的书签 多条返回最新一条
This commit is contained in:
parent
11a29fb206
commit
51661f413d
@ -53,6 +53,23 @@ public class SqBookmarkController extends BaseController
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过url 查询用户 是否已经添加了此书签
|
||||
*
|
||||
* 如果有多条 返回最新的一条
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/selectByUrlUserID")
|
||||
public AjaxResult selectByUrlUserID(String url) {
|
||||
SysUser sysUser=getAuthUser();
|
||||
startPage();
|
||||
List<SqBookmark> list = sqBookmarkService.selectByUrlUserID(url,sysUser.getUserId());
|
||||
if (list!=null&&!list.isEmpty()){
|
||||
return AjaxResult.success(list.get(0));
|
||||
}
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询用户栏目下的书签
|
||||
|
@ -28,6 +28,7 @@ public interface ISqBookmarkService
|
||||
public List<SqBookmark> selectBymenuIdUserID(Long menuID,Long userID,Integer sort,String sousou);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询书签管理
|
||||
*
|
||||
@ -101,4 +102,13 @@ public interface ISqBookmarkService
|
||||
* @return
|
||||
*/
|
||||
public int selectByMenuIdCount(Long menuId);
|
||||
|
||||
/**
|
||||
* 通过url 查询用户是否已经添加
|
||||
*
|
||||
* @param url
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
List<SqBookmark> selectByUrlUserID(String url, Long userId);
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ package com.ruoyi.bookmark.service.impl;
|
||||
import java.util.*;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.ruoyi.bookmark.domain.SqBookmarkTag;
|
||||
|
||||
import com.ruoyi.bookmark.domain.SqMenu;
|
||||
@ -20,6 +21,7 @@ import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.bookmark.mapper.SqBookmarkMapper;
|
||||
import com.ruoyi.bookmark.domain.SqBookmark;
|
||||
import com.ruoyi.bookmark.service.ISqBookmarkService;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
|
||||
/**
|
||||
@ -284,5 +286,25 @@ public class SqBookmarkServiceImpl implements ISqBookmarkService
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过url 查询用户是否已经添加
|
||||
*
|
||||
* @param url
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<SqBookmark> selectByUrlUserID(String url, Long userId) {
|
||||
|
||||
Example example = new Example(SqBookmark.class);
|
||||
// 排序
|
||||
example.setOrderByClause("create_time desc");
|
||||
// 条件查询
|
||||
example.createCriteria()
|
||||
.andEqualTo("url", url)
|
||||
.andEqualTo("userid",userId);
|
||||
return sqBookmarkMapper.selectByExample(example);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user