All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.objectsql.query.Query Maven / Gradle / Ivy

There is a newer version: 6.1
Show newest version
/*
 * Copyright 2017 @objectsql.com
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.objectsql.query;

import com.objectsql.support.*;

import java.util.Collection;
import java.util.List;

public interface Query extends IQuery {

	static Query newQuery(){
		return new QueryImpl();
	}
	static Query newQuery(String id){
		Query baseQuery = new QueryImpl();
		baseQuery.setId(id);
		return baseQuery;
	}

	//从class中获取字段,该字段可有可无
	Query table(Class clazz);
	Query where(String name, ExpressionType type);
	 Query where(LambdaQuery fieldFunction, ExpressionType type);

	Query whereEqual(String name, Object value);
	Query whereNotEqual(String name, Object value);
	 Query whereEqual(LambdaQuery fieldFunction, Object value);
	 Query whereNotEqual(LambdaQuery fieldFunction, Object value);

	Query whereLike(String name, String value);
	Query whereNotLike(String name, String value);
	Query whereStartWith(String name, String value);
	Query whereEndWith(String name, String value);
	Query whereNotStartWith(String name, String value);
	Query whereNotEndWith(String name, String value);

	 Query whereLike(LambdaQuery fieldFunction, String value);
	 Query whereNotLike(LambdaQuery fieldFunction, String value);
	 Query whereStartWith(LambdaQuery fieldFunction, String value);
	 Query whereEndWith(LambdaQuery fieldFunction, String value);
	 Query whereNotStartWith(LambdaQuery fieldFunction, String value);
	 Query whereNotEndWith(LambdaQuery fieldFunction, String value);

	Query whereLess(String name, Object value);
	Query whereLessEqual(String name, Object value);
	Query whereMore(String name, Object value);
	Query whereMoreEqual(String name, Object value);

	 Query whereLess(LambdaQuery fieldFunction, Object value);
	 Query whereLessEqual(LambdaQuery fieldFunction, Object value);
	 Query whereMore(LambdaQuery fieldFunction, Object value);
	 Query whereMoreEqual(LambdaQuery fieldFunction, Object value);

	Query whereIn(String name, Collection value);
	Query whereNotIn(String name, Collection value);
	Query whereInValues(String name, Object ... values);
	Query whereNotInValues(String name, Object ... values);

	 Query whereIn(LambdaQuery fieldFunction, Collection value);
	 Query whereNotIn(LambdaQuery fieldFunction, Collection value);
	 Query whereInValues(LambdaQuery fieldFunction, Object ... values);
	 Query whereNotInValues(LambdaQuery fieldFunction, Object ... values);

	Query whereIsNull(String name);
    Query whereIsNotNull(String name);
	Query whereIsEmpty(String name);
	Query whereIsNotEmpty(String name);
	Query where(String name, Object value, ExpressionType type);

	 Query whereIsNull(LambdaQuery fieldFunction);
	 Query whereIsNotNull(LambdaQuery fieldFunction);
	 Query whereIsEmpty(LambdaQuery fieldFunction);
	 Query whereIsNotEmpty(LambdaQuery fieldFunction);
	 Query where(LambdaQuery fieldFunction, Object value, ExpressionType type);

	Query where(Condition condition);//select * from test where (a = ? or b = ? ...)

	Query where(Expression... expressions);

	Query whereBetween(String name, Object value, Object andValue);
	 Query whereBetween(LambdaQuery fieldFunction, Object value, Object andValue);

	Query group(String name);
	Query groupCountSelectColumn(String name);
	Query having(String name, Object value, ExpressionType type);

	 Query group(LambdaQuery fieldFunction);
	 Query groupCountSelectColumn(LambdaQuery fieldFunction);
	 Query having(LambdaQuery fieldFunction, Object value, ExpressionType type);

	Query having(Condition condition);//group by  having (a = ? or b = ? ...)

	Query orderDesc(String name);
	Query orderAsc(String name);
	 Query orderDesc(LambdaQuery fieldFunction);
	 Query orderAsc(LambdaQuery fieldFunction);

	Query order(Order order);
    Query orders(List orders);

	Query createQuery(String... names);
	Query createQuery(Class clazz, String... names);

	 Query createQuery(LambdaQuery... names);
	 Query createQuery(Class clazz, LambdaQuery... names);

    Query createQuery(Class clazz, Column... columns);
	Query addReturnColumn(Column ... columns);
	Query addReturnColumn(String ... columns);
	Query addReturnColumn(Columns ... columns);
	Query clearReturnColumns();
	Query addFixedReturnColumn(Column ... columns);
	Query addFixedReturnColumn(String ... columns);
	Query addFixedReturnColumn(Columns ... columns);
	Query clearFixedReturnColumns();

	 Query addReturnColumn(LambdaQuery ... fieldFunctions);
	 Query addFixedReturnColumn(LambdaQuery ... fieldFunctions);


	Query distinct();

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy