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

com.hadoopz.MyDroidLib.orm.dao.MyQueryCondition Maven / Gradle / Ivy

The newest version!
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.hadoopz.MyDroidLib.orm.dao;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 *
 * @author jw362j
 */
public class MyQueryCondition {

    private long firstindex;
    private int maxresult;
    private String[] colums;//{"id","theName","f","de"}; 
    private String wheresql;// where = " age = ? and theName = ?";
    private String[] queryParamsNames;//new Object[]{222, "wangjiunian312"};
    private int[] queryParamsTypes;//new int[]{java.sql.Types.INTEGER, java.sql.Types.VARCHAR};
    private Map orderby;// orderby = new LinkedHashMap();orderby.put("id", "asc");orderby.put("age", "desc");    
    private boolean forceReload;

    public MyQueryCondition() {
    }

    public MyQueryCondition(long firstindex, int maxresult) {
        this(firstindex, maxresult, null, null, null, null, null);
    }

    public MyQueryCondition(long firstindex, int maxresult, String[] colums, String wheresql, String[] queryParamsNames, int[] queryParamsTypes, Map orderby) {
        this.firstindex = firstindex;
        this.maxresult = maxresult;
        this.colums = colums;
        this.wheresql = wheresql;
        this.queryParamsNames = queryParamsNames;
        this.queryParamsTypes = queryParamsTypes;
        this.orderby = orderby;
    }

    public long getFirstindex() {
        return firstindex;
    }

    public MyQueryCondition setFirstindex(int firstindex) {
        this.firstindex = firstindex;
        return MyQueryCondition.this;
    }

    public int getMaxresult() {
        return maxresult;
    }

    public MyQueryCondition setMaxresult(int maxresult) {
        this.maxresult = maxresult;
        return MyQueryCondition.this;
    }

    public String[] getColums() {
        return colums;
    }

    public MyQueryCondition setColums(String[] colums) {
        this.colums = colums;
        return MyQueryCondition.this;
    }

    public String[] getQueryParamsNames() {
        return queryParamsNames;
    }

    public MyQueryCondition setQueryParamsNames(String[] queryParamsNames) {
        this.queryParamsNames = queryParamsNames;
        return MyQueryCondition.this;
    }

    public int[] getQueryParamsTypes() {
        return queryParamsTypes;
    }

    public MyQueryCondition setQueryParamsTypes(int[] queryParamsTypes) {
        this.queryParamsTypes = queryParamsTypes;
        return MyQueryCondition.this;
    }

    public Map getOrderby() {
        return orderby;
    }

    public MyQueryCondition setOrderby(Map orderby) {
        this.orderby = orderby;
        return MyQueryCondition.this;
    }

    public String getWheresql() {
        return wheresql;
    }

    public void setWheresql(String wheresql) {
        this.wheresql = wheresql;
    }

    public boolean isForceReload() {
        return forceReload;
    }

    public void setForceReload(boolean forceReload) {
        this.forceReload = forceReload;
    }

    private void testSample() {
        String colums[] = {"uid", "userName", "userPwd", "age"};
        String where = " userName = ? and age = ? ";
        String[] queryParamsNames = new String[]{"zhangsan", 58 + ""};
        int[] queryParamsTypes = new int[]{java.sql.Types.VARCHAR, java.sql.Types.INTEGER};
        Map orderby = new LinkedHashMap();
        orderby.put("User.uid", "asc");
        orderby.put("User.age", "desc");
        MyQueryCondition conf = new MyQueryCondition(-1, -1, colums, where, queryParamsNames, queryParamsTypes, orderby);
    }

    @Override
    public String toString() {
        return "MyQueryCondition{" + "firstindex=" + firstindex + ", maxresult=" + maxresult + ", colums=" + colums + ", wheresql=" + wheresql + ", queryParamsNames=" + queryParamsNames + ", queryParamsTypes=" + queryParamsTypes + ", orderby=" + orderby + ", forceReload=" + forceReload + '}';
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy