Skip to content

Latest commit

 

History

History
36 lines (33 loc) · 816 Bytes

README.md

File metadata and controls

36 lines (33 loc) · 816 Bytes

启用

@EnableQuery
@SpringBootApplication
public class DemoApplication {
   ...
}

通过http

@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);
    }
}