<> How to use entity class to receive get Request parameters for the request
sometimes ,get The request also has many parameters , probably 4,5 individual , perhaps 7,8 Any one of them is possible . At this time , Again in controller Layer by layer to receive will be particularly cumbersome .
Like one get method , If you receive one by one :
@GetMapping("/getName") public List<String> getName(@RequestParam("query1")
String query1, @RequestParam"query2") String query2, @RequestParam"query3")
String query3,......) { return new ArrayList<>(); }
It's obviously very heavy , So we have to find a way to use entity class to receive Get Requested parameters :
1. Implementing serialization in entity classes (Serializable), Or create a new one Vo Serialization of entity classes
2. Then use the entity class that implements serialization to receive the parameters of the request
ok la , In this way, you can use the entity class to receive get Request parameters . However, in general, the actual project , Every entity class should inherit BaseEntity Of , as long as BaseEntity Realized Serializable Interface , You can be in the controller Use entity class to receive parameters directly in , Just the sauce
— I am “ The ancestors of Taoism are long ”, One is on the Internet “ drag out an ignoble existence ” Of Java programmer
Technology