diff --git a/src/com/hellogithub/entity/commentEntity.java b/src/com/hellogithub/entity/commentEntity.java index 7c3a297..0158805 100644 --- a/src/com/hellogithub/entity/commentEntity.java +++ b/src/com/hellogithub/entity/commentEntity.java @@ -85,4 +85,14 @@ public class commentEntity { public void setLikeNum(int likeCount) { this.likeNum = likeCount; } + + String username; + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } } diff --git a/src/com/hellogithub/service/commentService.java b/src/com/hellogithub/service/commentService.java index 4068f88..3b62a0a 100644 --- a/src/com/hellogithub/service/commentService.java +++ b/src/com/hellogithub/service/commentService.java @@ -6,6 +6,7 @@ import com.hellogithub.dao.UserDao; import com.hellogithub.dao.commentDao; import com.hellogithub.entity.commentEntity; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -55,7 +56,7 @@ public class commentService { public String selectByTrait(String id,String trait) { - List commentEntityList = commentDao.selectByTrait(id,trait); + List commentEntityList=new ArrayList<>(); if(trait.equals("last")) { commentEntityList = commentDao.selectByTrait(id,"creatTime"); @@ -64,7 +65,13 @@ public class commentService { { commentEntityList = commentDao.selectByTrait(id,"likeNum"); } - + for(int i=0;i