修复便签功能
This commit is contained in:
parent
116204666b
commit
db1fae1c4f
@ -53,3 +53,8 @@ Destroyed(销毁之后)
|
||||
activate(keep-alive组件激活时调用)
|
||||
deactivated(keep-alive组件停用时调用)
|
||||
errorCaptured(这个组件的作用是接受子孙组件报错是调用,三个参数 错误对象、错误的组件、错误信息)
|
||||
|
||||
|
||||
redis 分页
|
||||
// pageNum=5&pageSize=15 第几页 每页 15条
|
||||
//pageNum 起 &pageSize 结束
|
||||
|
@ -0,0 +1,172 @@
|
||||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.core.redis.RedisUtil;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.system.domain.SysUserFollow;
|
||||
import com.ruoyi.system.service.ISysUserFollowService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 我的关注Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-01-24
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/follow")
|
||||
public class SysUserFollowController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysUserFollowService sysUserFollowService;
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查看我的关注列表
|
||||
*/
|
||||
@GetMapping("/listFollwUser")
|
||||
public TableDataInfo listFollwUser()
|
||||
{
|
||||
startPage();
|
||||
List<Map<String,Object>> list = sysUserFollowService.listFollwUser(getAuthUser().getUserId());
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查看我的粉丝列表
|
||||
*/
|
||||
@GetMapping("/listFansUser")
|
||||
public TableDataInfo listFansUser()
|
||||
{
|
||||
startPage();
|
||||
List<Map<String,Object>> list = sysUserFollowService.listFansUser(getAuthUser().getUserId());
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询我的关注列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:follow:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysUserFollow sysUserFollow)
|
||||
{
|
||||
startPage();
|
||||
List<SysUserFollow> list = sysUserFollowService.selectSysUserFollowList(sysUserFollow);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出我的关注列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:follow:export')")
|
||||
@Log(title = "我的关注", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SysUserFollow sysUserFollow)
|
||||
{
|
||||
List<SysUserFollow> list = sysUserFollowService.selectSysUserFollowList(sysUserFollow);
|
||||
ExcelUtil<SysUserFollow> util = new ExcelUtil<SysUserFollow>(SysUserFollow.class);
|
||||
return util.exportExcel(list, "follow");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取我的关注详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:follow:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return AjaxResult.success(sysUserFollowService.selectSysUserFollowById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增我的关注
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:follow:add')")
|
||||
@Log(title = "我的关注", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SysUserFollow sysUserFollow)
|
||||
{
|
||||
return toAjax(sysUserFollowService.insertSysUserFollow(sysUserFollow));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改我的关注
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:follow:edit')")
|
||||
@Log(title = "我的关注", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SysUserFollow sysUserFollow)
|
||||
{
|
||||
return toAjax(sysUserFollowService.updateSysUserFollow(sysUserFollow));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除我的关注
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:follow:remove')")
|
||||
@Log(title = "我的关注", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(sysUserFollowService.deleteSysUserFollowByIds(ids));
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.ruoyi.web.test.controller;
|
||||
|
||||
import com.ruoyi.common.core.redis.RedisUtil;
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
* @Auther: Wang
|
||||
* @Date: 2021/01/24 14:04
|
||||
* 功能描述:
|
||||
*/
|
||||
public class redisTest extends BaseSpringBootTest{
|
||||
|
||||
@Autowired
|
||||
RedisUtil redisUtil;
|
||||
|
||||
@Test
|
||||
public void redisdemo(){
|
||||
redisUtil.sAdd("user:follow:1","1","2");
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package com.ruoyi.common.core.redis;
|
||||
|
||||
/**
|
||||
* @Auther: Wang
|
||||
* @Date: 2021/01/24 16:52
|
||||
* 功能描述:RedisKey key 工具
|
||||
*/
|
||||
public class RedisKey {
|
||||
|
||||
public static final String USER_FOLLOW ="USER:FOLLOW:";
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -15,21 +15,28 @@ import com.ruoyi.common.core.domain.BaseEntity;
|
||||
* @date 2020-09-12
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
|
||||
public class NmNoteContent
|
||||
{
|
||||
|
||||
/** 便签主键ID */
|
||||
private Long noteId;
|
||||
|
||||
/** markdown编辑器内容 */
|
||||
@Excel(name = "markdown编辑器内容")
|
||||
private String markdownContent;
|
||||
|
||||
/** ueditor编辑器内容 */
|
||||
@Excel(name = "ueditor编辑器内容")
|
||||
private String ueditorContent;
|
||||
|
||||
/** markdown编辑器内容 */
|
||||
@Excel(name = "markdown编辑器内容")
|
||||
private String markdownContent;
|
||||
|
||||
public NmNoteContent() {
|
||||
|
||||
}
|
||||
|
||||
public NmNoteContent(Long noteId, String ueditorContent, String markdownContent) {
|
||||
this.noteId = noteId;
|
||||
this.ueditorContent = ueditorContent;
|
||||
this.markdownContent = markdownContent;
|
||||
}
|
||||
}
|
||||
|
@ -80,11 +80,14 @@ public class NmNoteServiceImpl implements INmNoteService {
|
||||
*/
|
||||
@Override
|
||||
public int insertNmNote(NmNote nmNote) {
|
||||
Long uuid = defaultUidGenerator.getUID();
|
||||
nmNote.setCreateTime(DateUtils.getNowDate());
|
||||
nmNote.setTitle(DateUtil.now());
|
||||
nmNote.setTiymceUeditor(defaultUidGenerator.getUID());
|
||||
nmNote.setTiymceUeditor(uuid);
|
||||
//文章内容
|
||||
nmNoteContentService.insertNmNoteContent(new NmNoteContent(uuid,null,"请开始你的记录~"));
|
||||
//创建文章>>mongodb
|
||||
redisCache.setCacheObject(Constants.NM_NOTE_CONTENT+nmNote.getTiymceUeditor(),"请开始你的创作!");
|
||||
// redisCache.setCacheObject(Constants.NM_NOTE_CONTENT+nmNote.getTiymceUeditor(),"请开始你的创作!");
|
||||
return nmNoteMapper.insertSelective(nmNote);
|
||||
}
|
||||
|
||||
@ -133,18 +136,11 @@ public class NmNoteServiceImpl implements INmNoteService {
|
||||
NmNote nmNote = new NmNote();
|
||||
nmNote.setNoteId(noteId);
|
||||
nmNote.setUserId(userID);
|
||||
NmNote isnmNote1 = nmNoteMapper.selectOne(nmNote);
|
||||
//查询对应的文章数据
|
||||
//1.查redis缓存
|
||||
String noteContent = redisCache.getCacheObject(Constants.NM_NOTE_CONTENT + isnmNote1.getTiymceUeditor());
|
||||
if (noteContent != null && !"".equals(noteContent)) {
|
||||
isnmNote1.setUeditorContent(noteContent);
|
||||
} else {
|
||||
// 2不存在就走mogodb
|
||||
List<NoteContentMgDb> NoteContentMgDb = noteRepositoryService.findById(isnmNote1.getTiymceUeditor() + "");
|
||||
isnmNote1.setUeditorContent(NoteContentMgDb.get(0).getNoteContent());
|
||||
}
|
||||
return isnmNote1;
|
||||
NmNote nmNoteS = nmNoteMapper.selectOne(nmNote);
|
||||
//获取文章
|
||||
NmNoteContent nmNoteContent = nmNoteContentService.selectNmNoteContentById(nmNoteS.getTiymceUeditor());
|
||||
nmNoteS.setUeditorContent(nmNoteContent.getUeditorContent());
|
||||
return nmNoteS;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -156,8 +152,10 @@ public class NmNoteServiceImpl implements INmNoteService {
|
||||
@Override
|
||||
public int userUpdateNote(NmNote nmNote) {
|
||||
//储存到redis中 只缓存频繁操作的文章内容
|
||||
redisCache.setCacheObject(Constants.NM_NOTE_CONTENT+nmNote.getTiymceUeditor(),nmNote.getUeditorContent());
|
||||
// 更新标题信息
|
||||
// redisCache.setCacheObject(Constants.NM_NOTE_CONTENT+nmNote.getTiymceUeditor(),nmNote.getUeditorContent());
|
||||
// 更新文章信息
|
||||
nmNoteContentService.updateNmNoteContent(new NmNoteContent(nmNote.getTiymceUeditor(),nmNote.getUeditorContent(),null));
|
||||
|
||||
return nmNoteMapper.updateNmNote(nmNote);
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,83 @@
|
||||
package com.ruoyi.system.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 我的关注对象 sys_user_follow
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-01-24
|
||||
*/
|
||||
public class SysUserFollow
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** $column.columnComment */
|
||||
private Long id;
|
||||
|
||||
/** 用户id */
|
||||
@Excel(name = "用户id")
|
||||
private Long userId;
|
||||
|
||||
/** 关注的用户id */
|
||||
@Excel(name = "关注的用户id")
|
||||
private Long followUserId;
|
||||
|
||||
/** 创建时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Column(name = "create_time")
|
||||
private Date createTime;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setUserId(Long userId)
|
||||
{
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Long getUserId()
|
||||
{
|
||||
return userId;
|
||||
}
|
||||
public void setFollowUserId(Long followUserId)
|
||||
{
|
||||
this.followUserId = followUserId;
|
||||
}
|
||||
|
||||
public Long getFollowUserId()
|
||||
{
|
||||
return followUserId;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SysUserFollow{" +
|
||||
"id=" + id +
|
||||
", userId=" + userId +
|
||||
", followUserId=" + followUserId +
|
||||
", createTime=" + createTime +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -0,0 +1,87 @@
|
||||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.ruoyi.system.domain.SysUserFollow;
|
||||
|
||||
/**
|
||||
* 我的关注Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-01-24
|
||||
*/
|
||||
public interface SysUserFollowMapper
|
||||
{
|
||||
/**
|
||||
* 查询我的关注
|
||||
*
|
||||
* @param id 我的关注ID
|
||||
* @return 我的关注
|
||||
*/
|
||||
public SysUserFollow selectSysUserFollowById(Long id);
|
||||
|
||||
/**
|
||||
* 查询我的关注列表
|
||||
*
|
||||
* @param sysUserFollow 我的关注
|
||||
* @return 我的关注集合
|
||||
*/
|
||||
public List<SysUserFollow> selectSysUserFollowList(SysUserFollow sysUserFollow);
|
||||
|
||||
/**
|
||||
* 新增我的关注
|
||||
*
|
||||
* @param sysUserFollow 我的关注
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysUserFollow(SysUserFollow sysUserFollow);
|
||||
|
||||
/**
|
||||
* 修改我的关注
|
||||
*
|
||||
* @param sysUserFollow 我的关注
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysUserFollow(SysUserFollow sysUserFollow);
|
||||
|
||||
/**
|
||||
* 删除我的关注
|
||||
*
|
||||
* @param id 我的关注ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysUserFollowById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除我的关注
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysUserFollowByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 查看我的关注列表 删
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
List<String> listFollwUser(Long userId);
|
||||
|
||||
/**
|
||||
* 查看我的关注列表
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
List<Map<String,Object>> listFollwUserByUid(Long userId);
|
||||
|
||||
/**
|
||||
* 查看我的粉丝列表
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> listFansUserByUid(Long userId);
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.ruoyi.system.domain.SysUserFollow;
|
||||
|
||||
/**
|
||||
* 我的关注Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-01-24
|
||||
*/
|
||||
public interface ISysUserFollowService
|
||||
{
|
||||
/**
|
||||
* 查询我的关注
|
||||
*
|
||||
* @param id 我的关注ID
|
||||
* @return 我的关注
|
||||
*/
|
||||
public SysUserFollow selectSysUserFollowById(Long id);
|
||||
|
||||
/**
|
||||
* 查询我的关注列表
|
||||
*
|
||||
* @param sysUserFollow 我的关注
|
||||
* @return 我的关注集合
|
||||
*/
|
||||
public List<SysUserFollow> selectSysUserFollowList(SysUserFollow sysUserFollow);
|
||||
|
||||
/**
|
||||
* 新增我的关注
|
||||
*
|
||||
* @param sysUserFollow 我的关注
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysUserFollow(SysUserFollow sysUserFollow);
|
||||
|
||||
/**
|
||||
* 修改我的关注
|
||||
*
|
||||
* @param sysUserFollow 我的关注
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysUserFollow(SysUserFollow sysUserFollow);
|
||||
|
||||
/**
|
||||
* 批量删除我的关注
|
||||
*
|
||||
* @param ids 需要删除的我的关注ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysUserFollowByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除我的关注信息
|
||||
*
|
||||
* @param id 我的关注ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysUserFollowById(Long id);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查看我的关注列表
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
List<Map<String,Object>> listFollwUser(Long userId);
|
||||
|
||||
/**
|
||||
* 查看我的粉丝列表
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
List<Map<String,Object>> listFansUser(Long userId);
|
||||
}
|
@ -0,0 +1,167 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.ruoyi.common.core.redis.RedisKey;
|
||||
import com.ruoyi.common.core.redis.RedisUtil;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.system.mapper.SysUserFollowMapper;
|
||||
import com.ruoyi.system.domain.SysUserFollow;
|
||||
import com.ruoyi.system.service.ISysUserFollowService;
|
||||
|
||||
/**
|
||||
* 我的关注Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-01-24
|
||||
*/
|
||||
@Service
|
||||
public class SysUserFollowServiceImpl implements ISysUserFollowService
|
||||
{
|
||||
@Autowired
|
||||
private SysUserFollowMapper sysUserFollowMapper;
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
/**
|
||||
* 查询我的关注
|
||||
*
|
||||
* @param id 我的关注ID
|
||||
* @return 我的关注
|
||||
*/
|
||||
@Override
|
||||
public SysUserFollow selectSysUserFollowById(Long id)
|
||||
{
|
||||
return sysUserFollowMapper.selectSysUserFollowById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询我的关注列表
|
||||
*
|
||||
* @param sysUserFollow 我的关注
|
||||
* @return 我的关注
|
||||
*/
|
||||
@Override
|
||||
public List<SysUserFollow> selectSysUserFollowList(SysUserFollow sysUserFollow)
|
||||
{
|
||||
return sysUserFollowMapper.selectSysUserFollowList(sysUserFollow);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增我的关注
|
||||
*
|
||||
* @param sysUserFollow 我的关注
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertSysUserFollow(SysUserFollow sysUserFollow)
|
||||
{
|
||||
sysUserFollow.setCreateTime(DateUtils.getNowDate());
|
||||
return sysUserFollowMapper.insertSysUserFollow(sysUserFollow);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改我的关注
|
||||
*
|
||||
* @param sysUserFollow 我的关注
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateSysUserFollow(SysUserFollow sysUserFollow)
|
||||
{
|
||||
return sysUserFollowMapper.updateSysUserFollow(sysUserFollow);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除我的关注
|
||||
*
|
||||
* @param ids 需要删除的我的关注ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysUserFollowByIds(Long[] ids)
|
||||
{
|
||||
return sysUserFollowMapper.deleteSysUserFollowByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除我的关注信息
|
||||
*
|
||||
* @param id 我的关注ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysUserFollowById(Long id)
|
||||
{
|
||||
return sysUserFollowMapper.deleteSysUserFollowById(id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查看我的关注列表
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String,Object>> listFollwUser(Long userId) {
|
||||
|
||||
return sysUserFollowMapper.listFollwUserByUid(userId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* redis 分页计算
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
public static HashMap<String, Long> redisPage(Long pageNum, Long pageSize) {
|
||||
HashMap<String, Long> map = new HashMap<String, Long>();
|
||||
if (pageNum == 1L) {
|
||||
pageNum = 0L;
|
||||
pageSize = pageSize - 1;
|
||||
} else {
|
||||
pageNum = pageNum * pageSize;
|
||||
pageSize = (pageNum + 1) * pageSize - 1;
|
||||
}
|
||||
map.put("pageNum", pageNum);
|
||||
map.put("pageSize", pageSize);
|
||||
return map;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 查看我的关注列表
|
||||
// *
|
||||
// * @param userId
|
||||
// * @return
|
||||
// */
|
||||
// @Override
|
||||
// public List<String> listFollwUser(Long userId, Long pageNum, Long pageSize) {
|
||||
// // pageNum=5&pageSize=15 第几页 每页 15条 pageNum 起 &pageSize 结束
|
||||
// HashMap<String, Long> map = redisPage(pageNum,pageSize);
|
||||
// List<String> list = redisUtil.lRange(RedisKey.USER_FOLLOW + userId ,map.get("pageNum"), map.get("pageSize"));
|
||||
// if (null == list || list.isEmpty()) {
|
||||
// //查库 --> 无序
|
||||
// list = sysUserFollowMapper.listFollwUser(userId);
|
||||
// if (null != list && !list.isEmpty()) {
|
||||
// //list<Long> 转 数组
|
||||
// redisUtil.lRightPushAll(RedisKey.USER_FOLLOW + userId, list.stream().toArray(String[]::new));
|
||||
// }
|
||||
// }
|
||||
// return list;
|
||||
// }
|
||||
|
||||
// @Override
|
||||
// public List<String> listFansUser(Long userId) {
|
||||
// return null;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> listFansUser(Long userId) {
|
||||
return sysUserFollowMapper.listFansUserByUid(userId);
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.system.mapper.SysUserFollowMapper">
|
||||
|
||||
<resultMap type="SysUserFollow" id="SysUserFollowResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="followUserId" column="follow_user_id" />
|
||||
<result property="createTime" column="create_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSysUserFollowVo">
|
||||
select id, user_id, follow_user_id, create_time from sys_user_follow
|
||||
</sql>
|
||||
|
||||
<select id="selectSysUserFollowList" parameterType="SysUserFollow" resultMap="SysUserFollowResult">
|
||||
<include refid="selectSysUserFollowVo"/>
|
||||
<where>
|
||||
<if test="userId != null "> and user_id = #{userId}</if>
|
||||
<if test="followUserId != null "> and follow_user_id = #{followUserId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectSysUserFollowById" parameterType="Long" resultMap="SysUserFollowResult">
|
||||
<include refid="selectSysUserFollowVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="listFollwUser" parameterType="Long" resultType="String">
|
||||
select follow_user_id from sys_user_follow where user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<select id="listFollwUserByUid" parameterType="Long" resultType="java.util.Map">
|
||||
select f.follow_user_id as userId,u.user_name as userName,u.avatar from sys_user_follow as f,sys_user as u where u.user_id = f.follow_user_id and f.user_id = #{userId}
|
||||
</select>
|
||||
<select id="listFansUserByUid" parameterType="Long" resultType="java.util.Map">
|
||||
select f.user_id as userId,u.user_name as userName,u.avatar from sys_user_follow as f,sys_user as u where u.user_id = f.user_id and f.follow_user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<insert id="insertSysUserFollow" parameterType="SysUserFollow" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sys_user_follow
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="userId != null">user_id,</if>
|
||||
<if test="followUserId != null">follow_user_id,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="userId != null">#{userId},</if>
|
||||
<if test="followUserId != null">#{followUserId},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateSysUserFollow" parameterType="SysUserFollow">
|
||||
update sys_user_follow
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="userId != null">user_id = #{userId},</if>
|
||||
<if test="followUserId != null">follow_user_id = #{followUserId},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteSysUserFollowById" parameterType="Long">
|
||||
delete from sys_user_follow where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSysUserFollowByIds" parameterType="String">
|
||||
delete from sys_user_follow where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
@ -343,7 +343,7 @@
|
||||
sousuo: '',
|
||||
drawer: false,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// loading: true,
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
@ -454,10 +454,10 @@
|
||||
return format(time, 'zh_CN'); //转换成类似于几天前的格式
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
|
||||
// document.querySelector("#datalist").addEventListener('scroll', this.handleScroll)
|
||||
},
|
||||
// mounted() {
|
||||
//
|
||||
// // document.querySelector("#datalist").addEventListener('scroll', this.handleScroll)
|
||||
// },
|
||||
computed: {
|
||||
/**list加载完毕就禁止滚动**/
|
||||
|
||||
@ -1411,7 +1411,7 @@
|
||||
.sousou-input i {
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.header-list {
|
||||
display: flex;
|
||||
@ -1485,7 +1485,7 @@
|
||||
}
|
||||
|
||||
.mianUrl-botoom{
|
||||
height: 900px;
|
||||
padding-bottom: 20px;
|
||||
|
||||
}
|
||||
.openurl{
|
||||
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
|
||||
<div >
|
||||
<div style="width:360px;height:260px;margin: 0 auto;margin-top: 40px">
|
||||
<!-- 用户导入对话框 -->
|
||||
<!-- <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>-->
|
||||
<el-upload
|
||||
@ -26,13 +26,15 @@
|
||||
<!-- <el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据-->
|
||||
<!-- <el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>-->
|
||||
<!-- </div>-->
|
||||
<div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入".html"格式文件!</div>
|
||||
<div class="el-upload__tip title" slot="tip">提示:仅允许导入".html"格式文件!</div>
|
||||
</el-upload>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" class=" mdui-text-center mdui-btn mdui-btn-raised mdui-text-color-blue-900 mdui-color-light-blue-100" @click="submitFileForm">确 定</el-button>
|
||||
<!-- <el-button @click="upload.open = false">取 消</el-button>-->
|
||||
<button class="mdui-btn mdui-btn-raised mdui-btn-dense mdui-color-light-blue-100 mdui-ripple">Button</button>
|
||||
<button @click="submitUpload" class="isbutton mdui-btn mdui-btn-block mdui-btn-raised mdui-btn-dense mdui-color-blue-100 mdui-ripple">导 入 书 签</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- </el-dialog>-->
|
||||
|
||||
<!-- <el-button-->
|
||||
@ -150,10 +152,11 @@
|
||||
|
||||
<style scoped>
|
||||
.text{
|
||||
border: #6f7180 1px solid;
|
||||
border: #cecece 1px solid;
|
||||
border-radius: 10px;
|
||||
margin-top: 10px;
|
||||
background-color: #e9e9e9;
|
||||
margin: 20px;
|
||||
background-color: #fafcff;
|
||||
margin-top: 30px;
|
||||
}
|
||||
|
||||
.structure {
|
||||
@ -173,4 +176,20 @@
|
||||
li{
|
||||
list-style:none;
|
||||
}
|
||||
.main{
|
||||
|
||||
}
|
||||
.upload-demo{
|
||||
}
|
||||
.title {
|
||||
color: red;
|
||||
width: 360px;
|
||||
height: 10px;
|
||||
text-align: center;
|
||||
margin-top: 7px;
|
||||
}
|
||||
.isbutton{
|
||||
margin-top: 10px;
|
||||
|
||||
}
|
||||
</style>
|
||||
|
@ -1,17 +1,23 @@
|
||||
<template>
|
||||
<div class="home" >
|
||||
<div class="home" v-loading="loading" >
|
||||
|
||||
<div class="nqtitle">
|
||||
<div class="mdui-textfield mdui-textfield-floating-label inputtop">
|
||||
<input class="mdui-textfield-input edittitle" v-model="queryParamsAndMg.title" type="text" required/>
|
||||
</div>
|
||||
<div class="common">
|
||||
<el-tag type="info" size="small" >{{queryParamsAndMg.updateTime==null?'0000:00:00':queryParamsAndMg.updateTime}}</el-tag>
|
||||
<el-tag type="info" size="small" >{{queryParamsAndMg.updateTime==null?'2020-12-13 21:24:35':queryParamsAndMg.updateTime}}</el-tag>
|
||||
<el-link type="info" icon="el-icon-edit" class="editNote" @click="updateEdit">{{updateOpn}}</el-link>
|
||||
<el-link type="info" icon="el-icon-delete" class="editNote">删除</el-link>
|
||||
<el-link type="info" icon="el-icon-delete" class="editNote delete">删除</el-link>
|
||||
<el-link type="info" icon="el-icon-refresh-right" class="editNote">刷新</el-link>
|
||||
<el-link type="info" icon="el-icon-connection" class="editNote">分享</el-link>
|
||||
<el-link type="info" class="editNote">|</el-link>
|
||||
<el-link type="info" icon="el-icon-lock" class="editNote">加密</el-link>
|
||||
<!-- <el-link type="info" icon="el-icon-unlock" class="editNote">未加密</el-link>-->
|
||||
<el-link type="info" icon="el-icon-key" class="editNote">改密</el-link>
|
||||
</div>
|
||||
</div>
|
||||
<div v-loading="loading" v-if="!showEditor" class="mian" v-html="queryParamsAndMg.ueditorContent">
|
||||
<div v-if="!showEditor" class="mian" v-html="queryParamsAndMg.ueditorContent">
|
||||
|
||||
|
||||
</div>
|
||||
@ -65,9 +71,8 @@
|
||||
updateEditor:null
|
||||
},
|
||||
mounted() {
|
||||
|
||||
this.showEditor=this.updateEditor;
|
||||
this.getNoteById();
|
||||
|
||||
},
|
||||
updated() {
|
||||
|
||||
@ -98,12 +103,13 @@
|
||||
ueditorContent: undefined,
|
||||
},
|
||||
showEditor:false,
|
||||
loading:false,
|
||||
updateOpn:'编辑'
|
||||
loading:true,
|
||||
updateOpn:'编辑',
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
this.getNoteById();
|
||||
},
|
||||
methods: {
|
||||
/** 实时更新文章的信息 */
|
||||
@ -121,7 +127,7 @@
|
||||
/** 查询便签管理列表 */
|
||||
getNoteById() {
|
||||
var that = this;
|
||||
that.loading=true;
|
||||
|
||||
var blueditor = that.ueditor != null && that.ueditor != '' && that.ueditor != undefined;
|
||||
var blnoteId = that.noteid != null && that.noteid != '' && that.noteid != undefined;
|
||||
if (blueditor) {
|
||||
@ -133,9 +139,10 @@
|
||||
if (blueditor && blnoteId) {
|
||||
userGetNoteInfo(this.queryParamsAndMg.noteId).then(response => {
|
||||
that.queryParamsAndMg = response.data;
|
||||
that.loading=false;
|
||||
});
|
||||
}
|
||||
that.loading=false;
|
||||
|
||||
},
|
||||
//鼠标单击的事件
|
||||
onClick(e, editor) {
|
||||
@ -179,12 +186,11 @@
|
||||
}
|
||||
|
||||
.mian {
|
||||
height: 100%;
|
||||
height: auto;
|
||||
overflow-y: auto;
|
||||
width: 1000px;
|
||||
width:auto;
|
||||
/*text-indent: 10px;*/
|
||||
padding: 10px;
|
||||
margin-bottom: 10px;
|
||||
opacity: 0.9;
|
||||
margin: 15px;
|
||||
border: 1px solid #D4D4D4;
|
||||
@ -210,6 +216,7 @@
|
||||
.nqtitle{
|
||||
margin-left: 13px;
|
||||
margin-bottom: 10px;
|
||||
margin-right: 17px;
|
||||
}
|
||||
.inputtop{
|
||||
padding-top: 6px;
|
||||
@ -219,5 +226,8 @@
|
||||
align-items: center;
|
||||
height: 22px;
|
||||
}
|
||||
.delete{
|
||||
color: #ff3b2f;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
@ -18,14 +18,14 @@ 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 property="sqTags"-->
|
||||
<!-- javaType="java.util.ArrayList"-->
|
||||
<!-- ofType="java.util.Map"-->
|
||||
<!-- select="com.ruoyi.bookmark.mapper.SqBookmarkTagMapper.selectSqTaListById"-->
|
||||
<!-- column="bookmark_id">-->
|
||||
|
||||
|
||||
</collection>
|
||||
<!-- </collection>-->
|
||||
|
||||
</resultMap>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user