1.change count from Integer to int

main
Gary 10 months ago
parent 7801182926
commit 45e78101a2

@ -72,16 +72,16 @@ public class MyController extends BaseController{
UserInfo user = userInfoService.findById(userLoginDto.getUserId());
BeanUtils.copyProperties(user, userRespDTO);
//EnumMap<CollectTypeEnum,Long> map=userCollectService.getUserCollectTypeMap(user.getId());
Long fansCount=userCollectService.getFansCount(user.getId());
Long followCount=userCollectService.getCount(user.getId(),CollectTypeEnum.FOLLOW.getType());
Long thumbUpCount=userCollectService.getCount(user.getId(),CollectTypeEnum.THUMB_UP.getType());
Long songCount=userCollectService.getCount(user.getId(),CollectTypeEnum.SONG.getType());
Long journalCount=userCollectService.getCount(user.getId(),CollectTypeEnum.JOURNAL.getType());
int fansCount=userCollectService.getFansCount(user.getId());
int followCount=userCollectService.getCount(user.getId(),CollectTypeEnum.FOLLOW.getType());
int thumbUpCount=userCollectService.getCount(user.getId(),CollectTypeEnum.THUMB_UP.getType());
int songCount=userCollectService.getCount(user.getId(),CollectTypeEnum.SONG.getType());
int journalCount=userCollectService.getCount(user.getId(),CollectTypeEnum.JOURNAL.getType());
userRespDTO.setFollowCount(followCount);
userRespDTO.setFansCount(fansCount);
userRespDTO.setThumbUpCount(thumbUpCount);
userRespDTO.setCommentReplyCount(0L);
userRespDTO.setCommentReplyCount(0);
userRespDTO.setSongCount(songCount);
userRespDTO.setJournalCount(journalCount);

@ -15,6 +15,6 @@ public interface UserCollectDao extends MongoRepository<UserCollect, String> {
//@Query(value = "select NumberInt(collectType),count(*) from common.userCollect where userId=?1 group by collectType", nativeQuery = true)
//public List<UserCollectCount> countByUserIdAndGroupByCollectType(String userId);
public long countByObjectIdAndCollectType(String objectId, Integer collectType);
public long countByUserIdAndCollectType(String userId, Integer collectType);
public int countByObjectIdAndCollectType(String objectId, Integer collectType);
public int countByUserIdAndCollectType(String userId, Integer collectType);
}

@ -18,15 +18,15 @@ public class UserRespDTO {
@ApiModelProperty(value = "用户标识,如“贡献者”,“音乐人”")
private String badge;
@ApiModelProperty(value = "关注数")
private Long followCount;
private int followCount;
@ApiModelProperty(value = "粉丝数")
private Long fansCount;
private int fansCount;
@ApiModelProperty(value = "获赞数")
private Long thumbUpCount;
private int thumbUpCount;
@ApiModelProperty(value = "喜欢歌曲数")
private Long songCount;
private int songCount;
@ApiModelProperty(value = "收藏期刊数")
private Long journalCount;
private int journalCount;
@ApiModelProperty(value = "获得评论数")
private Long commentReplyCount;
private int commentReplyCount;
}

@ -67,11 +67,11 @@ public class UserInfo implements Serializable {
/**
*
*/
private Integer fansCount;
private int fansCount;
/**
*
*/
private Integer followCount;
private int followCount;
/**
*
*/
@ -111,5 +111,5 @@ public class UserInfo implements Serializable {
/**
* 0: 1:
*/
private Integer status;
private int status;
}

@ -59,11 +59,11 @@ public class UserCollectService {
return userCollectTypeMap;
}
public Long getFansCount(String userId) {
public int getFansCount(String userId) {
return userCollectDao.countByObjectIdAndCollectType(userId,CollectTypeEnum.FOLLOW.getType());
}
public Long getCount(String userId, Integer type) {
public int getCount(String userId, Integer type) {
return userCollectDao.countByUserIdAndCollectType(userId,type);
}
}

Loading…
Cancel
Save