我的发布--添加--查看我关注了哪些人

This commit is contained in:
haotianmingyue 2024-12-26 11:52:07 +08:00
parent 6513a5b5f3
commit 08968a3aff
6 changed files with 111 additions and 1 deletions

View File

@ -34,6 +34,7 @@ import com.ruoyi.framework.web.service.TokenService;
import com.ruoyi.web.controller.app.baidu.GsonUtils;
import com.ruoyi.web.controller.app.baidu.OcrIdCardBAI;
import com.ruoyi.web.controller.app.pay.PayService;
import javafx.scene.chart.StackedAreaChart;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
@ -1268,6 +1269,20 @@ public class AppSystemController extends BaseController {
}
// 我的--查看我关注了那些人
@GetMapping("/getFollowerList")
public TableDataInfo getFollowerList() {
Long userId = getUserId();
startPage();
List<FollowerListDto> followerList = userFollowService.getFollowerList(userId);
return getDataTable(followerList);
}
// 新增关注
@GetMapping("/addFollower/{followedUserId}")

View File

@ -0,0 +1,57 @@
package com.ruoyi.system.domain.dto;
import java.util.Date;
/*
* 我的--查看我关注了那些人
* */
public class FollowerListDto {
private Long userId;
private String nickName;
private String avatar;
private String detail;
private Date createTime;
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
public String getAvatar() {
return avatar;
}
public void setAvatar(String avatar) {
this.avatar = avatar;
}
public String getDetail() {
return detail;
}
public void setDetail(String detail) {
this.detail = detail;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}

View File

@ -2,6 +2,7 @@ package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.SysUserFollow;
import com.ruoyi.system.domain.dto.FollowerListDto;
/**
* 用户关注Mapper接口
@ -58,4 +59,9 @@ public interface SysUserFollowMapper
* @return 结果
*/
public int deleteSysUserFollowByIds(Long[] ids);
/*
* 我的--查看我关注了那些人
* */
public List<FollowerListDto> getFollowerList(Long userId);
}

View File

@ -2,6 +2,7 @@ package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.SysUserFollow;
import com.ruoyi.system.domain.dto.FollowerListDto;
/**
* 用户关注Service接口
@ -58,4 +59,9 @@ public interface ISysUserFollowService
* @return 结果
*/
public int deleteSysUserFollowById(Long id);
/*
* 我的--查看我关注了那些人
* */
public List<FollowerListDto> getFollowerList(Long userId);
}

View File

@ -2,6 +2,7 @@ package com.ruoyi.system.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.dto.FollowerListDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SysUserFollowMapper;
@ -93,4 +94,12 @@ public class SysUserFollowServiceImpl implements ISysUserFollowService
{
return sysUserFollowMapper.deleteSysUserFollowById(id);
}
@Override
/*
* 我的--查看我关注了那些人
* */
public List<FollowerListDto> getFollowerList(Long userId){
return sysUserFollowMapper.getFollowerList(userId);
}
}

View File

@ -13,6 +13,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="update_time" />
</resultMap>
<resultMap id="FollowerListDtoResult" type="FollowerListDto">
<result property="userId" column="user_id" />
<result property="nickName" column="nick_name" />
<result property="avatar" column="avatar" />
<result property="detail" column="remark" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectSysUserFollowVo">
select id, user_id, followed_user_id, status, create_time, update_time from sys_user_follow
</sql>
@ -30,7 +39,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectSysUserFollowVo"/>
where id = #{id}
</select>
<select id="getFollowerList" resultMap="FollowerListDtoResult">
select u.user_id, u.nick_name, u.avatar, u.remark, f.create_time
from sys_user_follow f
left join sys_user u on f.followed_user_id = u.user_id
where f.user_id = #{userId}
</select>
<insert id="insertSysUserFollow" parameterType="SysUserFollow" useGeneratedKeys="true" keyProperty="id">
insert into sys_user_follow
<trim prefix="(" suffix=")" suffixOverrides=",">