我在存储库中有这个查询:
@Query("Select e FROM Employee e WHERE " +
"e.startDate LIKE CONCAT('%',:date,'%')"+
"And e.salary > LIKE CONCAT('%',:salary,'%')")
List<Employee> searchEmployees(String query);
这是我的控制器
@GetMapping(path="/search")
public ResponseEntity<List<Employee>> searchEmployees(@RequestParam("date")String query){
return ResponseEntity.ok(employeeService.searchEmployees(query));
}
我不能添加第二个RequestParam到控制器。当尝试添加两个RequestParam
时,概念是什么?你可以这样添加;
@GetMapping(path="/search")
public ResponseEntity<List<Employee>> searchEmployees(@RequestParam("date") String query,
@RequestParam("test") String test){
return ResponseEntity.ok(employeeService.searchEmployees(query));
}
@GetMapping(path="/search")
public ResponseEntity<List<Employee>> searchEmployees(@RequestParam("date")String date,@RequestParam("salary")String salary){
return ResponseEntity.ok(employeeService.searchEmployees(query));
}