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

com.tmsps.ne4spring.orm.param.ParamBean Maven / Gradle / Ivy

There is a newer version: 999.0.0.0
Show newest version
package com.tmsps.ne4spring.orm.param;

import com.tmsps.ne4spring.orm.param.NeParamList;
import com.tmsps.ne4spring.utils.StrUtil;

/**
 * @Title ParamBean.java
 * @Package com.nuoyun.pro.bean
 * @Description sql辅助
 * @author hanjiefei
 * @date 2019-08-05
 * @version V1.0
 * @Copyright 2019 nuoyun All rights reserved.
 */
public class ParamBean {

	private NeParamList params = new NeParamList();
	private StringBuffer sql = new StringBuffer();
	private StringBuffer from = new StringBuffer();
	
	/**
	 * @Title: sqlAppend
	 * @Description: sql语句拼接
	 * @param sql
	 * @return void
	 */
	public void sqlAppend(String sql) {
		this.sql.append(sql);
	}
	/**
	 * @Title: fromAppend
	 * @Description: from语句拼接
	 * @param sql
	 * @return void
	 */
	public void fromAppend(String sql) {
		this.from.append(sql);
	}
	/**
	 * @Title: fromAppend
	 * @Description: from语句拼接
	 * @param sql
	 * @param param
	 * @return void
	 */
	public void fromAppend(String sql,String param) {
		if(StrUtil.notBlank(param)){
			this.from.append(sql);
			this.params.add(param);
		}
	}
	public void fromAppend(String sql,String... params) {
		if(StrUtil.notBlank(params)){
			this.from.append(sql);
			for(String param:params){
				this.params.add(param);
			}
		}
	}
	/**
	 * @Title: fromAppendLike
	 * @Description: from语句拼接
	 * @param sql
	 * @param param
	 * @return void
	 */
	public void fromAppendLike(String sql,String param) {
		if(StrUtil.notBlank(param)){
			this.from.append(sql);
			this.params.addLike(param);
		}
	}
	/**
	 * @Title: fromAppend
	 * @Description: from语句拼接
	 * @param sql
	 * @param param Integer
	 * @return void
	 */
	public void fromAppend(String sql,Integer param) {
		if(param != null){
			this.from.append(sql);
			this.params.add(param);
		}
	}
	/**
	 * @Title: fromAppend
	 * @Description: from语句拼接
	 * @param sql
	 * @param param Object
	 * @return void
	 */
	public void fromAppend(String sql,Object param) {
		if(param != null){
			this.from.append(sql);
			this.params.add(param);
		}
	}
	public NeParamList getParams() {
		return params;
	}
	public String getSql() {
		return sql.toString();
	}
	public String getFrom() {
		return from.toString();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy