cn.sylinx.hbatis.ext.parse.ParamMapBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hbatis-core Show documentation
Show all versions of hbatis-core Show documentation
hbatis is a simple orm framework
The newest version!
package cn.sylinx.hbatis.ext.parse;
import java.util.HashMap;
import java.util.Map;
import cn.sylinx.hbatis.kit.StrKit;
/**
* 参数构建器
*
* @author han
*
*/
public class ParamMapBuilder {
private Map map = new HashMap<>();
public ParamMapBuilder put(String key, Object value) {
if(value != null) {
map.put(key, value);
}
return this;
}
public ParamMapBuilder like(String key, String value) {
if (StrKit.isNotBlank(value)) {
map.put(key, "%" + value + "%");
}
return this;
}
public ParamMapBuilder likeLeft(String key, String value) {
if (StrKit.isNotBlank(value)) {
map.put(key, "%" + value);
}
return this;
}
public ParamMapBuilder likeRight(String key, String value) {
if (StrKit.isNotBlank(value)) {
map.put(key, value + "%");
}
return this;
}
public Map build() {
return map;
}
}