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

com.huoguo.batch.model.Splicer Maven / Gradle / Ivy

The newest version!
package com.huoguo.batch.model;


import com.huoguo.batch.constant.BatchConstants;

import java.io.Serializable;
import java.util.LinkedHashMap;
import java.util.Map;

/**
 * 条件构造器
 *
 * @author Lizhenghuang
 */
public class Splicer implements Serializable {

    private static final long serialVersionUID = 1868317904364006795L;
    private Map map;

    public Splicer() {
        this.map = new LinkedHashMap<>(BatchConstants.DEFAULT_CAPACITY);
    }

    /**
     * SQL语句where后的条件构造
     *
     * @param column 字段名
     * @param val    该字段对应的值
     * @return Splicer
     */
    public Splicer and(String column, Object val) {
        this.map.put(column, val);
        return this;
    }

    /**
     * SQL语句中自定义写入字段名
     *
     * @param columns 字段名数组
     * @return Splicer
     */
    public Splicer columns(String[] columns) {
        this.map.put(BatchConstants.CUSTOMIZE_COLUMN, columns);
        return this;
    }

    /**
     * 获取当前Map集合实例
     *
     * @return Map
     */
    public Map getMap() {
        return map;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy