新增 删除重复的书签
This commit is contained in:
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -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}
|
||||
|
Reference in New Issue
Block a user