public static StringBuilder makeWhereStringFromFields(StringBuilder sb,List<ModelField> modelFields,Map<String,Object> fields,String operator,List<EntityConditionParam> entityConditionParams){
  if (modelFields.size() < 1) {
    return sb;
  }
  Iterator<ModelField> iter=modelFields.iterator();
  while (iter.hasNext()) {
    Object item=iter.next();
    Object name=null;
    ModelField modelField=null;
    if (item instanceof ModelField) {
      modelField=(ModelField)item;
      sb.append(modelField.getColValue());
      name=modelField.getName();
    }
 else {
      sb.append(item);
      name=item;
    }
    Object fieldValue=fields.get(name);
    if (fieldValue != null && fieldValue != GenericEntity.NULL_FIELD) {
      sb.append('=');
      addValue(sb,modelField,fieldValue,entityConditionParams);
    }
 else {
      sb.append(" IS NULL");
    }
    if (iter.hasNext()) {
      sb.append(' ');
      sb.append(operator);
      sb.append(' ');
    }
  }
  return sb;
}

public static StringBuilder makeWhereStringFromFields ( StringBuilder sb , List < ModelField > modelFields , Map < String , Object > fields , String operator , List < EntityConditionParam > entityConditionParams ) { if ( modelFields . size ( ) < 1 ) { return sb ; } Iterator < ModelField > iter = modelFields . iterator ( ) ; while ( iter . hasNext ( ) ) { Object item = iter . next ( ) ; Object name = null ; ModelField modelField = null ; if ( item instanceof ModelField ) { modelField = ( ModelField ) item ; sb . append ( modelField . getColValue ( ) ) ; name = modelField . getName ( ) ; } else { sb . append ( item ) ; name = item ; } Object fieldValue = fields . get ( name ) ; if ( fieldValue != null && fieldValue != GenericEntity . NULL_FIELD ) { sb . append ( '=' ) ; addValue ( sb , modelField , fieldValue , entityConditionParams ) ; } else { sb . append ( " IS NULL" ) ; } if ( iter . hasNext ( ) ) { sb . append ( ' ' ) ; sb . append ( operator ) ; sb . append ( ' ' ) ; } } return sb ; }
makes a where clause string with " < col name > = ? " if not null or " < col name > is null " if null , all and separated
