/** * 构建 查询条件 * * @param clazz * @return */ public DetachedCriteria toCriteria(Class<?> clazz) { DetachedCriteria criteria = DetachedCriteria.forClass(clazz, "entity"); for (WhereCondition con : cons) { criteria.add(con.getCriterion()); } return criteria; }
/** 构建查询条件 where 语句 如 “ and xx=yy and ....”: */ public String appendedStr() { String where = ""; for (WhereCondition condition : cons) where += " and " + condition.toString(); return where; }