|
|
|
@ -688,11 +688,11 @@ async def generate_sql(tablesRowCol: dict, table_columns: dict): |
|
|
|
# ==================================================== |
|
|
|
|
|
|
|
where_conditions = [] |
|
|
|
|
|
|
|
allow_all_rows = False |
|
|
|
def build_row_condition(row): |
|
|
|
# 固定值 & ALL → 不加限制 |
|
|
|
if row.ctrl_type == '0' and row.ctrl_value == "ALL": |
|
|
|
return None |
|
|
|
return "__ALLOW_ALL__" |
|
|
|
|
|
|
|
# 固定值 |
|
|
|
if row.ctrl_type == '0': |
|
|
|
@ -717,8 +717,12 @@ async def generate_sql(tablesRowCol: dict, table_columns: dict): |
|
|
|
return None |
|
|
|
|
|
|
|
def handle_row_config(row_cfg_list): |
|
|
|
nonlocal allow_all_rows |
|
|
|
for row in row_cfg_list: |
|
|
|
condition = build_row_condition(row) |
|
|
|
if condition == "__ALLOW_ALL__": |
|
|
|
allow_all_rows = True |
|
|
|
continue |
|
|
|
if condition: |
|
|
|
where_conditions.append(condition) |
|
|
|
|
|
|
|
@ -729,9 +733,10 @@ async def generate_sql(tablesRowCol: dict, table_columns: dict): |
|
|
|
# ==================================================== |
|
|
|
# 4. WHERE 拼接(无行权限则拒绝访问) |
|
|
|
# ==================================================== |
|
|
|
|
|
|
|
if where_conditions: |
|
|
|
sql += " WHERE " + " AND ".join(where_conditions) |
|
|
|
elif allow_all_rows: |
|
|
|
pass # 不拼 WHERE,等 |
|
|
|
else: |
|
|
|
sql += " WHERE 1 = 0" |
|
|
|
|
|
|
|
|