This commit is contained in:
wanyongkang
2020-10-23 16:48:49 +08:00
parent 1a58344e46
commit fe0f0a63b3
11 changed files with 374 additions and 7 deletions

View File

@@ -40,16 +40,24 @@ class Sql
if ($flag) {
$flag = false;
if (is_array($value)) {
$this->filter .= ' `' . $key . '` ' . $value[0] . ' :' . $key;
$this->param[$key] = $value[1];
if($value[0] == 'in'){
$this->filter .= ' `' . $key . '` ' . $value[0] . '('.implode(',',$value[1]).')';
} else {
$this->filter .= ' `' . $key . '` ' . $value[0] . ' :' . $key;
$this->param[$key] = $value[1];
}
} else {
$this->filter .= ' `' . $key . '` = :' . $key;
$this->param[$key] = $value;
}
} else {
if (is_array($value)) {
$this->filter .= ' AND `' . $key . '` ' . $value[0] . ' :' . $key;
$this->param[$key] = $value[1];
if($value[0] == 'in'){
$this->filter .= ' AND `' . $key . '` ' . $value[0] . '('.implode(',',$value[1]).')';
} else {
$this->filter .= ' AND `' . $key . '` ' . $value[0] . ' :' . $key;
$this->param[$key] = $value[1];
}
} else {
$this->filter .= ' AND `' . $key . '` = :' . $key;
$this->param[$key] = $value;
@@ -83,7 +91,7 @@ class Sql
*/
public function group($group = [])
{
if ($order) {
if ($group) {
$this->filter .= ' GROUP BY ';
$this->filter .= ' ' . implode(' ,', $group) . ' ';
}