#109 only one conference for paper
This commit is contained in:
parent
dffd839905
commit
1e07c5424d
@ -3,6 +3,7 @@ package ru.ulstu.paper.model;
|
||||
import org.hibernate.annotations.Fetch;
|
||||
import org.hibernate.annotations.FetchMode;
|
||||
import org.hibernate.validator.constraints.NotBlank;
|
||||
import ru.ulstu.conference.model.Conference;
|
||||
import ru.ulstu.core.model.BaseEntity;
|
||||
import ru.ulstu.core.model.UserContainer;
|
||||
import ru.ulstu.deadline.model.Deadline;
|
||||
@ -114,6 +115,9 @@ public class Paper extends BaseEntity implements UserContainer {
|
||||
@Column(name = "latex_text")
|
||||
private String latexText;
|
||||
|
||||
@ManyToMany(mappedBy = "papers")
|
||||
private List<Conference> conferences;
|
||||
|
||||
public PaperStatus getStatus() {
|
||||
return status;
|
||||
}
|
||||
@ -218,6 +222,14 @@ public class Paper extends BaseEntity implements UserContainer {
|
||||
this.latexText = latexText;
|
||||
}
|
||||
|
||||
public List<Conference> getConferences() {
|
||||
return conferences;
|
||||
}
|
||||
|
||||
public void setConferences(List<Conference> conferences) {
|
||||
this.conferences = conferences;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<User> getUsers() {
|
||||
return getAuthors();
|
||||
|
@ -20,4 +20,8 @@ public interface PaperRepository extends JpaRepository<Paper, Integer> {
|
||||
List<Paper> findByTypeAndStatus(Paper.PaperType type, Paper.PaperStatus status);
|
||||
|
||||
List<Paper> findByStatusNot(Paper.PaperStatus status);
|
||||
|
||||
List<Paper> findByConferencesIsNullAndStatusNot(Paper.PaperStatus status);
|
||||
|
||||
List<Paper> findByIdNotInAndConferencesIsNullAndStatusNot(List<Integer> paperIds, Paper.PaperStatus status);
|
||||
}
|
||||
|
@ -242,9 +242,9 @@ public class PaperService {
|
||||
|
||||
public List<Paper> findAllNotSelect(List<Integer> paperIds) {
|
||||
if (!paperIds.isEmpty()) {
|
||||
return sortPapers(paperRepository.findByIdNotIn(paperIds));
|
||||
return sortPapers(paperRepository.findByIdNotInAndConferencesIsNullAndStatusNot(paperIds, COMPLETED));
|
||||
} else {
|
||||
return sortPapers(paperRepository.findAll());
|
||||
return sortPapers(paperRepository.findByConferencesIsNullAndStatusNot(COMPLETED));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user