@@ -89,10 +89,13 @@ def handle_ops(cls, key, val, opt_type="where"):
89
89
if key .endswith (op ):
90
90
if opt_type == 'exclude' :
91
91
sql_op = exclude_mapping [op ]
92
+ _key = key .replace (op , '' )
92
93
if op == '__between' :
93
- phrase = f"{ key } { sql_op } :{ filter_str } _between_1_{ key } AND :{ filter_str } _between_2_{ key } AND"
94
+ phrase = f"{ _key } { sql_op } :{ filter_str } _between_1_{ key } AND :{ filter_str } _between_2_{ key } AND "
95
+ elif op == '__isnull' :
96
+ phrase = f"{ _key } { sql_op } AND "
94
97
else :
95
- phrase = f"{ key } { sql_op } :{ filter_str } { key } AND"
98
+ phrase = f"{ _key } { sql_op } :{ filter_str } { key } AND "
96
99
return phrase
97
100
98
101
return f"{ key } = :_where_{ key } AND"
@@ -226,9 +229,9 @@ def execute_update(cls, tb_name, data, where, app=None, bind=None, commit=False,
226
229
sql += "`%s`" % key + " = :" + key + ","
227
230
sql = sql [0 :- 1 ]
228
231
229
- data = cls .fullfilled_data (data , where )
232
+ data = cls .fullfilled_data (data , where , exclude = exclude )
230
233
sql = cls .set_where_phrase (sql , where )
231
- sql = cls .set_exclude_phrase (sql , exclude = exclude )
234
+ sql = cls .set_exclude_phrase (sql , exclude )
232
235
try :
233
236
if app and bind :
234
237
bind = cls .db .get_engine (app , bind = bind )
@@ -302,9 +305,8 @@ def execute_delete(cls, tb_name, where, logic=False, app=None, bind=None, commit
302
305
if logic :
303
306
sql = "UPDATE %s SET %s=1" % (tb_name , cls .logic_delete_flag )
304
307
sql = cls .set_where_phrase (sql , where )
305
- where = cls .fullfilled_data ({}, where )
306
- sql = cls .set_exclude_phrase (sql , exclude = exclude )
307
-
308
+ sql = cls .set_exclude_phrase (sql , exclude )
309
+ where = cls .fullfilled_data ({}, where , exclude = exclude )
308
310
try :
309
311
if app and bind :
310
312
bind = cls .db .get_engine (app , bind = bind )
0 commit comments