11111
This commit is contained in:
@ -2,7 +2,6 @@ package com.ruoyi.bookmark.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.bookmark.domain.SqBookmarkTag;
|
||||
import com.ruoyi.bookmark.domain.SqTag;
|
||||
import com.ruoyi.common.mybatisMapper.MyMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
@ -69,4 +69,9 @@ public interface ISqTagService
|
||||
public Map<String,Object> addtag(String tagName, Long userId);
|
||||
|
||||
|
||||
/**
|
||||
* @auther: 获取当前用户的总标签数量
|
||||
* @date: 2021/10/29 17:54
|
||||
*/
|
||||
int countByuserId(Long userId);
|
||||
}
|
||||
|
@ -0,0 +1,17 @@
|
||||
package com.ruoyi.bookmark.service;
|
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
|
||||
/**
|
||||
* @Auther: Wang
|
||||
* @Date: 2021/10/29 17:36
|
||||
* 功能描述:
|
||||
*/
|
||||
public interface ISqUserServise {
|
||||
/**
|
||||
*
|
||||
* 获取当前用户 首页的信息展示 redis
|
||||
*
|
||||
*/
|
||||
AjaxResult getPersonalMessage(Long userId);
|
||||
}
|
@ -133,8 +133,12 @@ public class SqTagServiceImpl implements ISqTagService
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int countByuserId(Long userId) {
|
||||
SqTag sqTag = new SqTag();
|
||||
sqTag.setUserId(userId);
|
||||
return sqTagMapper.selectCount(sqTag);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,47 @@
|
||||
package com.ruoyi.bookmark.service.impl;
|
||||
|
||||
import com.ruoyi.bookmark.service.ISqTagService;
|
||||
import com.ruoyi.bookmark.service.ISqUserServise;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.redis.RedisUtil;
|
||||
import com.ruoyi.common.utils.bookmarkhtml.Const;
|
||||
import com.ruoyi.common.utils.redis.KeyAll;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Auther: Wang
|
||||
* @Date: 2021/10/29 17:36
|
||||
* 功能描述:
|
||||
*/
|
||||
@Service
|
||||
public class SqUserServiseImpl implements ISqUserServise {
|
||||
|
||||
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
@Autowired
|
||||
private ISqTagService sqTagService;
|
||||
|
||||
|
||||
@Override
|
||||
public AjaxResult getPersonalMessage(Long userId) {
|
||||
|
||||
String key = KeyAll.PERSONAL_MESSAGE + userId.toString();
|
||||
if (!redisUtil.hasKey(key)){
|
||||
//数据不存在 新用户 进行初始化数据
|
||||
Map<Object, Object> mapPersonalMessage = new HashMap<>();
|
||||
//TAG 标签总数量
|
||||
// mapPersonalMessage.put("tagTotal",sqTagService.countByuserId(userId));
|
||||
}
|
||||
return AjaxResult.success(redisUtil.hGetAll(key));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user