From 95fdf7d063b683273db4da704869fd5ae1b3cd44 Mon Sep 17 00:00:00 2001 From: chuyan <1047381936@qq.com> Date: Sat, 12 Sep 2020 21:14:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E8=BF=9C=E7=AB=AF=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=BF=9B=E8=A1=8Cbug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/codesdream/ase/model/parent/Parent.java | 7 ++----- .../java/com/codesdream/ase/model/student/Student.java | 1 + .../ase/repository/parent/ParentRepository.java | 6 ++---- .../ase/repository/student/StudentRepository.java | 8 ++------ 4 files changed, 7 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/codesdream/ase/model/parent/Parent.java b/src/main/java/com/codesdream/ase/model/parent/Parent.java index 7fb7617..002a922 100644 --- a/src/main/java/com/codesdream/ase/model/parent/Parent.java +++ b/src/main/java/com/codesdream/ase/model/parent/Parent.java @@ -1,18 +1,15 @@ package com.codesdream.ase.model.parent; -import com.codesdream.ase.model.mark.Tag; import com.codesdream.ase.model.permission.User; import lombok.Data; import lombok.EqualsAndHashCode; -import javax.annotation.Generated; -import javax.persistence.*; -import java.util.List; +import javax.persistence.Entity; @Entity -@Table @Data @EqualsAndHashCode(callSuper = false) public class Parent extends User { + int studentId; } diff --git a/src/main/java/com/codesdream/ase/model/student/Student.java b/src/main/java/com/codesdream/ase/model/student/Student.java index 82329db..979e60c 100644 --- a/src/main/java/com/codesdream/ase/model/student/Student.java +++ b/src/main/java/com/codesdream/ase/model/student/Student.java @@ -13,6 +13,7 @@ import java.util.Map; @Data @EqualsAndHashCode(callSuper = false) public class Student extends User { + int parentId; String profilePicture; diff --git a/src/main/java/com/codesdream/ase/repository/parent/ParentRepository.java b/src/main/java/com/codesdream/ase/repository/parent/ParentRepository.java index 4560a04..83f2e1f 100644 --- a/src/main/java/com/codesdream/ase/repository/parent/ParentRepository.java +++ b/src/main/java/com/codesdream/ase/repository/parent/ParentRepository.java @@ -1,17 +1,15 @@ package com.codesdream.ase.repository.parent; import com.codesdream.ase.model.parent.Parent; -import com.codesdream.ase.model.student.Student; import org.springframework.data.domain.Sort; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import java.util.List; -import java.util.Optional; @Repository public interface ParentRepository extends JpaRepository { - List findByStudentId(String studentId); - List findByStudentId(String studentId, Sort sort); + List findByStudentId(int studentId); + List findByStudentId(int studentId, Sort sort); } diff --git a/src/main/java/com/codesdream/ase/repository/student/StudentRepository.java b/src/main/java/com/codesdream/ase/repository/student/StudentRepository.java index bcc9863..ca99a4a 100644 --- a/src/main/java/com/codesdream/ase/repository/student/StudentRepository.java +++ b/src/main/java/com/codesdream/ase/repository/student/StudentRepository.java @@ -1,18 +1,14 @@ package com.codesdream.ase.repository.student; import com.codesdream.ase.model.student.Student; -import com.codesdream.ase.model.student.StudentCourse; import org.springframework.data.domain.Sort; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; -import java.util.List; -import java.util.Optional; - @Repository public interface StudentRepository extends JpaRepository { - Student findByParentId(String parentId); - Student findByParentId(String parentId, Sort sort); + Student findByParentId(int parentId); + Student findByParentId(int parentId, Sort sort); }