修改--user_info中添加关注他人数字段, 关注他人时增加这个字段的计数
This commit is contained in:
parent
af9f638850
commit
8e7ea04333
@ -549,6 +549,7 @@ public class AppSystemController extends BaseController {
|
||||
ajax.put("popularity", userInfo.getReceiveRockets());
|
||||
|
||||
// 关注,我关注的人数------暂定从 sys_user_follow表里获取-----------为了效率应该单开一个字段存储-----后续可以优化
|
||||
// 可以直接从 user_info中获取
|
||||
ajax.put("following", userFollowService.getFollowingCount(userId));
|
||||
|
||||
// 欢迎度, 多少人关注了我
|
||||
@ -1583,6 +1584,16 @@ public class AppSystemController extends BaseController {
|
||||
return AjaxResult.error("新增关注消息失败");
|
||||
}
|
||||
|
||||
// user_info中更新关注数
|
||||
UserInfo userInfo = userInfoService.selectUserInfoByUserId(userId);
|
||||
userInfo.setFollowings(userInfo.getFollowings() + 1);
|
||||
userInfoService.updateUserInfo(userInfo);
|
||||
|
||||
// user_info 中 被关注者被关注人数加1
|
||||
UserInfo userInfo1 = userInfoService.selectUserInfoByUserId(followedUserId);
|
||||
userInfo1.setFollowers(userInfo1.getFollowers() + 1);
|
||||
userInfoService.updateUserInfo(userInfo1);
|
||||
|
||||
return AjaxResult.success("新增关注成功");
|
||||
|
||||
|
||||
|
||||
@ -73,6 +73,9 @@ public class UserInfo extends BaseEntity
|
||||
@Excel(name = "被关注数")
|
||||
private Long followers;
|
||||
|
||||
/** 关注别人数*/
|
||||
private Long followings;
|
||||
|
||||
/** 7天在线时长(通过在线时长表来计算) */
|
||||
@Excel(name = "7天在线时长", readConverterExp = "通=过在线时长表来计算")
|
||||
private Long sOnlineTime;
|
||||
@ -245,6 +248,16 @@ public class UserInfo extends BaseEntity
|
||||
{
|
||||
return followers;
|
||||
}
|
||||
|
||||
public void setFollowings(Long followings)
|
||||
{
|
||||
this.followings = followings;
|
||||
}
|
||||
|
||||
public Long getFollowings()
|
||||
{
|
||||
return followings;
|
||||
}
|
||||
public void setsOnlineTime(Long sOnlineTime)
|
||||
{
|
||||
this.sOnlineTime = sOnlineTime;
|
||||
@ -360,6 +373,10 @@ public class UserInfo extends BaseEntity
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
@ -377,6 +394,7 @@ public class UserInfo extends BaseEntity
|
||||
.append("sendRockets", getSendRockets())
|
||||
.append("shares", getShares())
|
||||
.append("followers", getFollowers())
|
||||
.append("followings", getFollowings())
|
||||
.append("sOnlineTime", getsOnlineTime())
|
||||
.append("sMrTime", getsMrTime())
|
||||
.append("sConsumption", getsConsumption())
|
||||
@ -389,6 +407,9 @@ public class UserInfo extends BaseEntity
|
||||
.append("birth", getBirth())
|
||||
.append("backGround", getBackGround())
|
||||
.append("calculationTime", getCalculationTime())
|
||||
.append("idType", getIdType())
|
||||
|
||||
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,6 +10,7 @@ public class AppUserInfoVo {
|
||||
private Date createTime;
|
||||
/** 发出火箭数 */
|
||||
private Long sendRockets;
|
||||
/** 被关注数(欢迎度) */
|
||||
private Long followers;
|
||||
/** 7天在线时长(通过在线时长表来计算) */
|
||||
private Long sOnlineTime;
|
||||
|
||||
@ -19,6 +19,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="sendRockets" column="send_rockets" />
|
||||
<result property="shares" column="shares" />
|
||||
<result property="followers" column="followers" />
|
||||
<result property="followings" column="followings" />
|
||||
<result property="sOnlineTime" column="s_online_time" />
|
||||
<result property="sMrTime" column="s_mr_time" />
|
||||
<result property="sConsumption" column="s_consumption" />
|
||||
@ -70,7 +71,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
|
||||
<sql id="selectUserInfoVo">
|
||||
select user_id, authentication_status, real_name, id_card, sex, signature, avatar, card_front, card_back, email, receive_rockets, send_rockets, shares, followers, s_online_time, s_mr_time, s_consumption, th_consumption, phonenumber, t_mr_time, t_online_time, t_consumption, update_time, date_of_birth, back_ground, calculation_time, id_type from user_info
|
||||
select user_id, authentication_status, real_name, id_card, sex, signature, avatar, card_front, card_back, email, receive_rockets, send_rockets, shares, followers, followings,s_online_time, s_mr_time, s_consumption, th_consumption, phonenumber, t_mr_time, t_online_time, t_consumption, update_time, date_of_birth, back_ground, calculation_time, id_type from user_info
|
||||
</sql>
|
||||
|
||||
<select id="selectUserInfoList" parameterType="UserInfo" resultMap="UserInfoResult">
|
||||
@ -89,6 +90,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="sendRockets != null "> and send_rockets = #{sendRockets}</if>
|
||||
<if test="shares != null "> and shares = #{shares}</if>
|
||||
<if test="followers != null "> and followers = #{followers}</if>
|
||||
<if test="followings != null "> and followings = #{followings}</if>
|
||||
<if test="sOnlineTime != null "> and s_online_time = #{sOnlineTime}</if>
|
||||
<if test="sMrTime != null "> and s_mr_time = #{sMrTime}</if>
|
||||
<if test="sConsumption != null "> and s_consumption = #{sConsumption}</if>
|
||||
@ -166,6 +168,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="sendRockets != null">send_rockets,</if>
|
||||
<if test="shares != null">shares,</if>
|
||||
<if test="followers != null">followers,</if>
|
||||
<if test="followings != null">followings,</if>
|
||||
<if test="sOnlineTime != null">s_online_time,</if>
|
||||
<if test="sMrTime != null">s_mr_time,</if>
|
||||
<if test="sConsumption != null">s_consumption,</if>
|
||||
@ -195,6 +198,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="sendRockets != null">#{sendRockets},</if>
|
||||
<if test="shares != null">#{shares},</if>
|
||||
<if test="followers != null">#{followers},</if>
|
||||
<if test="followings != null">#{followings},</if>
|
||||
<if test="sOnlineTime != null">#{sOnlineTime},</if>
|
||||
<if test="sMrTime != null">#{sMrTime},</if>
|
||||
<if test="sConsumption != null">#{sConsumption},</if>
|
||||
@ -227,6 +231,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="sendRockets != null">send_rockets = #{sendRockets},</if>
|
||||
<if test="shares != null">shares = #{shares},</if>
|
||||
<if test="followers != null">followers = #{followers},</if>
|
||||
<if test="followings != null">followings = #{followings},</if>
|
||||
<if test="sOnlineTime != null">s_online_time = #{sOnlineTime},</if>
|
||||
<if test="sMrTime != null">s_mr_time = #{sMrTime},</if>
|
||||
<if test="sConsumption != null">s_consumption = #{sConsumption},</if>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user