活动、文件相关repository编写完成
This commit is contained in:
parent
5d3b6ec02d
commit
7d2e345876
@ -41,4 +41,7 @@ public class Activity {
|
||||
|
||||
@ManyToMany(cascade = CascadeType.MERGE)
|
||||
List<Tag> tags = new ArrayList<>();
|
||||
|
||||
@OneToOne(cascade = CascadeType.MERGE)
|
||||
Report report;
|
||||
}
|
||||
|
@ -15,6 +15,8 @@ public class Report {
|
||||
@Id
|
||||
int id;
|
||||
|
||||
int activityId;
|
||||
|
||||
String title;
|
||||
|
||||
@ManyToOne(cascade = CascadeType.MERGE)
|
||||
|
@ -0,0 +1,23 @@
|
||||
package com.codesdream.ase.repository.activity;
|
||||
|
||||
import com.codesdream.ase.model.activity.Activity;
|
||||
import com.codesdream.ase.model.permission.User;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface ActivityRepository extends JpaRepository<Activity, Integer> {
|
||||
|
||||
List<Activity> findByTitle(String title);
|
||||
List<Activity> findByTitle(String title, Sort sort);
|
||||
|
||||
List<Activity> findByCreator(User creator);
|
||||
List<Activity> findByCreator(User creator, Sort sort);
|
||||
|
||||
List<Activity> findByManager(User manager);
|
||||
List<Activity> findByManager(User manager, Sort sort);
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.codesdream.ase.repository.activity;
|
||||
|
||||
import com.codesdream.ase.model.activity.Report;
|
||||
import com.codesdream.ase.model.permission.User;
|
||||
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 ReportRepository extends JpaRepository<Report, Integer> {
|
||||
|
||||
Optional<Report> findByActivityId(int activityId);
|
||||
|
||||
List<Report> findByTitle(String title);
|
||||
List<Report> findByTitle(String title, Sort sort);
|
||||
|
||||
List<Report> findByCreator(User creator);
|
||||
List<Report> findByCreator(User creator, Sort sort);
|
||||
|
||||
List<Report> findByManager(User manager);
|
||||
List<Report> findByManager(User manager, Sort sort);
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package com.codesdream.ase.repository.file;
|
||||
|
||||
import com.codesdream.ase.model.file.File;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@Repository
|
||||
public interface FileRepository extends JpaRepository<File, Integer> {
|
||||
Optional<File> findByTitle(String title);
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.codesdream.ase.repository.file;
|
||||
|
||||
import com.codesdream.ase.model.file.Image;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface ImageRepository extends JpaRepository<Image, Integer> {
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package com.codesdream.ase.repository.mark;
|
||||
|
||||
import com.codesdream.ase.model.mark.Tag;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@Repository
|
||||
public interface TagRepository extends JpaRepository<Tag, Integer> {
|
||||
Optional<Tag> findByTagName(String tagName);
|
||||
}
|
Loading…
Reference in New Issue
Block a user