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

cn.schoolwow.util.domain.query.instanceList.QueryInstanceList Maven / Gradle / Ivy

There is a newer version: 1.0.2
Show newest version
package cn.schoolwow.util.domain.query.instanceList;

import cn.schoolwow.util.module.query.instanceList.domain.InstanceListQueryOption;

import java.util.Arrays;
import java.util.List;

public class QueryInstanceList {
    private InstanceListQueryOption instanceQueryOption = new InstanceListQueryOption();

    /**创建实例列表查询*/
    public static  QueryInstanceList newQuery(List list){
        QueryInstanceList instanceQuery = new QueryInstanceList();
        instanceQuery.instanceQueryOption.list = list;
        return instanceQuery;
    }

    /**是否去重*/
    public QueryInstanceList distinct(){
        instanceQueryOption.distinct = true;
        return this;
    }

    /**指定单个值查询*/
    public QueryInstanceList addSingleValueQuery(Object singleValue){
        instanceQueryOption.singleValue = singleValue;
        return this;
    }

    /**指定实例列表查询*/
    public QueryInstanceList addSingleValueListQuery(List singleValueList){
        instanceQueryOption.singleValueList = singleValueList;
        return this;
    }

    /**添加字段值查询*/
    public QueryInstanceList addQuery(String fieldName, Object value){
        instanceQueryOption.fieldValueMap.put(fieldName, value);
        return this;
    }

    /**添加字段列表查询*/
    public QueryInstanceList addInQuery(String fieldName, Object[] valueList){
        if(null!=valueList&&valueList.length>0){
            instanceQueryOption.fieldValueListMap.put(fieldName, Arrays.asList(valueList));
        }
        return this;
    }

    /**添加字段列表查询*/
    public QueryInstanceList addInQuery(String fieldName, List valueList){
        if(null!=valueList&&!valueList.isEmpty()){
            instanceQueryOption.fieldValueListMap.put(fieldName, valueList);
        }
        return this;
    }

    public QueryInstanceListResponse execute(){
        return new QueryInstanceListResponse(instanceQueryOption);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy