public void addWhere(String where, Object parameter) { if (StringUtil.isBlank(where)) return; int currentWhereIndex = wheres.size(); String prefix = String.format("%s%d-", Const.db.ORM_PARAMETER_USER, currentWhereIndex); NMap inputParam = setParameter(prefix, parameter); where = where.trim().replaceFirst("(?ims)^WHERE ", "").replaceFirst("(?ims)^AND ", ""); String singleParamKey = String.format("%s%s", prefix, Const.db.PARAMETER_SINGLE); if (parameter == null) { inputParam.put(singleParamKey, null); } if (inputParam.containsKey(singleParamKey)) { where = where.replaceAll("#\\{(.+?)\\}", String.format("#{%s}", singleParamKey)); } else { where = where.replaceAll("#\\{(.+?)\\}", String.format("#{%s$1}", prefix)); } userParameter.putAll(inputParam); this.wheres.add(String.format("AND ( %s )", where)); }
public void addWhere(String where) { if (StringUtil.isBlank(where)) return; where = where.replaceAll("#\\{(.+?)\\}", String.format("#{%s$1}", Const.db.ORM_PARAMETER_ENTITY)); this.wheres.add(String.format("AND ( %s )", where)); }
public void setOrderBy(String orderBy) { if (StringUtil.isBlank(orderBy)) return; this.orderBy = "ORDER BY " + orderBy.trim().replaceFirst("(?ims)^ORDER +?BY ", ""); }