新增 删除重复的书签

This commit is contained in:
WangHao 2021-04-07 20:07:47 +08:00
parent 8abfbae5ff
commit 3e5b4a9625
10 changed files with 241 additions and 273 deletions

View File

@ -53,6 +53,34 @@ public class SqBookmarkController extends BaseController
// return getDataTable(list);
// }
/**
* 删除重复的书签
*/
@GetMapping("/bookmarkDeleteRepetition")
@PreAuthorize("@ss.hasPermi('bookmark:bookmark:common:deleterepetition')")
public AjaxResult bookmarkDeleteRepetition() {
return AjaxResult.success(sqBookmarkService.bookmarkDeleteRepetition(getAuthUser().getUserId()));
}
/**
*获取所有重复的书签
*/
@GetMapping("/bookmarkRepetition")
@PreAuthorize("@ss.hasPermi('bookmark:bookmark:common:listrepetition')")
public AjaxResult bookmarkRepetition() {
startPage();
List<SqBookmark> list = sqBookmarkService.bookmarkRepetition(getAuthUser().getUserId());
return AjaxResult.success(list);
}
/**
* 书签设置星标 取消星标
*/
@GetMapping("/updateBookmarkStarById")
public AjaxResult updateBookmarkStarById(String bookmarkId,int bookmarkStr) {
return toAjax(sqBookmarkService.updateBookmarkStarById(getAuthUser().getUserId(),bookmarkId,bookmarkStr));
}
/**
* 通过url 查询用户 是否已经添加了此书签
*
@ -62,9 +90,8 @@ public class SqBookmarkController extends BaseController
@GetMapping("/selectByUrlUserID")
@PreAuthorize("@ss.hasPermi('bookmark:bookmark:common:url')")
public AjaxResult selectByUrlUserID(String url) {
SysUser sysUser=getAuthUser();
startPage();
List<SqBookmark> list = sqBookmarkService.selectByUrlUserID(url,sysUser.getUserId());
List<SqBookmark> list = sqBookmarkService.selectByUrlUserID(url,getAuthUser().getUserId());
if (list!=null&&!list.isEmpty()){
return AjaxResult.success(list.get(0));
}
@ -79,9 +106,8 @@ public class SqBookmarkController extends BaseController
@GetMapping("/selectBymenuIdUserID")
@PreAuthorize("@ss.hasPermi('bookmark:bookmark:common:listsousou')")
public TableDataInfo selectBymenuIdUserID(Long menuId,Integer sort,String sousuo) {
SysUser sysUser=getAuthUser();
startPage();
List<SqBookmark> list = sqBookmarkService.selectBymenuIdUserID(menuId,sysUser.getUserId(),sort,sousuo);
List<SqBookmark> list = sqBookmarkService.selectBymenuIdUserID(menuId,getAuthUser().getUserId(),sort,sousuo);
return getDataTable(list);
}
/**
@ -91,9 +117,8 @@ public class SqBookmarkController extends BaseController
@GetMapping("/selectBydelete")
@PreAuthorize("@ss.hasPermi('bookmark:bookmark:common:recycle')")
public TableDataInfo selectBydelete() {
SysUser sysUser=getAuthUser();
startPage();
List<SqBookmark> list = sqBookmarkService.selectBydelete(sysUser.getUserId());
List<SqBookmark> list = sqBookmarkService.selectBydelete(getAuthUser().getUserId());
return getDataTable(list);
}
@ -104,9 +129,8 @@ public class SqBookmarkController extends BaseController
@GetMapping("/selectByUseridList")
@PreAuthorize("@ss.hasPermi('bookmark:bookmark:common:list')")
public TableDataInfo selectByUseridList() {
SysUser sysUser=getAuthUser();
startPage();
List<SqBookmark> list = sqBookmarkService.selectByUseridList(sysUser.getUserId());
List<SqBookmark> list = sqBookmarkService.selectByUseridList(getAuthUser().getUserId());
return getDataTable(list);
}
@ -154,8 +178,7 @@ public class SqBookmarkController extends BaseController
@PostMapping
public AjaxResult add(@RequestBody SqBookmark sqBookmark)
{
SysUser sysUser=getAuthUser();
sqBookmark.setUserid(sysUser.getUserId());
sqBookmark.setUserid(getAuthUser().getUserId());
return toAjax(sqBookmarkService.insertSqBookmark(sqBookmark));
}
@ -167,8 +190,7 @@ public class SqBookmarkController extends BaseController
@PutMapping
public AjaxResult edit(@RequestBody SqBookmark sqBookmark)
{
SysUser sysUser=getAuthUser();
sqBookmark.setUserid(sysUser.getUserId());
sqBookmark.setUserid(getAuthUser().getUserId());
return toAjax(sqBookmarkService.updateSqBookmark(sqBookmark));
}

View File

@ -42,7 +42,8 @@
<!--编辑 -->
<div class="editAllBookMark" v-show="seen&&bm.bookmarkId==current">
<el-button type="info" plain size="mini" icon="el-icon-share" ></el-button>
<el-button type="info" style="color: #1112ff" plain size="mini" icon="el-icon-star-off" ></el-button>
<el-button type="info" plain size="mini" icon="el-icon-share" ></el-button>
<el-button type="info" plain size="mini" icon="el-icon-edit" @click.stop="handleUpdate(bm.bookmarkId)"></el-button>
<el-button type="danger" plain size="mini" icon="el-icon-delete" @click.stop="handleDelete(bm.bookmarkId)"></el-button>

View File

@ -17,10 +17,13 @@
</el-header>
<div class="main-right">
<!-- <svg-icon icon-class="tool" class="svgicon"/>-->
<div class="aside-title" @click="goBookmarkList"><i class="el-icon-s-tools"></i><span>最新书签</span></div>
<!-- <div class="aside-title"><i class="el-icon-help"></i><span>发现</span></div>-->
<!-- <div class="aside-title"><i class="el-icon-s-platform"></i><span>任意门</span></div>-->
<div class="aside-title"><i class="el-icon-s-management"></i><span>发现</span></div>
<div class="aside-title" @click="goBookmarkList"><i class="el-icon-s-tools"></i><span>最新</span></div>
<div class="aside-title"><i class="el-icon-star-on"></i><span>星标</span></div>
<div class="aside-title"><i class="el-icon-help"></i><span>稍后看</span></div>
<div class="aside-title"><i class="el-icon-s-platform"></i><span>任意门</span></div>
<div class="aside-title"><i class="el-icon-message-solid"></i><span>收件箱</span></div>
<div class="reminder">我的收藏 <svg-icon icon-class="sx" style="margin-left:5px" @click="refreshNode"/></div>
<div class="areaTree">
@ -998,7 +1001,7 @@
}
</script>
<style >
<style scoped>
body {
@ -1006,109 +1009,6 @@
font-family: "Merriweather", "Open Sans", "Microsoft Jhenghei", "Microsoft Yahei", sans-serif;
}
.sayncIoc{
margin-top:-2px;
background:url(https://up.raindrop.io/collection/templates/social-media-logos-6/47social.png) 0 0 no-repeat;
background-position:center;
background-size:21px 21px;
border-radius: 50%;
}
.ztree li ul {
margin: 0;
padding: 0
}
.ztree li {
line-height: 32px
}
.ztree li a {
width: 200px;
height: 32px;
padding-top: 0px;
font-size: 14px;
width: 100%
}
.ztree li a:hover {
text-decoration: none;
background-color: #E5E5E5;
}
.ztree li a span.button.switch {
vertical-align: middle
}
.ztree.showIcon li a span.button.switch {
visibility: visible
}
.ztree li a.curSelectedNode {
background-color: #E5E5E5;
border: 0;
height: 32px;
}
.ztree li span {
line-height: 32px;
}
.ztree li span.button {
margin-top: 0px;
margin-left: 2px;
width: 20px;
height: 20px;
}
.ztree li span.button.switch {
width: 20px;
height: 20px;
}
/*.ztree li a.level0 span {font-size: 100%;font-weight: bold}*/
.ztree li span.noline_open {
background-image: url("../ztree/bottom.png");
}
.ztree li span.ico_loading {
background-image: url("../ztree/loading.gif");
/*margin-right:2px; background:url(../ztree/loading.gif) no-repeat scroll 0 0 transparent; vertical-align:top; *vertical-align:middle*/
}
.ztree li span.button.switch.level0 {
width: 20px;
height: 20px
}
.ztree li span.button.switch.level1 {
width: 20px;
height: 20px
}
.ztree li span.button.noline_open {
background-position: 0 0;
}
.ztree li span.button.noline_close {
background-position: 0 0;
background-image: url("../ztree/right.png");
}
/*.ztree li span.button.noline_open.level0 {background-position: 0 0;}*/
/*.ztree li span.button.noline_close.level0 {background-position:-18px 0;}*/
.ztree li span.button.ico_close {
vertical-align: middle
}
.ztree li span.button.ico_open {
vertical-align: middle
}
.ztree li span.button.ico_docu {
vertical-align: middle
}
.ztr {
@ -1196,6 +1096,12 @@
margin-right: 11px;
vertical-align: middle;
}
.svgicon{
margin-left: 26px;
font-size: 18px;
margin-right: 11px;
vertical-align: middle;
}
.aside-title span {
font-size: 14px;

View File

@ -21,7 +21,7 @@ div.content_wrap {width: 600px;height:380px;}
div.content_wrap div.left{float: left;width: 250px;}
div.content_wrap div.right{float: right;width: 340px;}
div.zTreeDemoBackground {width:250px;height:362px;text-align:left;}
/* ruler
/* ruler
ul.ztree {margin-top: 10px;border: 1px solid #617775;background: #f0f6e4;width:220px;height:360px;overflow-y:scroll;overflow-x:auto;}
*/
ul.log {border: 1px solid #617775;background: #f0f6e4;width:300px;height:170px;overflow: hidden;}
@ -31,4 +31,8 @@ ul.log li.dark {background-color: #E3E3E3;}
/* ruler */
div.ruler {height:20px; width:220px; background-color:#f0f6e4;border: 1px solid #333; margin-bottom: 5px; cursor: pointer}
div.ruler div.cursor {height:20px; width:30px; background-color:#3C6E31; color:white; text-align: right; padding-right: 5px; cursor: pointer}
div.ruler div.cursor {height:20px; width:30px; background-color:#3C6E31; color:white; text-align: right; padding-right: 5px; cursor: pointer}

View File

@ -95,3 +95,121 @@ ul.ztree.zTreeDragUL {margin:0; padding:0; position:absolute; width:auto; height
padding:0;
background:none;
}*/
/*自定义美化*/
.sayncIoc{
margin-top:-2px;
background:url(https://up.raindrop.io/collection/templates/social-media-logos-6/47social.png) 0 0 no-repeat;
background-position:center;
background-size:21px 21px;
border-radius: 50%;
}
.ztree li ul {
margin: 0;
padding: 0
}
.ztree li {
line-height: 32px
}
.ztree li a {
width: 200px;
height: 32px;
padding-top: 0px;
font-size: 14px;
width: 100%
}
.ztree li a:hover {
text-decoration: none;
background-color: #E5E5E5;
}
.ztree li a span.button.switch {
vertical-align: middle
}
.ztree.showIcon li a span.button.switch {
visibility: visible
}
.ztree li a.curSelectedNode {
background-color: #E5E5E5;
border: 0;
height: 32px;
}
.ztree li span {
line-height: 32px;
}
.ztree li span.button {
margin-top: 0px;
margin-left: 2px;
width: 20px;
height: 20px;
}
.ztree li span.button.switch {
width: 20px;
height: 20px;
}
/*.ztree li a.level0 span {font-size: 100%;font-weight: bold}*/
.ztree li span.noline_open {
background-image: url("../ztree/bottom.png");
}
.ztree li span.ico_loading {
background-image: url("../ztree/loading.gif");
/*margin-right:2px; background:url(../ztree/loading.gif) no-repeat scroll 0 0 transparent; vertical-align:top; *vertical-align:middle*/
}
.ztree li span.button.switch.level0 {
width: 20px;
height: 20px
}
.ztree li span.button.switch.level1 {
width: 20px;
height: 20px
}
.ztree li span.button.noline_open {
background-position: 0 0;
}
.ztree li span.button.noline_close {
background-position: 0 0;
background-image: url("../ztree/right.png");
}
/*.ztree li span.button.noline_open.level0 {background-position: 0 0;}*/
/*.ztree li span.button.noline_close.level0 {background-position:-18px 0;}*/
.ztree li span.button.ico_close {
vertical-align: middle
}
.ztree li span.button.ico_open {
vertical-align: middle
}
.ztree li span.button.ico_docu {
vertical-align: middle
}

View File

@ -1,6 +1,8 @@
package com.ruoyi.bookmark.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.ToString;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
@ -19,6 +21,7 @@ import java.util.Map;
* @GeneratedValue让通用mapper在执行insert操作之后将自动生成的主键值回写到当前实体对象对应的属性当中
*/
@Table(name="sq_bookmark")
@Data
public class SqBookmark
{
private static final long serialVersionUID = 1L;
@ -60,7 +63,7 @@ public class SqBookmark
/** 标签 */
@Excel(name = "标签")
@Column(name = "Label")
@Column(name = "label")
private String label;
/** 分类ID */
@ -83,6 +86,10 @@ public class SqBookmark
@Column(name = "Start")
private Integer start;
/** 0非星标 1星标 */
@Column(name = "bookmark_star")
private Integer bookmarkStar;
/** 创建时间 */
@Excel(name = "创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ -94,155 +101,6 @@ public class SqBookmark
private List<Map<String,Object>> sqTags;
public Long getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
}
public List<Map<String, Object>> getSqTags() {
return sqTags;
}
public void setSqTags(List<Map<String, Object>> sqTags) {
this.sqTags = sqTags;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public void setBookmarkId(Long bookmarkId)
{
this.bookmarkId = bookmarkId;
}
public Long getBookmarkId()
{
return bookmarkId;
}
public void setUserid(Long userid)
{
this.userid = userid;
}
public Long getUserid()
{
return userid;
}
public void setTitle(String title)
{
this.title = title;
}
public String getTitle()
{
return title;
}
public void setUrl(String url)
{
this.url = url;
}
public String getUrl()
{
return url;
}
public void setUrls(String urls)
{
this.urls = urls;
}
public String getUrls()
{
return urls;
}
public void setDescription(String description)
{
this.description = description;
}
public String getDescription()
{
return description;
}
public void setImage(String image)
{
this.image = image;
}
public String getImage()
{
return image;
}
public void setLabel(String label)
{
this.label = label;
}
public String getLabel()
{
return label;
}
public void setMenuId(Long menuId)
{
this.menuId = menuId;
}
public Long getMenuId()
{
return menuId;
}
public void setZcount(Long zcount)
{
this.zcount = zcount;
}
public Long getZcount()
{
return zcount;
}
public void setIdelete(Integer idelete)
{
this.idelete = idelete;
}
public Integer getIdelete()
{
return idelete;
}
public void setStart(Integer start)
{
this.start = start;
}
public Integer getStart()
{
return start;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("bookmarkId", getBookmarkId())
.append("userid", getUserid())
.append("title", getTitle())
.append("url", getUrl())
.append("urls", getUrls())
.append("description", getDescription())
.append("image", getImage())
.append("label", getLabel())
.append("menuId", getMenuId())
.append("zcount", getZcount())
.append("idelete", getIdelete())
.append("start", getStart())
.append("createTime", getCreateTime())
.toString();
}
}

View File

@ -93,4 +93,12 @@ public interface SqBookmarkMapper extends MyMapper<SqBookmark>
* @return 结果
*/
public int countBookMakeByMenuId(Long menuId);
/**
* 刪除重复的书签
*/
public int bookmarkDeleteRepetition(Long userId);
/**
* 获取重复的标签
*/
List<SqBookmark> bookmarkRepetition(Long userId);
}

View File

@ -120,4 +120,25 @@ public interface ISqBookmarkService
* @return
*/
void addALLBookMarkByHtml(List<HtmlName> list,Long userID);
/**
* 书签设置星标 取消星标
*
* @param bookmarkStr 0不是星标 1是星标
* @param bookmarkId
* @param userId
* @return
*/
int updateBookmarkStarById(Long userId, String bookmarkId, int bookmarkStr);
/**
* 删除重复的书签
*
*/
int bookmarkDeleteRepetition(Long userId);
/**
*获取所有重复的书签
*
* */
List<SqBookmark> bookmarkRepetition(Long userId);
}

View File

@ -368,5 +368,24 @@ public class SqBookmarkServiceImpl implements ISqBookmarkService
}
@Override
public int updateBookmarkStarById(Long userId, String bookmarkId, int bookmarkStr) {
SqBookmark sqBookmark =new SqBookmark();
sqBookmark.setBookmarkId(Long.valueOf(bookmarkId));
sqBookmark.setUserid(userId);
sqBookmark.setBookmarkStar(bookmarkStr==1?1:0);
return sqBookmarkMapper.updateSqBookmark(sqBookmark);
}
@Override
public int bookmarkDeleteRepetition(Long userId) {
return sqBookmarkMapper.bookmarkDeleteRepetition(userId);
}
@Override
public List<SqBookmark> bookmarkRepetition(Long userId) {
return sqBookmarkMapper.bookmarkRepetition(userId);
}
}

View File

@ -15,6 +15,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="label" column="label" />
<result property="menuId" column="menu_id" />
<result property="zcount" column="zcount" />
<result property="bookmarkStar" column="bookmark_star" />
<result property="idelete" column="idelete" />
<result property="start" column="start" />
<result property="createTime" column="create_time" />
@ -30,7 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectSqBookmarkVo">
select bookmark_id, userid, title, url, urls, description, image, Label, menu_id, zcount, IDelete, Start, create_time from sq_bookmark
select bookmark_id, userid, title, url, urls, description, image, Label, menu_id, zcount, IDelete, Start, create_time,bookmark_star from sq_bookmark
</sql>
<select id="selectSqBookmarkList" parameterType="SqBookmark" resultMap="SqBookmarkResult">
@ -114,6 +115,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
delete from sq_bookmark where bookmark_id = #{bookmarkId}
</delete>
<delete id="bookmarkDeleteRepetition" parameterType="Long">
DELETE FROM sq_bookmark WHERE bookmark_id NOT IN ( SELECT dt.bookmark_id FROM(
SELECT min(bookmark_id) AS bookmark_id FROM sq_bookmark WHERE IDelete = 0 AND userid = #{userId} GROUP BY url ) dt)
</delete>
<delete id="deleteSqBookmarkByIds" parameterType="String">
delete from sq_bookmark where bookmark_id in
<foreach item="bookmarkId" collection="array" open="(" separator="," close=")">
@ -130,6 +136,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select count(*) FROM sq_bookmark where menu_id =#{menuId}
</select>
<select id="bookmarkRepetition" parameterType="Long" resultMap="SqBookmarkResult">
SELECT * FROM sq_bookmark WHERE url in (SELECT url FROM sq_bookmark WHERE userid = #{userId} GROUP BY url HAVING COUNT(url)>1) AND userid = #{userId} ORDER BY url
</select>
<select id="selectBymenuIdUserID" parameterType="SqBookmark" resultMap="SqBookmarkResult">
<include refid="selectSqBookmarkVo"/>
where userid=#{userID}