public String selectByExample(StudentLogAssignExample example) { BEGIN(); if (example != null && example.isDistinct()) { SELECT_DISTINCT("assign_id"); } else { SELECT("assign_id"); } SELECT("student_id"); SELECT("depart_code"); SELECT("depart_name"); SELECT("job_code"); SELECT("job_name"); SELECT("job_days"); SELECT("job_deadline"); SELECT("assigned_to"); SELECT("create_time"); SELECT("create_user"); FROM("student_log_assign"); applyWhere(example, false); if (example != null && example.getOrderByClause() != null) { ORDER_BY(example.getOrderByClause()); } return SQL(); }
/** * 获取查询sql <功能详细描述> * * @return [参数说明] * @return String [返回类型说明] * @exception throws [异常类型] [异常说明] * @see [类、类#方法、类#成员] */ public String querySql(Object obj) { AssertUtils.notEmpty(this.pkName, "pkName is empty."); AssertUtils.isTrue( this.getter2columnNameMapping.containsKey(this.pkName), "property2columnNameMapping not contains pkName:{}.", this.pkName); // 构建query语句 SqlBuilder.BEGIN(); for (Entry<String, String> entryTemp : getter2columnNameMapping.entrySet()) { SqlBuilder.SELECT(entryTemp.getValue()); } SqlBuilder.FROM(this.tableName); if (!ObjectUtils.isEmpty(obj)) { MetaObject metaObject = MetaObjectUtils.forObject(obj); for (Entry<String, String> entryTemp : queryConditionKey2SqlMapping.entrySet()) { String queryKeyName = entryTemp.getKey(); Object valueObj = metaObject.getValue(queryKeyName); if (ObjectUtils.isEmpty(valueObj)) { continue; } SqlBuilder.WHERE(entryTemp.getValue()); } } for (String conditionExpressionTemp : otherCondition) { SqlBuilder.WHERE(conditionExpressionTemp); } // 在不存在排序字段时默认使用主键对应字段作为排序字段<br/> if (CollectionUtils.isEmpty(orderList)) { SqlBuilder.ORDER_BY(this.getter2columnNameMapping.get(this.pkName)); } else { for (String order : orderList) { SqlBuilder.ORDER_BY(order); } } String querySql = SqlBuilder.SQL(); SqlBuilder.RESET(); return querySql; }
/** * This method was generated by MyBatis Generator. This method corresponds to the database table * voltage_rank_classify * * @mbggenerated Wed Jan 13 12:15:38 CST 2016 */ public String selectByExample(VoltageRankClassifyExample example) { BEGIN(); if (example != null && example.isDistinct()) { SELECT_DISTINCT("id"); } else { SELECT("id"); } SELECT("name"); SELECT("value"); SELECT("bigEquipment"); FROM("voltage_rank_classify"); applyWhere(example, false); if (example != null && example.getOrderByClause() != null) { ORDER_BY(example.getOrderByClause()); } return SQL(); }
public String selectByExample(NewsExample example) { BEGIN(); if (example != null && example.isDistinct()) { SELECT_DISTINCT("id"); } else { SELECT("id"); } SELECT("host"); SELECT("title"); SELECT("url"); FROM("news"); applyWhere(example, false); if (example != null && example.getOrderByClause() != null) { ORDER_BY(example.getOrderByClause()); } return SQL(); }