From 223f979a0f7e415934a0f6ef86161c4f8f6e2c5f Mon Sep 17 00:00:00 2001 From: User_cyk <1020691186@qq.com> Date: Wed, 5 Jul 2023 13:40:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=84=E8=AE=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/hellogithub/entity/commentEntity.java | 10 ++++++++++ src/com/hellogithub/service/commentService.java | 11 +++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) 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