51 lines
1.1 KiB
Java
51 lines
1.1 KiB
Java
package de.jottyfan.bico.modules.subject;
|
|
|
|
import java.util.List;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import de.jottyfan.bico.db.public_.tables.records.TSourceRecord;
|
|
import de.jottyfan.bico.db.public_.tables.records.TSubjectRecord;
|
|
import de.jottyfan.bico.db.public_.tables.records.VLessonRecord;
|
|
|
|
/**
|
|
*
|
|
* @author jotty
|
|
*
|
|
*/
|
|
@Service
|
|
public class SubjectService {
|
|
|
|
@Autowired
|
|
private SubjectRepository repository;
|
|
|
|
public List<VLessonRecord> getSubjects() {
|
|
return repository.getSubjects();
|
|
}
|
|
|
|
public TSubjectRecord getSubject(Integer pkSubject) {
|
|
return repository.getSubject(pkSubject);
|
|
}
|
|
|
|
public List<TSourceRecord> getSources() {
|
|
return repository.getSources();
|
|
}
|
|
|
|
public void save(TSubjectRecord bean) {
|
|
if (bean.getPkSubject() == null) {
|
|
repository.addSubject(bean);
|
|
} else {
|
|
repository.updateSubject(bean);
|
|
}
|
|
}
|
|
|
|
public TSubjectRecord getBeanIfDeletable(Integer pkSubject) {
|
|
return repository.getBeanIfDeletable(pkSubject);
|
|
}
|
|
|
|
public void removeSubject(Integer pkSubject) {
|
|
repository.removeSubject(pkSubject);
|
|
}
|
|
}
|