查询用户标签
This commit is contained in:
		| @@ -1,19 +1,27 @@ | ||||
| package com.ruoyi.bookmark.mapper; | ||||
|  | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
|  | ||||
| import com.ruoyi.bookmark.domain.SqUserTag; | ||||
|  | ||||
| /** | ||||
|  * 标签管理Mapper接口 | ||||
|  *  | ||||
|  * | ||||
|  * @author wang | ||||
|  * @date 2020-09-04 | ||||
|  */ | ||||
| public interface SqUserTagMapper  | ||||
| public interface SqUserTagMapper | ||||
| { | ||||
|  | ||||
|     /** | ||||
|      *通过用户userID查用户的所有标签 | ||||
|      * | ||||
|      */ | ||||
|     public List<Map<String,Object>> selectSqUserTagByUserId(Long userId); | ||||
|     /** | ||||
|      * 查询标签管理 | ||||
|      *  | ||||
|      * | ||||
|      * @param id 标签管理ID | ||||
|      * @return 标签管理 | ||||
|      */ | ||||
| @@ -21,7 +29,7 @@ public interface SqUserTagMapper | ||||
|  | ||||
|     /** | ||||
|      * 查询标签管理列表 | ||||
|      *  | ||||
|      * | ||||
|      * @param sqUserTag 标签管理 | ||||
|      * @return 标签管理集合 | ||||
|      */ | ||||
| @@ -29,7 +37,7 @@ public interface SqUserTagMapper | ||||
|  | ||||
|     /** | ||||
|      * 新增标签管理 | ||||
|      *  | ||||
|      * | ||||
|      * @param sqUserTag 标签管理 | ||||
|      * @return 结果 | ||||
|      */ | ||||
| @@ -37,7 +45,7 @@ public interface SqUserTagMapper | ||||
|  | ||||
|     /** | ||||
|      * 修改标签管理 | ||||
|      *  | ||||
|      * | ||||
|      * @param sqUserTag 标签管理 | ||||
|      * @return 结果 | ||||
|      */ | ||||
| @@ -45,7 +53,7 @@ public interface SqUserTagMapper | ||||
|  | ||||
|     /** | ||||
|      * 删除标签管理 | ||||
|      *  | ||||
|      * | ||||
|      * @param id 标签管理ID | ||||
|      * @return 结果 | ||||
|      */ | ||||
| @@ -53,7 +61,7 @@ public interface SqUserTagMapper | ||||
|  | ||||
|     /** | ||||
|      * 批量删除标签管理 | ||||
|      *  | ||||
|      * | ||||
|      * @param ids 需要删除的数据ID | ||||
|      * @return 结果 | ||||
|      */ | ||||
|   | ||||
| @@ -1,19 +1,31 @@ | ||||
| package com.ruoyi.bookmark.service; | ||||
|  | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
|  | ||||
| import com.ruoyi.bookmark.domain.SqUserTag; | ||||
|  | ||||
| /** | ||||
|  * 标签管理Service接口 | ||||
|  *  | ||||
|  * | ||||
|  * @author wang | ||||
|  * @date 2020-09-04 | ||||
|  */ | ||||
| public interface ISqUserTagService  | ||||
| public interface ISqUserTagService | ||||
| { | ||||
|  | ||||
|  | ||||
|     /** | ||||
|      *通过用户userID查用户的所有标签 | ||||
|      * | ||||
|      * | ||||
|      */ | ||||
|  | ||||
|     public List<Map<String,Object>> selectSqUserTagByUserId(Long userId); | ||||
|  | ||||
|     /** | ||||
|      * 查询标签管理 | ||||
|      *  | ||||
|      * | ||||
|      * @param id 标签管理ID | ||||
|      * @return 标签管理 | ||||
|      */ | ||||
| @@ -21,7 +33,7 @@ public interface ISqUserTagService | ||||
|  | ||||
|     /** | ||||
|      * 查询标签管理列表 | ||||
|      *  | ||||
|      * | ||||
|      * @param sqUserTag 标签管理 | ||||
|      * @return 标签管理集合 | ||||
|      */ | ||||
| @@ -29,7 +41,7 @@ public interface ISqUserTagService | ||||
|  | ||||
|     /** | ||||
|      * 新增标签管理 | ||||
|      *  | ||||
|      * | ||||
|      * @param sqUserTag 标签管理 | ||||
|      * @return 结果 | ||||
|      */ | ||||
| @@ -37,7 +49,7 @@ public interface ISqUserTagService | ||||
|  | ||||
|     /** | ||||
|      * 修改标签管理 | ||||
|      *  | ||||
|      * | ||||
|      * @param sqUserTag 标签管理 | ||||
|      * @return 结果 | ||||
|      */ | ||||
| @@ -45,7 +57,7 @@ public interface ISqUserTagService | ||||
|  | ||||
|     /** | ||||
|      * 批量删除标签管理 | ||||
|      *  | ||||
|      * | ||||
|      * @param ids 需要删除的标签管理ID | ||||
|      * @return 结果 | ||||
|      */ | ||||
| @@ -53,7 +65,7 @@ public interface ISqUserTagService | ||||
|  | ||||
|     /** | ||||
|      * 删除标签管理信息 | ||||
|      *  | ||||
|      * | ||||
|      * @param id 标签管理ID | ||||
|      * @return 结果 | ||||
|      */ | ||||
|   | ||||
| @@ -1,6 +1,8 @@ | ||||
| package com.ruoyi.bookmark.service.impl; | ||||
|  | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
|  | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | ||||
| import com.ruoyi.bookmark.mapper.SqUserTagMapper; | ||||
| @@ -9,19 +11,32 @@ import com.ruoyi.bookmark.service.ISqUserTagService; | ||||
|  | ||||
| /** | ||||
|  * 标签管理Service业务层处理 | ||||
|  *  | ||||
|  * | ||||
|  * @author wang | ||||
|  * @date 2020-09-04 | ||||
|  */ | ||||
| @Service | ||||
| public class SqUserTagServiceImpl implements ISqUserTagService  | ||||
| public class SqUserTagServiceImpl implements ISqUserTagService | ||||
| { | ||||
|     @Autowired | ||||
|     private SqUserTagMapper sqUserTagMapper; | ||||
|  | ||||
|  | ||||
|     /** | ||||
|      *通过用户userID查用户的所有标签 | ||||
|      * | ||||
|      * | ||||
|      */ | ||||
|     @Override | ||||
|     public List<Map<String,Object>>selectSqUserTagByUserId(Long userId){ | ||||
|         return sqUserTagMapper.selectSqUserTagByUserId(userId); | ||||
|     } | ||||
|  | ||||
|  | ||||
|  | ||||
|     /** | ||||
|      * 查询标签管理 | ||||
|      *  | ||||
|      * | ||||
|      * @param id 标签管理ID | ||||
|      * @return 标签管理 | ||||
|      */ | ||||
| @@ -33,7 +48,7 @@ public class SqUserTagServiceImpl implements ISqUserTagService | ||||
|  | ||||
|     /** | ||||
|      * 查询标签管理列表 | ||||
|      *  | ||||
|      * | ||||
|      * @param sqUserTag 标签管理 | ||||
|      * @return 标签管理 | ||||
|      */ | ||||
| @@ -45,7 +60,7 @@ public class SqUserTagServiceImpl implements ISqUserTagService | ||||
|  | ||||
|     /** | ||||
|      * 新增标签管理 | ||||
|      *  | ||||
|      * | ||||
|      * @param sqUserTag 标签管理 | ||||
|      * @return 结果 | ||||
|      */ | ||||
| @@ -57,7 +72,7 @@ public class SqUserTagServiceImpl implements ISqUserTagService | ||||
|  | ||||
|     /** | ||||
|      * 修改标签管理 | ||||
|      *  | ||||
|      * | ||||
|      * @param sqUserTag 标签管理 | ||||
|      * @return 结果 | ||||
|      */ | ||||
| @@ -69,7 +84,7 @@ public class SqUserTagServiceImpl implements ISqUserTagService | ||||
|  | ||||
|     /** | ||||
|      * 批量删除标签管理 | ||||
|      *  | ||||
|      * | ||||
|      * @param ids 需要删除的标签管理ID | ||||
|      * @return 结果 | ||||
|      */ | ||||
| @@ -81,7 +96,7 @@ public class SqUserTagServiceImpl implements ISqUserTagService | ||||
|  | ||||
|     /** | ||||
|      * 删除标签管理信息 | ||||
|      *  | ||||
|      * | ||||
|      * @param id 标签管理ID | ||||
|      * @return 结果 | ||||
|      */ | ||||
|   | ||||
| @@ -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.SqUserTagMapper"> | ||||
|      | ||||
|  | ||||
|     <resultMap type="SqUserTag" id="SqUserTagResult"> | ||||
|         <result property="id"    column="id"    /> | ||||
|         <result property="userId"    column="user_id"    /> | ||||
| @@ -18,19 +18,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||||
|  | ||||
|     <select id="selectSqUserTagList" parameterType="SqUserTag" resultMap="SqUserTagResult"> | ||||
|         <include refid="selectSqUserTagVo"/> | ||||
|         <where>   | ||||
|         <where> | ||||
|             <if test="userId != null "> and user_id = #{userId}</if> | ||||
|             <if test="tagId != null "> and tag_id = #{tagId}</if> | ||||
|             <if test="icount != null "> and icount = #{icount}</if> | ||||
|             <if test="iorder != null "> and iorder = #{iorder}</if> | ||||
|         </where> | ||||
|     </select> | ||||
|      | ||||
|  | ||||
|     <select id="selectSqUserTagById" parameterType="Long" resultMap="SqUserTagResult"> | ||||
|         <include refid="selectSqUserTagVo"/> | ||||
|         where id = #{id} | ||||
|     </select> | ||||
|          | ||||
|  | ||||
|     <insert id="insertSqUserTag" parameterType="SqUserTag" useGeneratedKeys="true" keyProperty="id"> | ||||
|         insert into sq_user_tag | ||||
|         <trim prefix="(" suffix=")" suffixOverrides=","> | ||||
| @@ -63,10 +63,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||||
|     </delete> | ||||
|  | ||||
|     <delete id="deleteSqUserTagByIds" parameterType="String"> | ||||
|         delete from sq_user_tag where id in  | ||||
|         delete from sq_user_tag where id in | ||||
|         <foreach item="id" collection="array" open="(" separator="," close=")"> | ||||
|             #{id} | ||||
|         </foreach> | ||||
|     </delete> | ||||
|      | ||||
| </mapper> | ||||
|  | ||||
|     <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 WHERE u.tag_id=t.id AND u.user_id = 1 ORDER BY u.iorder | ||||
|     </select> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| </mapper> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user