| 123456789101112131415161718192021222324252627282930313233343536 |
- # -*- coding: utf-8 -*-
- import subprocess, os
- mysql = r"D:\mysql-5.7\mysql-5.7.24-winx64\bin\mysql.exe"
- out = r"D:\IdeaProjects\mes-ahdy\mescloud\_apk_work\extracted"
- base = [
- mysql, "--user=root", "--password=123456", "--host=127.0.0.1", "--port=3306",
- "--database=mes_cloud_ahdy", "--default-character-set=utf8mb4", "--batch", "--raw"
- ]
- queries = {
- "db_categories.txt": "SELECT id, title, sort_order, status FROM mes_icons_category ORDER BY sort_order, title",
- "db_icons.txt": (
- "SELECT IFNULL(c.title,'未分类') AS category, i.title AS icon, i.mode, i.auth, i.status "
- "FROM mes_icons i LEFT JOIN mes_icons_category c ON c.id = i.category_id "
- "WHERE i.status='0' ORDER BY IFNULL(c.sort_order,9999), i.title"
- ),
- "db_menus.txt": (
- "SELECT tree_level, menu_name, menu_href, parent_code, menu_code "
- "FROM js_sys_menu WHERE status='0' AND is_show='1' AND menu_type IN ('1','0') "
- "ORDER BY tree_sorts, tree_sort"
- ),
- "db_hidden_menus.txt": (
- "SELECT tree_level, menu_name, menu_href, is_show, status "
- "FROM js_sys_menu WHERE menu_name LIKE '%扫码%' OR menu_name LIKE '%涂胶%' "
- "OR menu_name LIKE '%恢复%' OR menu_name LIKE '%样件%' OR menu_name LIKE '%物料批次%' "
- "OR menu_name LIKE '%钉钉%' OR menu_name LIKE '%GP12%' OR menu_name LIKE '%采购%' "
- "OR menu_name LIKE '%上下限%' OR menu_name LIKE '%工具寿命%'"
- ),
- }
- for fn, q in queries.items():
- data = subprocess.check_output(base + ["--execute", q], stderr=subprocess.STDOUT)
- if data.startswith(b"mysql:"):
- data = data.split(b"\n", 1)[1]
- path = os.path.join(out, fn)
- with open(path, "wb") as f:
- f.write(data)
- print("wrote", fn, len(data))
|