【regexp_like】 代替了老的百分号(%)和通配符(_)字符

 protected void addCriterion1(String condition, Object value,
				String property) {
	 if (value == null) {
		throw new RuntimeException("Value for " + property + " cannot be null");
	}
	criteria.add(new Criterion(condition));
}
//用了regexp_like正则
 public Criteria andNameLike(String value) {
	addCriterion1("regexp_like(NAME, '" + value + "', 'i')", value, "name");
	return (Criteria) this;
}
//原来的方法(用老的百分号(%)和通配符(_)字符)
public Criteria andNameLike(String value) {
	addCriterion("NAME like", value, "name");
	return (Criteria) this;
}

你可能感兴趣的:(Sql语句)