@EnableQuery
@SpringBootApplication
public class DemoApplication {
...
}
@RequestMapping(value = "/api/accounts", method = RequestMethod.GET)
public Page<Account> query(@RequestBody AccountQuery query) {
return accountRepository.find(query);
}
public void query() {
{
AccountQuery query = new AccountQuery();
query.setVersion(">10&<=10");
qurey.setUsername("*demo-%");
//from account where version > 10 and version <= 10 and username like "demo-%";
accountRepository.find(query);
}
{
AccountQuery query = new AccountQuery();
query.setVersion("0|>10");
//from account where version = 0 or version > 10;
accountRepository.find(query);
}
}