当现有的的字段后缀和注解都无法映射成需要的SQL语句时,可以考虑使用@QueryField注解。
@Target(FIELD) @Retention(RUNTIME) public @interface QueryField { String and(); }
当被注解字段的值满足过滤条件时,and变量里定义的条件语句将会被拼接到SQL中。
public class TestQuery extends PageQuery { @QueryField(and = "(username = ? OR email = ? OR mobile = ?)") private String account; }