查询用户标签
This commit is contained in:
@ -1,6 +1,8 @@
|
|||||||
package com.ruoyi.web.controller.yunbookmark;
|
package com.ruoyi.web.controller.yunbookmark;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@ -27,12 +29,27 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
|||||||
* @date 2020-09-04
|
* @date 2020-09-04
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/system/usertag")
|
@RequestMapping("/usertag/tag")
|
||||||
public class SqUserTagController extends BaseController
|
public class SqUserTagController extends BaseController
|
||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISqUserTagService sqUserTagService;
|
private ISqUserTagService sqUserTagService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用戶标签
|
||||||
|
*/
|
||||||
|
|
||||||
|
@GetMapping(value = "/selectTagByUserID/{userId}")
|
||||||
|
public AjaxResult selectSqUserTagByUserId(@PathVariable("userId") Long userId)
|
||||||
|
{
|
||||||
|
List<Map<String,Object>> map = sqUserTagService.selectSqUserTagByUserId(userId);
|
||||||
|
return AjaxResult.success(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询标签管理列表
|
* 查询标签管理列表
|
||||||
*/
|
*/
|
||||||
|
@ -2,20 +2,17 @@ package com.ruoyi.web.test.controller;
|
|||||||
|
|
||||||
|
|
||||||
import com.ruoyi.bookmark.mapper.SqMenuMapper;
|
import com.ruoyi.bookmark.mapper.SqMenuMapper;
|
||||||
import com.ruoyi.bookmark.service.impl.SqMenuServiceImpl;
|
import com.ruoyi.bookmark.service.ISqUserTagService;
|
||||||
import com.ruoyi.web.controller.yunbookmark.SqBookmarkController;
|
import com.ruoyi.web.controller.yunbookmark.SqBookmarkController;
|
||||||
import org.assertj.core.api.Assertions;
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.web.client.TestRestTemplate;
|
|
||||||
import org.springframework.test.web.servlet.MockMvc;
|
import org.springframework.test.web.servlet.MockMvc;
|
||||||
import org.springframework.test.web.servlet.MvcResult;
|
|
||||||
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
|
||||||
import org.springframework.test.web.servlet.result.MockMvcResultHandlers;
|
|
||||||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
|
||||||
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Auther: Wang
|
* @Auther: Wang
|
||||||
* @Date: 2020/08/08 18:51
|
* @Date: 2020/08/08 18:51
|
||||||
@ -28,6 +25,12 @@ public class SqBookmarkTest extends BaseSpringBootTest{
|
|||||||
private SqBookmarkController sqBookmarkController;
|
private SqBookmarkController sqBookmarkController;
|
||||||
@Autowired
|
@Autowired
|
||||||
private SqMenuMapper sqMenuMapper;
|
private SqMenuMapper sqMenuMapper;
|
||||||
|
@Autowired
|
||||||
|
private ISqUserTagService iSqUserTagService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private MockMvc mockMvc;
|
private MockMvc mockMvc;
|
||||||
|
|
||||||
@ -46,13 +49,34 @@ public class SqBookmarkTest extends BaseSpringBootTest{
|
|||||||
// logger.info(mvcResult.getResponse().getContentAsString());
|
// logger.info(mvcResult.getResponse().getContentAsString());
|
||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
|
// @Test
|
||||||
|
// public void demo() throws Exception {
|
||||||
|
// Long[] menuIds={1L,4L,6L};
|
||||||
|
// sqMenuMapper.updateCountAdd(menuIds,5);
|
||||||
|
//
|
||||||
|
// logger.info("执行完毕");
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
/**
|
||||||
|
* @auther: Wang
|
||||||
|
* @date: 2020/09/04 23:58
|
||||||
|
* 功能描述: 测试查询用户的 标签
|
||||||
|
*/
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void demo() throws Exception {
|
public void selectSqUserTagByUserId() throws Exception {
|
||||||
Long[] menuIds={1L,4L,6L};
|
List<Map<String,Object>> map = iSqUserTagService.selectSqUserTagByUserId(1L);
|
||||||
sqMenuMapper.updateCountAdd(menuIds,5);
|
|
||||||
|
|
||||||
logger.info("执行完毕");
|
logger.info("执行完毕");
|
||||||
|
for (Map<String, Object> list: map) {
|
||||||
|
for (Map.Entry<String,Object> entry: list.entrySet() ) {
|
||||||
|
System.out.println(entry.getKey()+"="+entry.getValue());
|
||||||
|
}
|
||||||
|
logger.info("========================================");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.ruoyi.bookmark.mapper;
|
package com.ruoyi.bookmark.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import com.ruoyi.bookmark.domain.SqUserTag;
|
import com.ruoyi.bookmark.domain.SqUserTag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -11,6 +13,12 @@ import com.ruoyi.bookmark.domain.SqUserTag;
|
|||||||
*/
|
*/
|
||||||
public interface SqUserTagMapper
|
public interface SqUserTagMapper
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
*通过用户userID查用户的所有标签
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public List<Map<String,Object>> selectSqUserTagByUserId(Long userId);
|
||||||
/**
|
/**
|
||||||
* 查询标签管理
|
* 查询标签管理
|
||||||
*
|
*
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.ruoyi.bookmark.service;
|
package com.ruoyi.bookmark.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import com.ruoyi.bookmark.domain.SqUserTag;
|
import com.ruoyi.bookmark.domain.SqUserTag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -11,6 +13,16 @@ import com.ruoyi.bookmark.domain.SqUserTag;
|
|||||||
*/
|
*/
|
||||||
public interface ISqUserTagService
|
public interface ISqUserTagService
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*通过用户userID查用户的所有标签
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public List<Map<String,Object>> selectSqUserTagByUserId(Long userId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询标签管理
|
* 查询标签管理
|
||||||
*
|
*
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.ruoyi.bookmark.service.impl;
|
package com.ruoyi.bookmark.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.ruoyi.bookmark.mapper.SqUserTagMapper;
|
import com.ruoyi.bookmark.mapper.SqUserTagMapper;
|
||||||
@ -19,6 +21,19 @@ public class SqUserTagServiceImpl implements ISqUserTagService
|
|||||||
@Autowired
|
@Autowired
|
||||||
private SqUserTagMapper sqUserTagMapper;
|
private SqUserTagMapper sqUserTagMapper;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*通过用户userID查用户的所有标签
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<Map<String,Object>>selectSqUserTagByUserId(Long userId){
|
||||||
|
return sqUserTagMapper.selectSqUserTagByUserId(userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询标签管理
|
* 查询标签管理
|
||||||
*
|
*
|
||||||
|
@ -69,4 +69,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<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>
|
</mapper>
|
Reference in New Issue
Block a user