diff --git a/extensions/gii/generators/crud/Generator.php b/extensions/gii/generators/crud/Generator.php
index e6ed347..6777ac9 100644
--- a/extensions/gii/generators/crud/Generator.php
+++ b/extensions/gii/generators/crud/Generator.php
@@ -386,7 +386,9 @@ class Generator extends \yii\gii\Generator
                 $columns[$column->name] = $column->type;
             }
         }
-        $conditions = [];
+
+        $likeConditions = [];
+        $hashConditions = [];
         foreach ($columns as $column => $type) {
             switch ($type) {
                 case Schema::TYPE_SMALLINT:
@@ -400,14 +402,24 @@ class Generator extends \yii\gii\Generator
                 case Schema::TYPE_TIME:
                 case Schema::TYPE_DATETIME:
                 case Schema::TYPE_TIMESTAMP:
-                    $conditions[] = "\$query->andFilterWhere(['{$column}' => \$this->{$column}]);";
+                    $hashConditions[] = "'{$column}' => \$this->{$column},";
                     break;
                 default:
-                    $conditions[] = "\$query->andFilterWhere(['like', '{$column}', \$this->{$column}]);";
+                    $likeConditions[] = "->andFilterWhere(['like', '{$column}', \$this->{$column}])";
                     break;
             }
         }
 
+        $conditions = [];
+        if (!empty($hashConditions)) {
+            $conditions[] = "\$query->andFilterWhere([\n"
+                . str_repeat(' ', 12) . implode("\n" . str_repeat(' ', 12), $hashConditions)
+                . "\n" . str_repeat(' ', 8) . "]);\n";
+        }
+        if (!empty($likeConditions)) {
+            $conditions[] = "\$query" . implode("\n" . str_repeat(' ', 12), $likeConditions) . ";\n";
+        }
+
         return $conditions;
     }