From c4dd18b0c03c4d10b9db3719b1d59aca17b7e0cf Mon Sep 17 00:00:00 2001 From: User_cyk <1020691186@qq.com> Date: Fri, 7 Jul 2023 10:05:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=B9=B3=E5=9D=87=E6=98=9F?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/hellogithub/entity/projectEntity.java | 10 ++++++++++ src/com/hellogithub/service/projectService.java | 17 +++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/src/com/hellogithub/entity/projectEntity.java b/src/com/hellogithub/entity/projectEntity.java index 4cbb697..b38a9e1 100644 --- a/src/com/hellogithub/entity/projectEntity.java +++ b/src/com/hellogithub/entity/projectEntity.java @@ -151,4 +151,14 @@ public class projectEntity { public void setNum(long num) { this.num = num; } + + double average; + + public double getAverage() { + return average; + } + + public void setAverage(double average) { + this.average = average; + } } diff --git a/src/com/hellogithub/service/projectService.java b/src/com/hellogithub/service/projectService.java index 9a2dce4..efcfc7b 100644 --- a/src/com/hellogithub/service/projectService.java +++ b/src/com/hellogithub/service/projectService.java @@ -8,6 +8,7 @@ import com.hellogithub.dao.commentDao; import com.hellogithub.dao.projectDao; import com.hellogithub.dao.supportDao; import com.hellogithub.entity.categoryEntity; +import com.hellogithub.entity.commentEntity; import com.hellogithub.entity.projectEntity; import com.hellogithub.entity.supportEntity; @@ -146,6 +147,22 @@ public class projectService { projectEntity projectEntity = projectDao.selectProById(id); categoryEntity categoryEntity = categoryDao.retNum(projectEntity.getCategoryId()); projectEntity.setCategoryName(categoryEntity.getCategoryName()); + + List commentEntityList = commentDao.selectByProjectId(id); + + if(commentEntityList.size() != 0) + { + int sum = 0; + for(int i= 0;i