I have this query in repository :
@Query("Select e FROM Employee e WHERE "
"e.startDate LIKE CONCAT('%',:date,'%')"
"And e.salary > LIKE CONCAT('%',:salary,'%')")
List<Employee> searchEmployees(String query);
And this is my controller :
@GetMapping(path="/search")
public ResponseEntity<List<Employee>> searchEmployees(@RequestParam("date")String query){
return ResponseEntity.ok(employeeService.searchEmployees(query));
}
I can't add second RequestParam to Controller. What is the concept when trying to add two RequestParam
CodePudding user response:
You can add like this;
@GetMapping(path="/search")
public ResponseEntity<List<Employee>> searchEmployees(@RequestParam("date") String query,
@RequestParam("test") String test){
return ResponseEntity.ok(employeeService.searchEmployees(query));
}
CodePudding user response:
@GetMapping(path="/search")
public ResponseEntity<List<Employee>> searchEmployees(@RequestParam("date")String date,@RequestParam("salary")String salary){
return ResponseEntity.ok(employeeService.searchEmployees(query));
}