feat: 根目录文档、脚本、gitignore

This commit is contained in:
2026-10-08 16:15:33 +08:00
commit e98660ce4e
284 changed files with 26838 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
"""重生成绩效菜单备份 sql(列名完整版)"""
import io, sys, pymysql
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
conn = pymysql.connect(host='192.168.1.161', user='devgps', password='dev@2021GPS', database='zentao_dev', charset='utf8mb4')
cur = conn.cursor()
def dump(table, where):
cur.execute(f'SHOW COLUMNS FROM {table}')
cols = [r[0] for r in cur.fetchall()]
cur.execute(f'SELECT * FROM {table} WHERE {where}')
lines = []
for r in cur.fetchall():
vals = []
for v in r:
if v is None:
vals.append('NULL')
elif isinstance(v, (int, float)):
vals.append(str(v))
else:
vals.append("'" + str(v).replace("'", "''") + "'")
lines.append(f"INSERT INTO `{table}` ({','.join('`' + c + '`' for c in cols)}) VALUES ({','.join(vals)});")
return lines
menus = dump('base_menu', 'id BETWEEN 1539 AND 1551')
auths = dump('base_role_authority', 'menu_id BETWEEN 1539 AND 1551')
with open('codes/zentao/sql/20260729_insert_perf_menu.sql', 'w', encoding='utf-8') as f:
f.write('-- 绩效菜单备份(CHG-035 下线后可凭本文件恢复):绩效管理+绩效考核/文档齐备核查/规则配置+7按钮\n')
f.write('-- 授权按当时 role 配置(3 角色+admin 自动可见)\n')
f.write('\n'.join(menus) + '\n' + '\n'.join(auths) + '\n')
print('重写完成:', len(menus), '菜单 +', len(auths), '授权')