For the complete documentation index, see llms.txt. This page is also available as Markdown.

Logic-Suffix Field

By default, the query conditions corresponding to each field in a query object are connected with the AND operator. If you want to define query conditions connected with the OR operator, you need to define the suffix Or in the field name, and the following three field types are supported:

public class UserQuery extends PageQuery {
    // ...
    private List<String> nameStartOr;
    private UserQuery userOr;
    private List<UserQuery> usersOr;
}

List<String> nameStartOr;

UserQuery userQuery = UserQuery.builder().nameStartOr(List.of("Bob","John","Tim")).build();
List<UserEntity> users = userDataAccess.query(userQuery);
// SQL="SELECT id, name, score, memo, deleted FROM t_user 
// WHERE (name LIKE ? OR name LIKE ? OR name LIKE ?)" args="[Bob% John% Tim%]"

UserQuery userOr;

UserQuery userQuery = UserQuery.builder().nameStartOr(Arrays.asList(1, 4, 12)).deleted(trur).build();
List<UserEntity> users = userDataAccess.query(userQuery);
// SQL="SELECT id, name, score, memo, deleted FROM t_user 
// WHERE (id IN (?, ?, ?) OR deleted = ?)" args="[1 4 12 true]"

List<UserQuery> usersOr;

And Suffix

When a field name ends with And, the logical operator connecting multiple query conditions is AND.

UserAnd *UserQuery

Related Article

How to express select * from user where id = ? or name = ? and age = ? in GoooQo

Last updated