查詢书签显示对应的标签
This commit is contained in:
		| @@ -8,6 +8,8 @@ import com.ruoyi.common.annotation.Excel; | ||||
|  | ||||
| import javax.persistence.*; | ||||
| import java.util.Date; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
|  | ||||
| /** | ||||
|  * 书签管理对象 sq_bookmark   不存在的字段注解 @Transient | ||||
| @@ -86,6 +88,16 @@ public class SqBookmark | ||||
|     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | ||||
|     private Date createTime; | ||||
|  | ||||
|     private List<Map<String,Object>> sqTags; | ||||
|  | ||||
|  | ||||
|     public List<Map<String, Object>> getSqTags() { | ||||
|         return sqTags; | ||||
|     } | ||||
|  | ||||
|     public void setSqTags(List<Map<String, Object>> sqTags) { | ||||
|         this.sqTags = sqTags; | ||||
|     } | ||||
|  | ||||
|     public Date getCreateTime() { | ||||
|         return createTime; | ||||
|   | ||||
| @@ -7,11 +7,11 @@ import com.ruoyi.common.core.domain.BaseEntity; | ||||
|  | ||||
| /** | ||||
|  * 书签标签管理对象 sq_bookmark_tag | ||||
|  *  | ||||
|  * | ||||
|  * @author ruoyi | ||||
|  * @date 2020-09-04 | ||||
|  */ | ||||
| public class SqBookmarkTag extends BaseEntity | ||||
| public class SqBookmarkTag | ||||
| { | ||||
|     private static final long serialVersionUID = 1L; | ||||
|  | ||||
| @@ -26,30 +26,30 @@ public class SqBookmarkTag extends BaseEntity | ||||
|     @Excel(name = "标签ID") | ||||
|     private Long tagId; | ||||
|  | ||||
|     public void setId(Long id)  | ||||
|     public void setId(Long id) | ||||
|     { | ||||
|         this.id = id; | ||||
|     } | ||||
|  | ||||
|     public Long getId()  | ||||
|     public Long getId() | ||||
|     { | ||||
|         return id; | ||||
|     } | ||||
|     public void setBookmarkId(Long bookmarkId)  | ||||
|     public void setBookmarkId(Long bookmarkId) | ||||
|     { | ||||
|         this.bookmarkId = bookmarkId; | ||||
|     } | ||||
|  | ||||
|     public Long getBookmarkId()  | ||||
|     public Long getBookmarkId() | ||||
|     { | ||||
|         return bookmarkId; | ||||
|     } | ||||
|     public void setTagId(Long tagId)  | ||||
|     public void setTagId(Long tagId) | ||||
|     { | ||||
|         this.tagId = tagId; | ||||
|     } | ||||
|  | ||||
|     public Long getTagId()  | ||||
|     public Long getTagId() | ||||
|     { | ||||
|         return tagId; | ||||
|     } | ||||
|   | ||||
| @@ -1,19 +1,31 @@ | ||||
| package com.ruoyi.bookmark.mapper; | ||||
|  | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
|  | ||||
| import com.ruoyi.bookmark.domain.SqBookmarkTag; | ||||
| import com.ruoyi.bookmark.domain.SqTag; | ||||
|  | ||||
| /** | ||||
|  * 书签标签管理Mapper接口 | ||||
|  *  | ||||
|  * | ||||
|  * @author ruoyi | ||||
|  * @date 2020-09-04 | ||||
|  */ | ||||
| public interface SqBookmarkTagMapper  | ||||
| public interface SqBookmarkTagMapper | ||||
| { | ||||
|  | ||||
|     /** | ||||
|      * 查询该篇文章的 所有书签 | ||||
|      * | ||||
|      * @param | ||||
|      * @return 书签_标签 | ||||
|      */ | ||||
|     public List<Map<String,Object>> selectSqTaListById(Long bookmarkId); | ||||
|  | ||||
|     /** | ||||
|      * 查询书签标签管理 | ||||
|      *  | ||||
|      * | ||||
|      * @param id 书签标签管理ID | ||||
|      * @return 书签标签管理 | ||||
|      */ | ||||
| @@ -21,7 +33,7 @@ public interface SqBookmarkTagMapper | ||||
|  | ||||
|     /** | ||||
|      * 查询书签标签管理列表 | ||||
|      *  | ||||
|      * | ||||
|      * @param sqBookmarkTag 书签标签管理 | ||||
|      * @return 书签标签管理集合 | ||||
|      */ | ||||
| @@ -29,7 +41,7 @@ public interface SqBookmarkTagMapper | ||||
|  | ||||
|     /** | ||||
|      * 新增书签标签管理 | ||||
|      *  | ||||
|      * | ||||
|      * @param sqBookmarkTag 书签标签管理 | ||||
|      * @return 结果 | ||||
|      */ | ||||
| @@ -37,7 +49,7 @@ public interface SqBookmarkTagMapper | ||||
|  | ||||
|     /** | ||||
|      * 修改书签标签管理 | ||||
|      *  | ||||
|      * | ||||
|      * @param sqBookmarkTag 书签标签管理 | ||||
|      * @return 结果 | ||||
|      */ | ||||
| @@ -45,7 +57,7 @@ public interface SqBookmarkTagMapper | ||||
|  | ||||
|     /** | ||||
|      * 删除书签标签管理 | ||||
|      *  | ||||
|      * | ||||
|      * @param id 书签标签管理ID | ||||
|      * @return 结果 | ||||
|      */ | ||||
| @@ -53,7 +65,7 @@ public interface SqBookmarkTagMapper | ||||
|  | ||||
|     /** | ||||
|      * 批量删除书签标签管理 | ||||
|      *  | ||||
|      * | ||||
|      * @param ids 需要删除的数据ID | ||||
|      * @return 结果 | ||||
|      */ | ||||
|   | ||||
| @@ -5,15 +5,17 @@ import com.ruoyi.bookmark.domain.SqTag; | ||||
|  | ||||
| /** | ||||
|  * 书签_标签Mapper接口 | ||||
|  *  | ||||
|  * | ||||
|  * @author ruoyi | ||||
|  * @date 2020-09-04 | ||||
|  */ | ||||
| public interface SqTagMapper  | ||||
| public interface SqTagMapper | ||||
| { | ||||
|  | ||||
|  | ||||
|     /** | ||||
|      * 查询书签_标签 | ||||
|      *  | ||||
|      * | ||||
|      * @param id 书签_标签ID | ||||
|      * @return 书签_标签 | ||||
|      */ | ||||
| @@ -21,7 +23,7 @@ public interface SqTagMapper | ||||
|  | ||||
|     /** | ||||
|      * 查询书签_标签列表 | ||||
|      *  | ||||
|      * | ||||
|      * @param sqTag 书签_标签 | ||||
|      * @return 书签_标签集合 | ||||
|      */ | ||||
| @@ -29,7 +31,7 @@ public interface SqTagMapper | ||||
|  | ||||
|     /** | ||||
|      * 新增书签_标签 | ||||
|      *  | ||||
|      * | ||||
|      * @param sqTag 书签_标签 | ||||
|      * @return 结果 | ||||
|      */ | ||||
| @@ -37,7 +39,7 @@ public interface SqTagMapper | ||||
|  | ||||
|     /** | ||||
|      * 修改书签_标签 | ||||
|      *  | ||||
|      * | ||||
|      * @param sqTag 书签_标签 | ||||
|      * @return 结果 | ||||
|      */ | ||||
| @@ -45,7 +47,7 @@ public interface SqTagMapper | ||||
|  | ||||
|     /** | ||||
|      * 删除书签_标签 | ||||
|      *  | ||||
|      * | ||||
|      * @param id 书签_标签ID | ||||
|      * @return 结果 | ||||
|      */ | ||||
| @@ -53,7 +55,7 @@ public interface SqTagMapper | ||||
|  | ||||
|     /** | ||||
|      * 批量删除书签_标签 | ||||
|      *  | ||||
|      * | ||||
|      * @param ids 需要删除的数据ID | ||||
|      * @return 结果 | ||||
|      */ | ||||
|   | ||||
| @@ -14,6 +14,7 @@ import com.ruoyi.bookmark.domain.SqUserTag; | ||||
| public interface SqUserTagMapper | ||||
| { | ||||
|  | ||||
|  | ||||
|     /** | ||||
|      *通过用户userID查用户的所有标签 | ||||
|      * | ||||
|   | ||||
| @@ -18,6 +18,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||||
|         <result property="idelete"    column="IDelete"    /> | ||||
|         <result property="start"    column="Start"    /> | ||||
|         <result property="createTime"    column="create_time"    /> | ||||
|         <collection property="sqTags" | ||||
|                     javaType="java.util.ArrayList" | ||||
|                     ofType="java.util.Map" | ||||
|                     select="com.ruoyi.bookmark.mapper.SqBookmarkTagMapper.selectSqTaListById" | ||||
|                     column="bookmark_id"> | ||||
|  | ||||
|  | ||||
|         </collection> | ||||
|  | ||||
|     </resultMap> | ||||
|  | ||||
|     <sql id="selectSqBookmarkVo"> | ||||
|   | ||||
| @@ -3,7 +3,7 @@ | ||||
| PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||||
| "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||||
| <mapper namespace="com.ruoyi.bookmark.mapper.SqBookmarkTagMapper"> | ||||
|      | ||||
|  | ||||
|     <resultMap type="SqBookmarkTag" id="SqBookmarkTagResult"> | ||||
|         <result property="id"    column="id"    /> | ||||
|         <result property="bookmarkId"    column="bookmark_id"    /> | ||||
| @@ -16,17 +16,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||||
|  | ||||
|     <select id="selectSqBookmarkTagList" parameterType="SqBookmarkTag" resultMap="SqBookmarkTagResult"> | ||||
|         <include refid="selectSqBookmarkTagVo"/> | ||||
|         <where>   | ||||
|         <where> | ||||
|             <if test="bookmarkId != null "> and bookmark_id = #{bookmarkId}</if> | ||||
|             <if test="tagId != null "> and tag_id = #{tagId}</if> | ||||
|         </where> | ||||
|     </select> | ||||
|      | ||||
|     <select id="selectSqBookmarkTagById" parameterType="Long" resultMap="SqBookmarkTagResult"> | ||||
|         <include refid="selectSqBookmarkTagVo"/> | ||||
|         where id = #{id} | ||||
|  | ||||
|  | ||||
|     <select id="selectSqTaListById" parameterType="Long" resultType="java.util.Map"> | ||||
|         select  a.bookmark_id as bookmarkId, a.tag_id as tagId,b.name from sq_bookmark_tag as a,sq_tag as b WHERE a.tag_id=b.id and  a.bookmark_id = #{bookmarkId} | ||||
|     </select> | ||||
|          | ||||
|  | ||||
|     <insert id="insertSqBookmarkTag" parameterType="SqBookmarkTag"> | ||||
|         insert into sq_bookmark_tag | ||||
|         <trim prefix="(" suffix=")" suffixOverrides=","> | ||||
| @@ -55,10 +55,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||||
|     </delete> | ||||
|  | ||||
|     <delete id="deleteSqBookmarkTagByIds" parameterType="String"> | ||||
|         delete from sq_bookmark_tag where id in  | ||||
|         delete from sq_bookmark_tag where id in | ||||
|         <foreach item="id" collection="array" open="(" separator="," close=")"> | ||||
|             #{id} | ||||
|         </foreach> | ||||
|     </delete> | ||||
|      | ||||
| </mapper> | ||||
|  | ||||
| </mapper> | ||||
|   | ||||
| @@ -3,7 +3,7 @@ | ||||
| PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||||
| "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||||
| <mapper namespace="com.ruoyi.bookmark.mapper.SqTagMapper"> | ||||
|      | ||||
|  | ||||
|     <resultMap type="SqTag" id="SqTagResult"> | ||||
|         <result property="id"    column="id"    /> | ||||
|         <result property="name"    column="name"    /> | ||||
| @@ -21,7 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||||
|  | ||||
|     <select id="selectSqTagList" parameterType="SqTag" resultMap="SqTagResult"> | ||||
|         <include refid="selectSqTagVo"/> | ||||
|         <where>   | ||||
|         <where> | ||||
|             <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if> | ||||
|             <if test="icount != null "> and icount = #{icount}</if> | ||||
|             <if test="userId != null "> and user_Id = #{userId}</if> | ||||
| @@ -30,12 +30,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||||
|             <if test="status != null "> and status = #{status}</if> | ||||
|         </where> | ||||
|     </select> | ||||
|      | ||||
|  | ||||
|     <select id="selectSqTagById" parameterType="Long" resultMap="SqTagResult"> | ||||
|         <include refid="selectSqTagVo"/> | ||||
|         where id = #{id} | ||||
|     </select> | ||||
|          | ||||
|  | ||||
|     <insert id="insertSqTag" parameterType="SqTag" useGeneratedKeys="true" keyProperty="id"> | ||||
|         insert into sq_tag | ||||
|         <trim prefix="(" suffix=")" suffixOverrides=","> | ||||
| @@ -77,10 +77,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||||
|     </delete> | ||||
|  | ||||
|     <delete id="deleteSqTagByIds" parameterType="String"> | ||||
|         delete from sq_tag where id in  | ||||
|         delete from sq_tag where id in | ||||
|         <foreach item="id" collection="array" open="(" separator="," close=")"> | ||||
|             #{id} | ||||
|         </foreach> | ||||
|     </delete> | ||||
|      | ||||
| </mapper> | ||||
|  | ||||
| </mapper> | ||||
|   | ||||
| @@ -71,7 +71,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||||
|  | ||||
|     <select id="selectSqUserTagByUserId" parameterType="Long" resultType="java.util.Map"> | ||||
|    SELECT u.id,u.user_id as userId,u.tag_id as tagId ,u.icount,u.iorder,t.name | ||||
|    from sq_user_tag as u,sq_tag as t | ||||
|    from sq_user_tag AS u,sq_tag as t | ||||
|     WHERE | ||||
|     u.tag_id=t.id | ||||
|     AND | ||||
|   | ||||
		Reference in New Issue
	
	Block a user