diff --git a/sqlor/__pycache__/__init__.cpython-310.pyc b/sqlor/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000..6d616ba Binary files /dev/null and b/sqlor/__pycache__/__init__.cpython-310.pyc differ diff --git a/sqlor/__pycache__/__init__.cpython-312.pyc b/sqlor/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000..4855805 Binary files /dev/null and b/sqlor/__pycache__/__init__.cpython-312.pyc differ diff --git a/sqlor/__pycache__/dbpools.cpython-310.pyc b/sqlor/__pycache__/dbpools.cpython-310.pyc new file mode 100644 index 0000000..50ea000 Binary files /dev/null and b/sqlor/__pycache__/dbpools.cpython-310.pyc differ diff --git a/sqlor/__pycache__/ddl_template_mysql.cpython-312.pyc b/sqlor/__pycache__/ddl_template_mysql.cpython-312.pyc new file mode 100644 index 0000000..5050d43 Binary files /dev/null and b/sqlor/__pycache__/ddl_template_mysql.cpython-312.pyc differ diff --git a/sqlor/__pycache__/ddl_template_oracle.cpython-312.pyc b/sqlor/__pycache__/ddl_template_oracle.cpython-312.pyc new file mode 100644 index 0000000..d84fda8 Binary files /dev/null and b/sqlor/__pycache__/ddl_template_oracle.cpython-312.pyc differ diff --git a/sqlor/__pycache__/ddl_template_postgresql.cpython-312.pyc b/sqlor/__pycache__/ddl_template_postgresql.cpython-312.pyc new file mode 100644 index 0000000..be572cb Binary files /dev/null and b/sqlor/__pycache__/ddl_template_postgresql.cpython-312.pyc differ diff --git a/sqlor/__pycache__/ddl_template_sqlserver.cpython-312.pyc b/sqlor/__pycache__/ddl_template_sqlserver.cpython-312.pyc new file mode 100644 index 0000000..266302c Binary files /dev/null and b/sqlor/__pycache__/ddl_template_sqlserver.cpython-312.pyc differ diff --git a/sqlor/filter.py b/sqlor/filter.py index 09442e1..14d7f4d 100644 --- a/sqlor/filter.py +++ b/sqlor/filter.py @@ -131,7 +131,7 @@ class DBFilter(object): return f"{fj['field']} {op}" var = fj.get('var') - if var and not var in ns.keys(): + if var and (not var in ns.keys() or ns[var] == '' or ns[var] is None): return None if 'const' in keys: @@ -141,6 +141,12 @@ class DBFilter(object): sql = '%s %s ${%s}$' % (fj.get('field'), fj.get('op'), name) return sql + # LIKE 自动加 %value% + if op == 'LIKE': + val = ns.get(var) + if val and not val.startswith('%'): + ns[var] = f'%{val}%' + sql = '%s %s ${%s}$' % (fj.get('field'), fj.get('op'), fj.get('var')) return sql