@@ -21,7 +21,7 @@ public class LawCaseService {
|
||||
private final LawCaseRepository lawCaseRepository;
|
||||
|
||||
public LawCase addLawCase(BigDecimal amount, String description, String name,
|
||||
LawCasePriority priority) {
|
||||
LawCasePriority priority, Long violationId) {
|
||||
LawCase lawCase = new LawCase();
|
||||
|
||||
BigDecimal damage = amount == null ? BigDecimal.ZERO : amount;
|
||||
@@ -30,6 +30,7 @@ public class LawCaseService {
|
||||
lawCase.setName(name);
|
||||
lawCase.setDescription(description);
|
||||
lawCase.setPriority(priority);
|
||||
lawCase.setViolationId(violationId);
|
||||
|
||||
return lawCaseRepository.save(lawCase);
|
||||
}
|
||||
@@ -67,25 +68,16 @@ public class LawCaseService {
|
||||
return lawCaseRepository.save(lawCase);
|
||||
}
|
||||
|
||||
public List<LawCase> getAllUserLawCases(Long userId, int pageSize, int pageNumber, String propertySort,
|
||||
String ascDesc) {
|
||||
Sort.Direction direction = ascDesc.equalsIgnoreCase("desc") ? Sort.Direction.DESC:
|
||||
Sort.Direction.ASC;
|
||||
Sort sort = Sort.by(direction, propertySort);
|
||||
Pageable pageable = PageRequest.of(pageNumber, pageSize, sort);
|
||||
|
||||
return lawCaseRepository.getUserLawCases(userId, pageable);
|
||||
}
|
||||
|
||||
public Page<LawCase> getAllUserLawCases(Long userId, int pageSize, int pageNumber,
|
||||
LawCaseType lawCaseType, String lawyer,
|
||||
LawCasePriority lawCasePriority,
|
||||
Long violationId,
|
||||
String propertySort, String ascDesc) {
|
||||
Sort.Direction direction = ascDesc.equalsIgnoreCase("desc") ? Sort.Direction.DESC : Sort.Direction.ASC;
|
||||
Sort sort = Sort.by(direction, propertySort);
|
||||
Pageable pageable = PageRequest.of(pageNumber, pageSize, sort);
|
||||
|
||||
return lawCaseRepository.getUserLawCases(userId, lawCaseType, lawyer, lawCasePriority, pageable);
|
||||
return lawCaseRepository.getUserLawCases(userId, lawCaseType, lawyer, lawCasePriority, violationId, pageable);
|
||||
}
|
||||
|
||||
public void deleteById(Long id) {
|
||||
|
||||
Reference in New Issue
Block a user