I'm currently learning spring boot and encounter an error message
method count(JobViewWrapper) is already defined
yes it's because it has 2 of the same method name , but the method has 2 separate function , the first one is to count all the job with deleted flag 1. the second one (count-active), is to count all the job with deleted flag 1 and is active flag 1.
So i needed this 2 method, is there a workaround to do it?
@PostMapping(value = "/count")
public long count(@RequestBody(required = false) JobViewWrapper wrapper) {
System.out.println("into controller count");
if (wrapper == null) {
wrapper = new JobViewWrapper();
}
System.out.println("Prepare to count service");
return JobService.countLazyView();
}
@PostMapping(value = "/count-active")
public long count(@RequestBody(required = false) JobViewWrapper wrapper) {
System.out.println("into controller count");
if (wrapper == null) {
wrapper = new JobViewWrapper();
}
System.out.println("Prepare to count service");
return JobService.countLazyViewIsActive();
}
my service
public long countLazyView() {
return lowonganKerjaRepo.countLazyView();
}
public long countLazyViewIsActive() {
return lowonganKerjaRepo.countLazyViewIsActive();
}