From f7040e0111de4054994c926d5ec6ed79502aa7e1 Mon Sep 17 00:00:00 2001 From: chuyan <1047381936@qq.com> Date: Mon, 6 Apr 2020 15:53:53 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ase/repository/activity/ActivityRepository.java | 2 -- .../com/codesdream/ase/service/ActivityService.java | 10 +++++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/codesdream/ase/repository/activity/ActivityRepository.java b/src/main/java/com/codesdream/ase/repository/activity/ActivityRepository.java index 6700258..aa5ea5b 100644 --- a/src/main/java/com/codesdream/ase/repository/activity/ActivityRepository.java +++ b/src/main/java/com/codesdream/ase/repository/activity/ActivityRepository.java @@ -18,6 +18,4 @@ public interface ActivityRepository extends JpaRepository { Optional findByCreator(String creatorName); - List findByUserAndType(User user, String type); - } \ No newline at end of file diff --git a/src/main/java/com/codesdream/ase/service/ActivityService.java b/src/main/java/com/codesdream/ase/service/ActivityService.java index 899acf3..9c42112 100644 --- a/src/main/java/com/codesdream/ase/service/ActivityService.java +++ b/src/main/java/com/codesdream/ase/service/ActivityService.java @@ -35,7 +35,15 @@ public class ActivityService implements IActivityService { @Override public List findActivityByType(User user, String type) { - return activityRepository.findByUserAndType(user, type); + + List activities = this.findAll(user); + List actsByType = new ArrayList<>(); + for (Activity activity : activities) { + if (activity.getType().equals(type)) { + actsByType.add(activity); + } + } + return actsByType; } @Override