@Entity public class Mointors_Api {
@Id
@GeneratedValue
private Integer id;
private String url;
public Mointors_Api(){
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
}
@RestController
public class ApiController {
private final
ApiRepository apiRepository;
@Autowired
public ApiController(ApiRepository apiRepository) {
this.apiRepository = apiRepository;
}
@GetMapping(value = "/api")
public List<Mointors_Api> apiList(Mointors_Api api) {
return apiRepository.findAll(Example.of(api));
}
}
接口返回的结果数据和我数据库里的一一对应 springboot 它咋知道我定义的 url 参数就是我数据库里的 url 呢