48 lines
1.1 KiB
Java
Executable File
48 lines
1.1 KiB
Java
Executable File
package com.plannaplan.services;
|
|
|
|
import java.util.List;
|
|
|
|
import com.plannaplan.entities.Assignment;
|
|
import com.plannaplan.entities.Commision;
|
|
import com.plannaplan.repositories.AssignmentRepository;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
/**
|
|
* Service of Assignment which can save assignments, diplay assignments, get ammount of assigments.
|
|
*/
|
|
|
|
@Service
|
|
public class AssignmentService {
|
|
@Autowired
|
|
private AssignmentRepository repo;
|
|
|
|
public AssignmentService() {
|
|
}
|
|
|
|
/*
|
|
* save
|
|
* @param assignment which assignment should be save in service
|
|
*/
|
|
public void save(Assignment assignment) {
|
|
this.repo.save(assignment);
|
|
}
|
|
|
|
/*
|
|
* getCommisionAssignments
|
|
* Return id of the commision
|
|
*/
|
|
public List<Assignment> getCommisionAssignments(Commision com) {
|
|
return this.repo.getByCommision(com.getId());
|
|
}
|
|
|
|
/*
|
|
* getAssignmentsAmmount
|
|
* Return count assignments ammount
|
|
*/
|
|
public long getAssignmentsAmmount() {
|
|
return this.repo.count();
|
|
}
|
|
}
|