cn.sylinx.hbatis.ext.parse.ParaMapBuilder 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
package cn.sylinx.hbatis.ext.parse;
import java.util.HashMap;
import java.util.Map;
import cn.sylinx.hbatis.kit.StrKit;
/**
* 参数构建器
*
* @author han
*
*/
public class ParaMapBuilder {
private Map map = new HashMap<>();
public ParaMapBuilder put(String key, Object value) {
if(value != null) {
map.put(key, value);
}
return this;
}
public ParaMapBuilder like(String key, String value) {
if (StrKit.isNotBlank(value)) {
map.put(key, "%" + value + "%");
}
return this;
}
public ParaMapBuilder likeLeft(String key, String value) {
if (StrKit.isNotBlank(value)) {
map.put(key, "%" + value);
}
return this;
}
public ParaMapBuilder likeRight(String key, String value) {
if (StrKit.isNotBlank(value)) {
map.put(key, value + "%");
}
return this;
}
public Map build() {
return map;
}
}