feat: v3版疗休养优化

This commit is contained in:
2026-10-26 09:45:30 +08:00
parent 7f2ac97dea
commit 1a1946b1f8
87 changed files with 1564 additions and 964 deletions
@@ -0,0 +1,244 @@
"""导出 v3 疗休养数据及实际附件;Python 3.9+ 标准库 + 已有 mysql 客户端。
参数:--database 源库 --output 导出.zip --login-path 已配置的连接名。
不用 login-path 时可传 --host、--port、--user,密码交互输入,不写入文件。
存在附件时 --files-root 指向 v3 FTP/文件存储根目录;不通过脚本安装依赖。
导出期间暂停疗休养业务写入与附件变更;使用一个 InnoDB 一致性快照读取关联数据。
与 import_inclusive_therapy_v3.py 放在同一目录;脚本不启动应用,不修改源数据。
"""
import argparse
import getpass
import hashlib
import json
import os
from pathlib import Path
import re
import subprocess
import sys
import tempfile
from urllib.parse import unquote, urlsplit
import zipfile
FORMAT = "inclusive-therapy-v3/1"
PREFIX = "inclusive_therapy_v3_"
SUFFIXES = (
"config", "lot", "travel_agency", "base_management", "line",
"line_union_select", "cluster", "cluster_member", "enroll_bed",
"enroll", "enroll_companion", "enroll_change_record",
)
AUDIT_FIELDS = ("selfUnionAuditId", "joinLineUnionAuditId", "schoolUnionAuditId")
def identifier(value):
if not re.fullmatch(r"[A-Za-z0-9_]+", value):
raise ValueError("数据库标识符只允许英文字母、数字、下划线")
return "`" + value + "`"
def literal(value):
if value is None:
return "NULL"
encoded = str(value).encode("utf-8").hex()
return "CONVERT(X'" + encoded + "' USING utf8mb4)"
def get(row, key, default=None):
return next((value for name, value in row.items() if name.lower() == key.lower()), default)
def connection_args(parser):
parser.add_argument("--mysql", default="mysql", help="已有 mysql 客户端路径")
parser.add_argument("--login-path")
parser.add_argument("--host", default=None)
parser.add_argument("--port", type=int, default=None)
parser.add_argument("--user", default=None)
parser.add_argument("--database", required=True)
class MySQL:
def __init__(self, args):
identifier(args.database)
self.command = [args.mysql]
if args.login_path:
self.command.append("--login-path=" + args.login_path)
self.command += ["--default-character-set=utf8mb4", "--batch", "--raw",
"--skip-column-names", "--binary-mode=1", "--connect-timeout=15",
"--skip-force", "--max-allowed-packet=1G", "--database=" + args.database]
for key in ("host", "port", "user"):
value = getattr(args, key)
if value is not None:
self.command.append("--" + key + "=" + str(value))
self.env = os.environ.copy()
if not args.login_path and "MYSQL_PWD" not in self.env:
self.env["MYSQL_PWD"] = getpass.getpass("MySQL password: ")
def lines(self, sql):
# 文件管道避免大量数据输出与标准输入相互阻塞,不把密码拼进命令行。
with tempfile.TemporaryFile() as source, tempfile.TemporaryFile() as errors:
source.write(sql.encode("utf-8"))
source.seek(0)
process = subprocess.Popen(self.command, stdin=source, stdout=subprocess.PIPE,
stderr=errors, env=self.env)
try:
for line in process.stdout:
yield line.decode("utf-8", errors="strict").rstrip("\r\n")
if process.wait() != 0:
errors.seek(0)
detail = errors.read().decode("utf-8", errors="replace")
# 不输出可能包含个人数据的 SQL 文本或数据库错误详情。
match = re.search(r"ERROR\s+(\d+).*?at line\s+(\d+)", detail)
location = "(错误号 %s,SQL 第 %s 行)" % match.groups() if match else ""
raise RuntimeError("MySQL 执行失败" + location)
finally:
process.stdout.close()
if process.poll() is None:
process.terminate()
process.wait()
def objects(self, sql):
return [json.loads(line) for line in self.lines(sql) if line]
def schema(self, tables):
selected = ",".join(literal(name) for name in tables)
rows = self.objects("SELECT JSON_OBJECT('table',TABLE_NAME,'name',COLUMN_NAME,"
"'type',DATA_TYPE,'length',CHARACTER_MAXIMUM_LENGTH,"
"'nullable',IS_NULLABLE,'default',COLUMN_DEFAULT,'extra',EXTRA) "
"FROM information_schema.columns WHERE TABLE_SCHEMA=DATABASE() "
"AND TABLE_NAME IN (" + selected + ") ORDER BY TABLE_NAME,ORDINAL_POSITION;")
result = {}
for row in rows:
result.setdefault(row.pop("table"), []).append(row)
return result
def require_innodb(self, tables):
selected = ",".join(literal(name) for name in tables)
rows = self.objects("SELECT JSON_OBJECT('name',TABLE_NAME,'engine',ENGINE) "
"FROM information_schema.tables WHERE TABLE_SCHEMA=DATABASE() "
"AND TABLE_NAME IN (" + selected + ");")
engines = {row["name"]: row["engine"] for row in rows}
missing = [name for name in tables if engines.get(name) != "InnoDB"]
if missing:
raise ValueError("需要存在且使用 InnoDB 的表:" + ", ".join(missing))
def row_query(label, table, columns, where=""):
pairs = []
for column in columns:
name = column["name"]
pairs += [literal(name), "HEX(CAST(t." + identifier(name) + " AS BINARY))"]
return ("SELECT JSON_OBJECT('table'," + literal(label) + ",'row',JSON_OBJECT(" +
",".join(pairs) + ")) FROM " + identifier(table) + " t " + where + ";\n")
def decode_row(record):
return {name: None if value is None else bytes.fromhex(value).decode("utf-8", errors="strict")
for name, value in record["row"].items()}
def main():
parser = argparse.ArgumentParser(description=__doc__)
connection_args(parser)
parser.add_argument("--output", type=Path, required=True)
parser.add_argument("--files-root", type=Path)
parser.add_argument("--audit-table", default="audit", help="v3 公共审核表名")
args = parser.parse_args()
identifier(args.audit_table)
output = args.output.resolve()
if output.exists():
raise ValueError("导出文件已存在,不覆盖:" + str(output))
client = MySQL(args)
tables = {suffix: "the_rapy_recuperation_" + suffix for suffix in SUFFIXES}
schemas = client.schema(list(tables.values()) + [args.audit_table, "activity_user_scope",
"sys_user", "sys_union", "sys_unit", "sys_file", "sys_config"])
required = list(tables.values()) + ["activity_user_scope", "sys_user", "sys_union", "sys_unit", "sys_file", "sys_config"]
absent = [table for table in required if table not in schemas]
if absent:
raise ValueError("源库缺少必要表:" + ", ".join(absent))
client.require_innodb(required + ([args.audit_table] if args.audit_table in schemas else []))
enroll = identifier(tables["enroll"])
audit_ids = " UNION ".join("SELECT " + identifier(field) + " FROM " + enroll +
" WHERE " + identifier(field) + " IS NOT NULL AND " +
identifier(field) + "<>''" for field in AUDIT_FIELDS)
if args.audit_table not in schemas:
references = client.objects("SELECT JSON_OBJECT('n',COUNT(*)) FROM (" + audit_ids + ") refs;")[0]["n"]
if references:
raise ValueError("源库缺少关联审核表,请用 --audit-table 指定实际表名")
plans = [(label, table, schemas[table], "") for label, table in tables.items()]
if args.audit_table in schemas:
plans.append(("_audit", args.audit_table, schemas[args.audit_table], "WHERE t.id IN (" + audit_ids + ")"))
plans.append(("_scope", "activity_user_scope", schemas["activity_user_scope"],
"WHERE t.groupId IN (SELECT activityGroupId FROM " + identifier(tables["config"]) + ")"))
for label, table, wanted in [("_user", "sys_user", {"id", "loginname"}),
("_union", "sys_union", {"id", "unionname", "unioncode"}),
("_unit", "sys_unit", {"id", "name", "unitcode"})]:
plans.append((label, table, [c for c in schemas[table] if c["name"].lower() in wanted], ""))
conditions = []
for suffix, column in [("line", "files"), ("line", "content"), ("travel_agency", "files"),
("base_management", "files"), ("base_management", "content"), ("config", "notice")]:
text = "CAST(b." + identifier(column) + " AS CHAR CHARACTER SET utf8mb4)"
conditions.append("EXISTS (SELECT 1 FROM " + identifier(tables[suffix]) + " b WHERE "
"LOCATE(t.id," + text + ")>0 OR (CHAR_LENGTH(t.filepath)>1 AND LOCATE(t.filepath," + text + ")>0))")
plans.append(("_file", "sys_file", schemas["sys_file"], "WHERE " + " OR ".join(conditions)))
plans.append(("_version", "sys_config", [c for c in schemas["sys_config"] if c["name"] in ("configKey", "configValue")],
"WHERE t.configKey='recuperationVersion'"))
sql = "SET SESSION time_zone='+00:00';\nSET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;\nSTART TRANSACTION WITH CONSISTENT SNAPSHOT;\n"
sql += "".join(row_query(*plan) for plan in plans) + "COMMIT;\n"
output.parent.mkdir(parents=True, exist_ok=True)
file_rows = []
counts = {label: 0 for label, *_ in plans}
digest = hashlib.sha256()
archive = zipfile.ZipFile(output, "x", compression=zipfile.ZIP_DEFLATED, allowZip64=True)
finished = False
try:
with archive.open("data.jsonl", "w", force_zip64=True) as data:
for line in client.lines(sql):
record = json.loads(line)
record["row"] = decode_row(record)
counts[record["table"]] += 1
if record["table"] == "_file":
file_rows.append(record["row"])
encoded = (json.dumps(record, ensure_ascii=False, separators=(",", ":")) + "\n").encode("utf-8")
digest.update(encoded)
data.write(encoded)
assets = {}
if file_rows and args.files_root is None:
raise ValueError("数据包含附件,必须提供 --files-root,不能只导出文件地址")
storage = args.files_root.resolve() if args.files_root else None
for row in file_rows:
old_id, old_path = get(row, "id"), get(row, "filepath")
if not old_id or not old_path:
raise ValueError("关联附件记录缺少 ID 或存储路径")
relative = unquote(urlsplit(old_path.replace("\\", "/")).path).lstrip("/")
source = (storage / relative).resolve()
if not source.is_relative_to(storage) or not source.is_file():
raise ValueError("实际附件不存在或不在文件根目录内,附件 ID:" + old_id)
member = "files/" + hashlib.sha256(old_id.encode("utf-8")).hexdigest()
file_hash = hashlib.sha256()
size = 0
with source.open("rb") as reader, archive.open(member, "w", force_zip64=True) as writer:
for chunk in iter(lambda: reader.read(1024 * 1024), b""):
file_hash.update(chunk)
size += len(chunk)
writer.write(chunk)
assets[old_id] = {"member": member, "sha256": file_hash.hexdigest(), "size": size}
manifest = {"format": FORMAT, "source_database": args.database, "source_prefix": "the_rapy_recuperation_",
"target_prefix": PREFIX, "counts": counts, "data_sha256": digest.hexdigest(), "files": assets}
archive.writestr("manifest.json", json.dumps(manifest, ensure_ascii=False, indent=2).encode("utf-8"))
finished = True
finally:
archive.close()
if not finished:
output.unlink()
print("导出完成:" + str(output))
print("业务记录:%s;审核记录:%s;附件:%s" %
(sum(counts.get(name, 0) for name in SUFFIXES), counts.get("_audit", 0), len(file_rows)))
if __name__ == "__main__":
try:
main()
except (OSError, ValueError, RuntimeError, KeyError) as error:
print("导出失败:" + str(error), file=sys.stderr)
sys.exit(1)
@@ -0,0 +1,353 @@
"""把 export_inclusive_therapy_v3.py 生成的 ZIP 导入 v4 的 inclusive_therapy_v3_*。
两个 Python 脚本应放在同一目录;使用 Python 3.9+ 标准库及已有 mysql 客户端。
参数:--database v4目标库 --input 导出.zip --login-path 连接名。
有附件时 --target-files-dir 必须是 v4 服务器可直接访问的本地/共享存储目录。
先使用本目录初始化 SQL 直接创建 inclusive_therapy_v3_* 表及菜单。
仅支持首次导入:目标子模块必须为空,或仅包含未使用的自动生成默认配置。
可用 --mapping 提供 JSON:{"user":{"旧ID":"新ID"},"unit":{},"union":{}}。
不覆盖 v4 原有疗休养、人员、组织或附件;导入期间不要向目标库写入业务数据。
失败时数据库事务回滚;已复制的附件保留在独立目录,避免提交状态不明时误删文件。
"""
import argparse
from collections import defaultdict
import hashlib
import json
from pathlib import Path
import re
import sys
import uuid
from urllib.parse import parse_qs, unquote, urlsplit
import zipfile
from export_inclusive_therapy_v3 import (
AUDIT_FIELDS, FORMAT, PREFIX, SUFFIXES, MySQL,
connection_args, get, identifier, literal,
)
def rows(client, table, columns):
from export_inclusive_therapy_v3 import row_query, decode_row
return [decode_row(json.loads(line)) for line in client.lines(row_query(table, table, columns))]
def load_bundle(archive):
manifest = json.loads(archive.read("manifest.json"))
if manifest.get("format") != FORMAT or manifest.get("target_prefix") != PREFIX:
raise ValueError("导出文件格式或目标表前缀不匹配")
allowed = set(SUFFIXES) | {"_audit", "_scope", "_user", "_unit", "_union", "_file", "_version"}
records = defaultdict(list)
digest = hashlib.sha256()
with archive.open("data.jsonl") as data:
for line in data:
digest.update(line)
record = json.loads(line)
label, row = record["table"], record["row"]
if label not in allowed or not isinstance(row, dict):
raise ValueError("导出文件包含未知数据类型")
if any(value is not None and not isinstance(value, str) for value in row.values()):
raise ValueError("导出字段格式错误")
records[label].append(row)
if digest.hexdigest() != manifest["data_sha256"]:
raise ValueError("导出数据不完整或已被修改")
for label in allowed:
if len(records[label]) != manifest["counts"].get(label, 0):
raise ValueError("导出记录数量不匹配:" + label)
if not records["config"]:
raise ValueError("源库没有疗休养配置,不能完整导入")
return manifest, records
def check_relations(records):
primary = {}
for label in list(SUFFIXES) + ["_audit", "_file"]:
values = [get(row, "id") for row in records[label]]
if any(not value for value in values) or len(set(values)) != len(values):
raise ValueError("源数据主键为空或重复:" + label)
primary[label] = set(values)
relations = {
"lot": {"configId": "config"},
"line": {"lotId": "lot", "travelAgencyId": "travel_agency"},
"base_management": {"lotId": "lot", "travelAgencyId": "travel_agency"},
"line_union_select": {"lineId": "line", "travelAgencyId": "travel_agency"},
"cluster": {"lineId": "line"},
"cluster_member": {"lineId": "line", "clusterId": "cluster"},
"enroll": {"lotId": "lot", "bedInfoId": "enroll_bed", "takePartInLineId": "line_union_select",
"takePartInTravelAgencyId": "travel_agency", "takePartInBaseManagementId": "base_management",
**{field: "_audit" for field in AUDIT_FIELDS}},
"enroll_companion": {"trreId": "enroll", "bedInfoId": "enroll_bed"},
"enroll_change_record": {"enrollId": "enroll"},
}
for label, references in relations.items():
for row in records[label]:
for column, destination in references.items():
value = get(row, column)
if value and value not in primary[destination]:
raise ValueError("源数据存在断开的关联:%s.%s,记录ID=%s" % (label, column, get(row, "id")))
class IdentityMap:
def __init__(self, source, target, overrides):
self.source = {get(row, "id"): row for row in source}
self.target = {get(row, "id"): row for row in target}
self.overrides = overrides
self.cache = {}
def resolve(self, old_id, kind, required=True):
if not old_id:
return old_id
if old_id in self.overrides:
value = self.overrides[old_id]
if value not in self.target:
raise ValueError("手工映射的目标不存在:%s %s" % (kind, old_id))
return value
if old_id in self.cache:
return self.cache[old_id]
old = self.source.get(old_id)
same_id = self.target.get(old_id)
if same_id and (kind != "user" or old and get(same_id, "loginname") == get(old, "loginname")):
self.cache[old_id] = old_id
return old_id
if old:
keys = ("loginname",) if kind == "user" else (("unitcode", "name") if kind == "unit" else ("unioncode", "unionname"))
for key in keys:
value = get(old, key)
if not value:
continue
target_key = "name" if key == "unionname" else key
matches = [get(row, "id") for row in self.target.values() if get(row, target_key) == value]
if len(matches) > 1:
raise ValueError("存在多个候选,需 --mapping 明确映射:%s %s" % (kind, old_id))
if len(matches) == 1:
self.cache[old_id] = matches[0]
return matches[0]
if not required and same_id is None:
# 已离职/删除的历史操作人保留原 ID,审核快照中的姓名、工号仍原样迁移。
return old_id
raise ValueError("无法对应 v4 数据,需 --mapping 明确映射:%s %s" % (kind, old_id))
def default_config(row):
permitted = {"id": None, "configName": {"智慧工会疗休养配置", "普惠疗休养V3配置"},
"isSnLine": {"0"}, "isSwLine": {"0"}, "travelAudit": {"0"}, "bedInfo": {"1"},
"familyInfo": {"1"}, "outsideQuotaProportion": {"0", "0.00", "0.0"},
"unionLineNumberConfigs": {"[]"}, "lots": {"[]"}}
for name, value in row.items():
key = next((key for key in permitted if key.lower() == name.lower()), None)
if key == "id" or value is None or value == "":
continue
if key is None or value not in permitted[key]:
return False
return True
def main():
parser = argparse.ArgumentParser(description=__doc__)
connection_args(parser)
parser.add_argument("--input", type=Path, required=True)
parser.add_argument("--target-files-dir", type=Path)
parser.add_argument("--mapping", type=Path)
args = parser.parse_args()
overrides = json.loads(args.mapping.read_text(encoding="utf-8-sig")) if args.mapping else {}
copied_directory = None
with zipfile.ZipFile(args.input) as archive:
manifest, records = load_bundle(archive)
check_relations(records)
client = MySQL(args)
tables = {suffix: PREFIX + suffix for suffix in SUFFIXES}
tables["_audit"] = PREFIX + "audit"
shared = ["sys_user", "sys_unit", "sys_union", "sys_file", "sys_config", "activity_user_scope"]
schemas = client.schema(list(tables.values()) + shared)
missing = [table for table in list(tables.values()) + shared if table not in schemas]
if missing:
raise ValueError("请先执行初始化脚本,缺少:" + ", ".join(missing))
client.require_innodb(list(tables.values()) + shared)
identities = {}
for kind, label, table, wanted in [
("user", "_user", "sys_user", {"id", "loginname"}),
("unit", "_unit", "sys_unit", {"id", "name", "unitcode"}),
("union", "_union", "sys_union", {"id", "name", "unioncode"})]:
target = rows(client, table, [c for c in schemas[table] if c["name"].lower() in wanted])
identities[kind] = IdentityMap(records[label], target, overrides.get(kind, {}))
groups = sorted({get(row, "activityGroupId") for row in records["config"] if get(row, "activityGroupId")})
current_group = client.objects("SELECT JSON_OBJECT('n',COALESCE(MAX(groupId),0)) FROM activity_user_scope;")[0]["n"]
group_map = {group: str(int(current_group) + index + 1) for index, group in enumerate(groups)}
if any(int(value) > 2147483647 for value in group_map.values()):
raise ValueError("目标活动分组编号已达到整数上限")
initial = rows(client, tables["config"], schemas[tables["config"]])
if len(initial) > 1 or initial and not default_config(initial[0]):
raise ValueError("目标配置已有业务设置,不覆盖;仅允许空的新子模块首次导入")
file_info = {}
paths = {}
for row in records["_file"]:
old_id = get(row, "id")
asset = manifest["files"].get(old_id)
if not asset or asset["member"] not in archive.namelist():
raise ValueError("附件内容缺失,ID:" + old_id)
new_id = uuid.uuid4().hex
file_info[old_id] = {"id": new_id, "name": get(row, "filename") or old_id,
"engine": "LOCAL", "bucket": "", "downloadPath": "/platform/sys/file/download?id=" + new_id}
path = get(row, "filepath")
if path in paths and paths[path] != old_id:
raise ValueError("源附件路径对应多个文件 ID,请先消除歧义")
paths[path] = old_id
def file_key(value):
value = unquote(value)
return value if value in file_info else paths.get(value)
def rewrite_text(value):
key = file_key(value)
if key:
return file_info[key]["downloadPath"]
def url(match):
address = match[0]
parsed = urlsplit(address.replace("&amp;", "&"))
query_id = parse_qs(parsed.query).get("id", [None])[0]
key = file_key(query_id) if query_id else file_key(parsed.path)
return file_info[key]["downloadPath"] if key else address
return re.sub(r"https?://[^\s\"'<>]+|/file_server/[^\s\"'<>]+", url, value)
def transform_json(value):
if isinstance(value, list):
return [transform_json(item) for item in value]
if isinstance(value, dict):
key = get(value, "id")
key = key if key in file_info else file_key(get(value, "filepath", ""))
if key:
file = dict(file_info[key])
file.update(filename=file["name"], filepath=file["downloadPath"])
return file
result = {}
for key, item in value.items():
kind = "union" if key.lower() in ("unionid", "selfunionid", "takepartinunionid", "createunionid") else "unit" if key.lower() in ("unitid", "selfunitid") else None
result[key] = identities[kind].resolve(item, kind) if kind and item else transform_json(item)
return result
return rewrite_text(value) if isinstance(value, str) else value
prepared = defaultdict(list)
actor_fields = {"createdby", "updatedby", "opby", "selectuserid", "auditor", "creator"}
union_fields = {"selfunionid", "takepartinunionid", "createunionid", "unionid"}
for label, table in tables.items():
allowed = {c["name"].lower(): c for c in schemas[table]}
for original in records[label]:
row = {}
for name, value in original.items():
column = allowed.get(name.lower())
if column is None:
if label != "_audit":
raise ValueError("目标表缺少源字段,不能静默丢弃:%s.%s" % (table, name))
continue
if value:
if name.lower() in union_fields:
value = identities["union"].resolve(value, "union")
elif name.lower() in ("unitid", "selfunitid"):
value = identities["unit"].resolve(value, "unit")
elif name.lower() in actor_fields:
value = identities["user"].resolve(value, "user", required=False)
elif name.lower() == "activitygroupid":
value = group_map[value]
elif column["type"] == "json":
value = json.dumps(transform_json(json.loads(value)), ensure_ascii=False, separators=(",", ":"))
else:
value = rewrite_text(value)
limit = column["length"]
if value is not None and limit and column["type"] in ("varchar", "char") and len(value) > int(limit):
raise ValueError("字段长度不足,不能截断数据:%s.%s,需要至少 %s 字符" % (table, name, len(value)))
row[column["name"]] = value
prepared[table].append(row)
scopes = defaultdict(list)
for row in records["_scope"]:
if get(row, "groupType") == "2":
raise ValueError("源范围是 SQL 条件分组,须先转换为 v3 实际人员结果后导出")
scopes[get(row, "groupId")].append(row)
for old_group, new_group in group_map.items():
source = scopes[old_group] or [{"groupName": "疗休养参加人员", "userId": ""}]
for row in source:
user = get(row, "userId")
prepared["activity_user_scope"].append({
"groupId": new_group, "groupName": "普惠疗休养V3 / " + (get(row, "groupName") or "参加人员"),
"userId": identities["user"].resolve(user, "user") if user else "",
"groupType": "1", "groupSql": None,
"creator": identities["user"].resolve(get(row, "creator"), "user", required=False), "delFlag": "0"})
version = get(records["_version"][0], "configValue") if records["_version"] else "zjnu"
if version not in ("zjnu", "zjxu", "zjiet"):
raise ValueError("无法识别 v3 的疗休养规则版本")
if file_info:
if args.target_files_dir is None:
raise ValueError("有附件时必须提供 --target-files-dir,不能只迁移数据库地址")
storage = args.target_files_dir.resolve()
storage.mkdir(parents=True, exist_ok=True)
copied_directory = storage / ("inclusive_therapy_v3_" + uuid.uuid4().hex)
copied_directory.mkdir()
for old_id, info in file_info.items():
asset = manifest["files"][old_id]
suffix = Path(info["name"]).suffix.lower().lstrip(".")
if not re.fullmatch(r"[a-z0-9]{1,12}", suffix):
suffix = "bin"
path = copied_directory / (info["id"] + "." + suffix)
digest, size = hashlib.sha256(), 0
with archive.open(asset["member"]) as source, path.open("xb") as destination:
for chunk in iter(lambda: source.read(1024 * 1024), b""):
digest.update(chunk)
size += len(chunk)
destination.write(chunk)
if digest.hexdigest() != asset["sha256"] or size != asset["size"]:
raise ValueError("附件内容不完整,ID:" + old_id)
info.update(suffix=suffix, storagePath=str(path), objName=path.name,
sizeKb=str(round(size / 1024, 2)), sizeInfo=str(size) + " B", delFlag="0")
prepared["sys_file"].append(info)
sql = ["SET SESSION time_zone='+00:00';", "SET SESSION sql_mode='STRICT_ALL_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';",
"CREATE TEMPORARY TABLE inclusive_therapy_v3_import_guard (ok INT NOT NULL, CONSTRAINT inclusive_therapy_v3_import_requirement CHECK(ok=1)) ENGINE=InnoDB;",
"START TRANSACTION;"]
def guard(condition):
sql.append("INSERT INTO inclusive_therapy_v3_import_guard VALUES(IF(" + condition + ",1,0));")
for label, table in tables.items():
sql.append("SELECT id FROM " + identifier(table) + " FOR UPDATE;")
if label != "config":
guard("(SELECT COUNT(*) FROM " + identifier(table) + ")=0")
guard("(SELECT COUNT(*) FROM " + identifier(tables["config"]) + ")=" + str(len(initial)))
if initial:
# 带原字段条件删除已识别的未使用默认配置;并发修改会使断言失败并回滚。
conditions = " AND ".join(identifier(name) + " <=> " + literal(value) for name, value in initial[0].items())
sql.append("DELETE FROM " + identifier(tables["config"]) + " WHERE " + conditions + ";")
guard("ROW_COUNT()=1")
sql.append("SELECT id FROM activity_user_scope FOR UPDATE;")
for group in group_map.values():
guard("(SELECT COUNT(*) FROM activity_user_scope WHERE groupId=" + literal(group) + ")=0")
for table, table_rows in prepared.items():
for row in table_rows:
# 显式列清单;SQL 使用 UTF-8 十六进制字面量保留中文、换行与引号。
sql.append("INSERT INTO " + identifier(table) + " (" + ",".join(identifier(key) for key in row) + ") VALUES (" +
",".join(literal(value) for value in row.values()) + ");")
sql.append("UPDATE sys_config SET configValue=" + literal(version) + " WHERE configKey='staffTherapyRecuperationVersion';")
sql.append("INSERT INTO sys_config(configKey,configValue,note,delFlag) SELECT 'staffTherapyRecuperationVersion'," +
literal(version) + "," + literal("普惠疗休养V3报名规则版本") + ",0 WHERE NOT EXISTS "
"(SELECT 1 FROM sys_config WHERE configKey='staffTherapyRecuperationVersion');")
sql.append("COMMIT;")
try:
# mysql 批处理遇错即停止;连接关闭回滚未提交事务,不启用 --force。
for _ in client.lines("\n".join(sql)):
pass
except (OSError, RuntimeError):
if copied_directory:
print("附件暂存目录保留:" + str(copied_directory), file=sys.stderr)
raise
print("导入完成:普惠疗休养V3,表前缀 " + PREFIX)
print("业务记录:%s;审核记录:%s;附件:%s" %
(sum(len(records[name]) for name in SUFFIXES), len(records["_audit"]), len(file_info)))
if copied_directory:
print("附件目录:" + str(copied_directory))
if __name__ == "__main__":
try:
main()
except (OSError, ValueError, RuntimeError, KeyError, zipfile.BadZipFile) as error:
print("导入失败:" + str(error), file=sys.stderr)
sys.exit(1)
@@ -1,13 +1,13 @@
-- v4 职工福利 / 惠普疗休养v3独立子模块初始化脚本(MySQL 8)。
-- v4 职工福利 / 普惠疗休养V3独立子模块初始化脚本(MySQL 8)。
-- 在 v4 目标数据库中执行;表结构依据 therapyRecuperation 模块实体定义。
-- v3 the_rapy_recuperation_* 对应本模块 staff_therapy_*,不覆盖 v4 其他疗休养表。
-- v3 the_rapy_recuperation_* 对应本模块 inclusive_therapy_v3_*,不覆盖 v4 其他疗休养表。
-- 仅新增表、视图、默认配置、菜单及角色权限关联,不迁移 v3 历史业务数据。
-- 已存在的表、视图、配置和菜单保留原值;脚本不修订已有表结构。
-- 依赖 v4 已有 vw_user、sys_union、sys_unit、sys_config、sys_module、sys_menu、sys_role、sys_role_menu。
-- DDL 存在 MySQL 隐式提交;后续初始化记录使用单独事务。
SET NAMES utf8mb4;
CREATE TABLE IF NOT EXISTS `staff_therapy_base_management` (
CREATE TABLE IF NOT EXISTS `inclusive_therapy_v3_base_management` (
`id` varchar(128) NOT NULL COMMENT 'id',
`year` int NULL DEFAULT NULL COMMENT '年度',
`sortNumber` varchar(50) NULL DEFAULT NULL COMMENT '排序编号',
@@ -33,14 +33,14 @@ CREATE TABLE IF NOT EXISTS `staff_therapy_base_management` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='疗休养目的地';
CREATE TABLE IF NOT EXISTS `staff_therapy_cluster` (
CREATE TABLE IF NOT EXISTS `inclusive_therapy_v3_cluster` (
`id` varchar(128) NOT NULL COMMENT 'id',
`lineId` varchar(32) NULL DEFAULT NULL COMMENT '线路id',
`clusterName` varchar(50) NULL DEFAULT NULL COMMENT '团名',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='疗休养组团';
CREATE TABLE IF NOT EXISTS `staff_therapy_cluster_member` (
CREATE TABLE IF NOT EXISTS `inclusive_therapy_v3_cluster_member` (
`id` varchar(128) NOT NULL COMMENT 'id',
`lineId` varchar(32) NULL DEFAULT NULL COMMENT '线路id',
`clusterId` varchar(32) NULL DEFAULT NULL COMMENT '团Id',
@@ -52,7 +52,7 @@ CREATE TABLE IF NOT EXISTS `staff_therapy_cluster_member` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='疗休养组团成员';
CREATE TABLE IF NOT EXISTS `staff_therapy_config` (
CREATE TABLE IF NOT EXISTS `inclusive_therapy_v3_config` (
`id` varchar(128) NOT NULL COMMENT 'id',
`configName` varchar(30) NULL DEFAULT NULL COMMENT '配置名称',
`activityGroupId` bigint NULL DEFAULT NULL COMMENT '参加人员范围',
@@ -80,7 +80,7 @@ CREATE TABLE IF NOT EXISTS `staff_therapy_config` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='疗休养配置';
CREATE TABLE IF NOT EXISTS `staff_therapy_enroll` (
CREATE TABLE IF NOT EXISTS `inclusive_therapy_v3_enroll` (
`id` varchar(128) NOT NULL COMMENT 'id',
`loginName` varchar(32) NULL DEFAULT NULL COMMENT '工号',
`userName` varchar(32) NULL DEFAULT NULL COMMENT '姓名',
@@ -121,7 +121,7 @@ CREATE TABLE IF NOT EXISTS `staff_therapy_enroll` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='疗休养报名登记表';
CREATE TABLE IF NOT EXISTS `staff_therapy_enroll_bed` (
CREATE TABLE IF NOT EXISTS `inclusive_therapy_v3_enroll_bed` (
`id` varchar(128) NOT NULL COMMENT 'id',
`bedType` varchar(10) NULL DEFAULT NULL COMMENT '床型',
`bedNum` int NULL DEFAULT NULL COMMENT '床位数',
@@ -137,14 +137,14 @@ CREATE TABLE IF NOT EXISTS `staff_therapy_enroll_bed` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='疗休养报名床位';
CREATE TABLE IF NOT EXISTS `staff_therapy_enroll_change_record` (
CREATE TABLE IF NOT EXISTS `inclusive_therapy_v3_enroll_change_record` (
`id` varchar(128) NOT NULL COMMENT 'id',
`enrollId` varchar(32) NULL DEFAULT NULL COMMENT '变更记录id',
`changeTime` datetime NULL DEFAULT NULL COMMENT '变更时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='疗休养报名变更记录';
CREATE TABLE IF NOT EXISTS `staff_therapy_enroll_companion` (
CREATE TABLE IF NOT EXISTS `inclusive_therapy_v3_enroll_companion` (
`id` varchar(128) NOT NULL COMMENT 'id',
`trreId` varchar(32) NULL DEFAULT NULL COMMENT '报名记录表Id',
`loginName` varchar(32) NULL DEFAULT NULL COMMENT '工号',
@@ -165,7 +165,7 @@ CREATE TABLE IF NOT EXISTS `staff_therapy_enroll_companion` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='疗休养随行人员';
CREATE TABLE IF NOT EXISTS `staff_therapy_line` (
CREATE TABLE IF NOT EXISTS `inclusive_therapy_v3_line` (
`id` varchar(128) NOT NULL COMMENT 'id',
`serialNumber` int NULL DEFAULT NULL COMMENT '编号',
`lineName` varchar(50) NULL DEFAULT NULL COMMENT '线路名称',
@@ -185,7 +185,7 @@ CREATE TABLE IF NOT EXISTS `staff_therapy_line` (
`trafficTools` varchar(50) NULL DEFAULT NULL COMMENT '交通工具',
`estimatedCost` varchar(50) NULL DEFAULT NULL COMMENT '预计费用',
`estimatedFamilyNumbers` int NULL DEFAULT NULL COMMENT '成团人数包括家属',
`files` varchar(30) NULL DEFAULT NULL COMMENT '缩略图',
`files` varchar(1000) NULL DEFAULT NULL COMMENT '缩略图',
`signUpMode` int NULL DEFAULT NULL COMMENT '报名模式(1.分工会 2.自由)',
`createMode` int NULL DEFAULT NULL COMMENT '创建模式(1.分工会 2.校工会)',
`lotId` varchar(128) NULL DEFAULT NULL COMMENT '标段',
@@ -202,7 +202,7 @@ CREATE TABLE IF NOT EXISTS `staff_therapy_line` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='疗休养线路';
CREATE TABLE IF NOT EXISTS `staff_therapy_line_union_select` (
CREATE TABLE IF NOT EXISTS `inclusive_therapy_v3_line_union_select` (
`id` varchar(128) NOT NULL COMMENT 'id',
`unionId` varchar(32) NULL DEFAULT NULL COMMENT '分工会id',
`lineId` varchar(32) NULL DEFAULT NULL COMMENT '线路id',
@@ -237,7 +237,7 @@ CREATE TABLE IF NOT EXISTS `staff_therapy_line_union_select` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='疗休养工会选线';
CREATE TABLE IF NOT EXISTS `staff_therapy_lot` (
CREATE TABLE IF NOT EXISTS `inclusive_therapy_v3_lot` (
`id` varchar(32) NOT NULL COMMENT 'id',
`lotName` varchar(10) NULL DEFAULT NULL COMMENT '标段',
`lotValue` varchar(10) NULL DEFAULT NULL COMMENT '标段值',
@@ -246,7 +246,7 @@ CREATE TABLE IF NOT EXISTS `staff_therapy_lot` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='疗休养标段';
CREATE TABLE IF NOT EXISTS `staff_therapy_travel_agency` (
CREATE TABLE IF NOT EXISTS `inclusive_therapy_v3_travel_agency` (
`id` varchar(128) NOT NULL COMMENT 'id',
`serialNumber` varchar(50) NULL DEFAULT NULL COMMENT '旅行社编号',
`travelAgencyName` varchar(50) NULL DEFAULT NULL COMMENT '旅行社名称',
@@ -270,7 +270,7 @@ CREATE TABLE IF NOT EXISTS `staff_therapy_travel_agency` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='疗休养旅行社';
CREATE TABLE IF NOT EXISTS `staff_therapy_audit` (
CREATE TABLE IF NOT EXISTS `inclusive_therapy_v3_audit` (
`id` varchar(128) NOT NULL,
`auditor` varchar(128) NULL DEFAULT NULL,
`auditPass` tinyint(1) NULL DEFAULT NULL,
@@ -288,7 +288,7 @@ CREATE TABLE IF NOT EXISTS `staff_therapy_audit` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='疗休养审核记录';
CREATE TABLE IF NOT EXISTS `staff_therapy_audit_state` (
CREATE TABLE IF NOT EXISTS `inclusive_therapy_v3_audit_state` (
`stateId` int NOT NULL,
`stateName` varchar(128) NULL DEFAULT NULL,
`stateColor` varchar(128) NULL DEFAULT NULL,
@@ -296,392 +296,392 @@ CREATE TABLE IF NOT EXISTS `staff_therapy_audit_state` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='疗休养审核状态';
SET @staff_therapy_ddl = IF(
EXISTS (SELECT 1 FROM information_schema.tables WHERE table_schema=DATABASE() AND table_name='staff_therapy_user'),
'DO 0', 'CREATE VIEW `staff_therapy_user` AS SELECT u.*, u.arrivalAtSchoolDate AS schoolTime FROM vw_user u'
SET @inclusive_therapy_v3_ddl = IF(
EXISTS (SELECT 1 FROM information_schema.tables WHERE table_schema=DATABASE() AND table_name='inclusive_therapy_v3_user'),
'DO 0', 'CREATE VIEW `inclusive_therapy_v3_user` AS SELECT u.*, u.arrivalAtSchoolDate AS schoolTime FROM vw_user u'
);
PREPARE staff_therapy_statement FROM @staff_therapy_ddl;
EXECUTE staff_therapy_statement;
DEALLOCATE PREPARE staff_therapy_statement;
PREPARE inclusive_therapy_v3_statement FROM @inclusive_therapy_v3_ddl;
EXECUTE inclusive_therapy_v3_statement;
DEALLOCATE PREPARE inclusive_therapy_v3_statement;
SET @staff_therapy_ddl = IF(
EXISTS (SELECT 1 FROM information_schema.tables WHERE table_schema=DATABASE() AND table_name='staff_therapy_union'),
'DO 0', 'CREATE VIEW `staff_therapy_union` AS SELECT u.*, u.name AS unionname FROM sys_union u'
SET @inclusive_therapy_v3_ddl = IF(
EXISTS (SELECT 1 FROM information_schema.tables WHERE table_schema=DATABASE() AND table_name='inclusive_therapy_v3_union'),
'DO 0', 'CREATE VIEW `inclusive_therapy_v3_union` AS SELECT u.*, u.name AS unionname FROM sys_union u'
);
PREPARE staff_therapy_statement FROM @staff_therapy_ddl;
EXECUTE staff_therapy_statement;
DEALLOCATE PREPARE staff_therapy_statement;
PREPARE inclusive_therapy_v3_statement FROM @inclusive_therapy_v3_ddl;
EXECUTE inclusive_therapy_v3_statement;
DEALLOCATE PREPARE inclusive_therapy_v3_statement;
SET @staff_therapy_ddl = IF(
EXISTS (SELECT 1 FROM information_schema.tables WHERE table_schema=DATABASE() AND table_name='staff_therapy_unit'),
'DO 0', 'CREATE VIEW `staff_therapy_unit` AS SELECT u.* FROM sys_unit u'
SET @inclusive_therapy_v3_ddl = IF(
EXISTS (SELECT 1 FROM information_schema.tables WHERE table_schema=DATABASE() AND table_name='inclusive_therapy_v3_unit'),
'DO 0', 'CREATE VIEW `inclusive_therapy_v3_unit` AS SELECT u.* FROM sys_unit u'
);
PREPARE staff_therapy_statement FROM @staff_therapy_ddl;
EXECUTE staff_therapy_statement;
DEALLOCATE PREPARE staff_therapy_statement;
PREPARE inclusive_therapy_v3_statement FROM @inclusive_therapy_v3_ddl;
EXECUTE inclusive_therapy_v3_statement;
DEALLOCATE PREPARE inclusive_therapy_v3_statement;
START TRANSACTION;
SET @staff_therapy_now = CAST(UNIX_TIMESTAMP(CURRENT_TIMESTAMP(3)) * 1000 AS UNSIGNED);
SET @inclusive_therapy_v3_now = CAST(UNIX_TIMESTAMP(CURRENT_TIMESTAMP(3)) * 1000 AS UNSIGNED);
INSERT INTO `staff_therapy_audit_state` (`stateId`,`stateName`,`stateColor`)
INSERT INTO `inclusive_therapy_v3_audit_state` (`stateId`,`stateName`,`stateColor`)
SELECT 2710,'待分工会审核','#e6a23c'
WHERE NOT EXISTS (SELECT 1 FROM `staff_therapy_audit_state` WHERE `stateId`=2710);
WHERE NOT EXISTS (SELECT 1 FROM `inclusive_therapy_v3_audit_state` WHERE `stateId`=2710);
INSERT INTO `staff_therapy_audit_state` (`stateId`,`stateName`,`stateColor`)
INSERT INTO `inclusive_therapy_v3_audit_state` (`stateId`,`stateName`,`stateColor`)
SELECT 2715,'分工会审核不通过','#f56c6c'
WHERE NOT EXISTS (SELECT 1 FROM `staff_therapy_audit_state` WHERE `stateId`=2715);
WHERE NOT EXISTS (SELECT 1 FROM `inclusive_therapy_v3_audit_state` WHERE `stateId`=2715);
INSERT INTO `staff_therapy_audit_state` (`stateId`,`stateName`,`stateColor`)
INSERT INTO `inclusive_therapy_v3_audit_state` (`stateId`,`stateName`,`stateColor`)
SELECT 2720,'待选择线路分工会审核','#e6a23c'
WHERE NOT EXISTS (SELECT 1 FROM `staff_therapy_audit_state` WHERE `stateId`=2720);
WHERE NOT EXISTS (SELECT 1 FROM `inclusive_therapy_v3_audit_state` WHERE `stateId`=2720);
INSERT INTO `staff_therapy_audit_state` (`stateId`,`stateName`,`stateColor`)
INSERT INTO `inclusive_therapy_v3_audit_state` (`stateId`,`stateName`,`stateColor`)
SELECT 2725,'选择线路分工会不通过','#f56c6c'
WHERE NOT EXISTS (SELECT 1 FROM `staff_therapy_audit_state` WHERE `stateId`=2725);
WHERE NOT EXISTS (SELECT 1 FROM `inclusive_therapy_v3_audit_state` WHERE `stateId`=2725);
INSERT INTO `staff_therapy_audit_state` (`stateId`,`stateName`,`stateColor`)
INSERT INTO `inclusive_therapy_v3_audit_state` (`stateId`,`stateName`,`stateColor`)
SELECT 2730,'待校工会审核','#e6a23c'
WHERE NOT EXISTS (SELECT 1 FROM `staff_therapy_audit_state` WHERE `stateId`=2730);
WHERE NOT EXISTS (SELECT 1 FROM `inclusive_therapy_v3_audit_state` WHERE `stateId`=2730);
INSERT INTO `staff_therapy_audit_state` (`stateId`,`stateName`,`stateColor`)
INSERT INTO `inclusive_therapy_v3_audit_state` (`stateId`,`stateName`,`stateColor`)
SELECT 2735,'校工会审核不通过','#f56c6c'
WHERE NOT EXISTS (SELECT 1 FROM `staff_therapy_audit_state` WHERE `stateId`=2735);
WHERE NOT EXISTS (SELECT 1 FROM `inclusive_therapy_v3_audit_state` WHERE `stateId`=2735);
INSERT INTO `staff_therapy_audit_state` (`stateId`,`stateName`,`stateColor`)
INSERT INTO `inclusive_therapy_v3_audit_state` (`stateId`,`stateName`,`stateColor`)
SELECT 2750,'审核通过','#67c23a'
WHERE NOT EXISTS (SELECT 1 FROM `staff_therapy_audit_state` WHERE `stateId`=2750);
WHERE NOT EXISTS (SELECT 1 FROM `inclusive_therapy_v3_audit_state` WHERE `stateId`=2750);
INSERT INTO `sys_config` (`configKey`,`configValue`,`note`,`createdBy`,`createdAt`,`updatedBy`,`updatedAt`,`delFlag`)
SELECT 'staffTherapyRecuperationVersion','zjnu','惠普疗休养v3独立子模块报名规则版本','',@staff_therapy_now,'',@staff_therapy_now,0
SELECT 'staffTherapyRecuperationVersion','zjnu','普惠疗休养V3独立子模块报名规则版本','',@inclusive_therapy_v3_now,'',@inclusive_therapy_v3_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_config` WHERE `configKey`='staffTherapyRecuperationVersion');
INSERT INTO `staff_therapy_config`
INSERT INTO `inclusive_therapy_v3_config`
(`id`,`configName`,`isSnLine`,`isSwLine`,`travelAudit`,`bedInfo`,`familyInfo`,`outsideQuotaProportion`,`unionLineNumberConfigs`)
SELECT REPLACE(UUID(),'-',''),'智慧工会疗休养配置',0,0,0,1,1,0,JSON_ARRAY()
WHERE NOT EXISTS (SELECT 1 FROM `staff_therapy_config`);
SELECT REPLACE(UUID(),'-',''),'普惠疗休养V3配置',0,0,0,1,1,0,JSON_ARRAY()
WHERE NOT EXISTS (SELECT 1 FROM `inclusive_therapy_v3_config`);
SET @staff_therapy_pc_module = COALESCE(
SET @inclusive_therapy_v3_pc_module = COALESCE(
(SELECT m.`moduleId` FROM `sys_menu` m INNER JOIN `sys_module` s ON s.`id`=m.`moduleId`
WHERE m.`href` LIKE '/platform/recuperation%' AND m.`platform`='pc' ORDER BY m.`id` LIMIT 1),
(SELECT `id` FROM `sys_module` WHERE `name`='职工福利' AND `platform`='pc' ORDER BY `id` LIMIT 1),
REPLACE(UUID(),'-','')
);
INSERT INTO `sys_module` (`id`,`name`,`platform`,`sortNum`,`faIcon`,`createdBy`,`createdAt`,`updatedBy`,`updatedAt`,`delFlag`)
SELECT @staff_therapy_pc_module,'职工福利','pc',50,'fa fa-heart','',@staff_therapy_now,'',@staff_therapy_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_module` WHERE `id`=@staff_therapy_pc_module);
SET @staff_therapy_module_name = (SELECT `name` FROM `sys_module` WHERE `id`=@staff_therapy_pc_module);
SET @staff_therapy_module_sort = (SELECT `sortNum` FROM `sys_module` WHERE `id`=@staff_therapy_pc_module);
SET @staff_therapy_h5_module = COALESCE(
(SELECT `id` FROM `sys_module` WHERE `name`=@staff_therapy_module_name AND `platform`='h5' ORDER BY `id` LIMIT 1),
SELECT @inclusive_therapy_v3_pc_module,'职工福利','pc',50,'fa fa-heart','',@inclusive_therapy_v3_now,'',@inclusive_therapy_v3_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_module` WHERE `id`=@inclusive_therapy_v3_pc_module);
SET @inclusive_therapy_v3_module_name = (SELECT `name` FROM `sys_module` WHERE `id`=@inclusive_therapy_v3_pc_module);
SET @inclusive_therapy_v3_module_sort = (SELECT `sortNum` FROM `sys_module` WHERE `id`=@inclusive_therapy_v3_pc_module);
SET @inclusive_therapy_v3_h5_module = COALESCE(
(SELECT `id` FROM `sys_module` WHERE `name`=@inclusive_therapy_v3_module_name AND `platform`='h5' ORDER BY `id` LIMIT 1),
REPLACE(UUID(),'-','')
);
INSERT INTO `sys_module` (`id`,`name`,`platform`,`sortNum`,`faIcon`,`createdBy`,`createdAt`,`updatedBy`,`updatedAt`,`delFlag`)
SELECT @staff_therapy_h5_module,@staff_therapy_module_name,'h5',@staff_therapy_module_sort,'fa fa-heart','',@staff_therapy_now,'',@staff_therapy_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_module` WHERE `id`=@staff_therapy_h5_module);
SELECT @inclusive_therapy_v3_h5_module,@inclusive_therapy_v3_module_name,'h5',@inclusive_therapy_v3_module_sort,'fa fa-heart','',@inclusive_therapy_v3_now,'',@inclusive_therapy_v3_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_module` WHERE `id`=@inclusive_therapy_v3_h5_module);
SET @staff_therapy_menu_root = COALESCE((SELECT `id` FROM `sys_menu` WHERE `permission`='staffTherapyRecuperation' LIMIT 1),REPLACE(UUID(),'-',''));
SET @staff_therapy_next_path = (
SET @inclusive_therapy_v3_menu_root = COALESCE((SELECT `id` FROM `sys_menu` WHERE `permission`='inclusiveTherapyV3' LIMIT 1),REPLACE(UUID(),'-',''));
SET @inclusive_therapy_v3_next_path = (
SELECT CONCAT('',LPAD(COALESCE(MAX(CAST(RIGHT(`path`,4) AS UNSIGNED)),0)+1,4,'0'))
FROM `sys_menu` WHERE CHAR_LENGTH(`path`)=4
);
SET @staff_therapy_next_location = (SELECT COALESCE(MAX(`location`),0)+1 FROM `sys_menu`);
SET @inclusive_therapy_v3_next_location = (SELECT COALESCE(MAX(`location`),0)+1 FROM `sys_menu`);
INSERT INTO `sys_menu`
(`id`,`parentId`,`path`,`name`,`type`,`href`,`target`,`icon`,`showit`,`disabled`,`permission`,`location`,`hasChildren`,`platform`,`moduleId`,`createdBy`,`createdAt`,`updatedBy`,`updatedAt`,`delFlag`)
SELECT @staff_therapy_menu_root,'',@staff_therapy_next_path,'惠普疗休养V3','menu','/platform/staffTherapyRecuperation','_self','fa fa-heart',1,0,'staffTherapyRecuperation',
@staff_therapy_next_location,1,'pc',@staff_therapy_pc_module,'',@staff_therapy_now,'',@staff_therapy_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `permission`='staffTherapyRecuperation');
SELECT @inclusive_therapy_v3_menu_root,'',@inclusive_therapy_v3_next_path,'普惠疗休养V3','menu','/platform/inclusiveTherapyV3','_self','fa fa-heart',1,0,'inclusiveTherapyV3',
@inclusive_therapy_v3_next_location,1,'pc',@inclusive_therapy_v3_pc_module,'',@inclusive_therapy_v3_now,'',@inclusive_therapy_v3_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `permission`='inclusiveTherapyV3');
SET @staff_therapy_root_path = (SELECT `path` FROM `sys_menu` WHERE `id`=@staff_therapy_menu_root);
SET @inclusive_therapy_v3_root_path = (SELECT `path` FROM `sys_menu` WHERE `id`=@inclusive_therapy_v3_menu_root);
-- 基础设置
SET @staff_therapy_menu_config = COALESCE((SELECT `id` FROM `sys_menu` WHERE `permission`='staffTherapyRecuperation.TheRapyConfig' LIMIT 1),REPLACE(UUID(),'-',''));
SET @staff_therapy_next_path = (
SELECT CONCAT(@staff_therapy_root_path,LPAD(COALESCE(MAX(CAST(RIGHT(`path`,4) AS UNSIGNED)),0)+1,4,'0'))
FROM `sys_menu` WHERE CHAR_LENGTH(`path`)=CHAR_LENGTH(@staff_therapy_root_path)+4 AND LEFT(`path`,CHAR_LENGTH(@staff_therapy_root_path))=@staff_therapy_root_path
SET @inclusive_therapy_v3_menu_config = COALESCE((SELECT `id` FROM `sys_menu` WHERE `permission`='inclusiveTherapyV3.TheRapyConfig' LIMIT 1),REPLACE(UUID(),'-',''));
SET @inclusive_therapy_v3_next_path = (
SELECT CONCAT(@inclusive_therapy_v3_root_path,LPAD(COALESCE(MAX(CAST(RIGHT(`path`,4) AS UNSIGNED)),0)+1,4,'0'))
FROM `sys_menu` WHERE CHAR_LENGTH(`path`)=CHAR_LENGTH(@inclusive_therapy_v3_root_path)+4 AND LEFT(`path`,CHAR_LENGTH(@inclusive_therapy_v3_root_path))=@inclusive_therapy_v3_root_path
);
SET @staff_therapy_next_location = (SELECT COALESCE(MAX(`location`),0)+1 FROM `sys_menu`);
SET @inclusive_therapy_v3_next_location = (SELECT COALESCE(MAX(`location`),0)+1 FROM `sys_menu`);
INSERT INTO `sys_menu`
(`id`,`parentId`,`path`,`name`,`type`,`href`,`target`,`icon`,`showit`,`disabled`,`permission`,`location`,`hasChildren`,`platform`,`moduleId`,`createdBy`,`createdAt`,`updatedBy`,`updatedAt`,`delFlag`)
SELECT @staff_therapy_menu_config,@staff_therapy_menu_root,@staff_therapy_next_path,'基础设置','menu','/platform/staffTherapyRecuperation?screen=config','_self','fa fa-heart',1,0,'staffTherapyRecuperation.TheRapyConfig',
@staff_therapy_next_location,0,'pc',@staff_therapy_pc_module,'',@staff_therapy_now,'',@staff_therapy_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `permission`='staffTherapyRecuperation.TheRapyConfig');
SELECT @inclusive_therapy_v3_menu_config,@inclusive_therapy_v3_menu_root,@inclusive_therapy_v3_next_path,'基础设置','menu','/platform/inclusiveTherapyV3?screen=config','_self','fa fa-heart',1,0,'inclusiveTherapyV3.TheRapyConfig',
@inclusive_therapy_v3_next_location,0,'pc',@inclusive_therapy_v3_pc_module,'',@inclusive_therapy_v3_now,'',@inclusive_therapy_v3_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `permission`='inclusiveTherapyV3.TheRapyConfig');
-- 旅行社管理
SET @staff_therapy_menu_agency = COALESCE((SELECT `id` FROM `sys_menu` WHERE `permission`='staffTherapyRecuperation.travelAgency' LIMIT 1),REPLACE(UUID(),'-',''));
SET @staff_therapy_next_path = (
SELECT CONCAT(@staff_therapy_root_path,LPAD(COALESCE(MAX(CAST(RIGHT(`path`,4) AS UNSIGNED)),0)+1,4,'0'))
FROM `sys_menu` WHERE CHAR_LENGTH(`path`)=CHAR_LENGTH(@staff_therapy_root_path)+4 AND LEFT(`path`,CHAR_LENGTH(@staff_therapy_root_path))=@staff_therapy_root_path
SET @inclusive_therapy_v3_menu_agency = COALESCE((SELECT `id` FROM `sys_menu` WHERE `permission`='inclusiveTherapyV3.travelAgency' LIMIT 1),REPLACE(UUID(),'-',''));
SET @inclusive_therapy_v3_next_path = (
SELECT CONCAT(@inclusive_therapy_v3_root_path,LPAD(COALESCE(MAX(CAST(RIGHT(`path`,4) AS UNSIGNED)),0)+1,4,'0'))
FROM `sys_menu` WHERE CHAR_LENGTH(`path`)=CHAR_LENGTH(@inclusive_therapy_v3_root_path)+4 AND LEFT(`path`,CHAR_LENGTH(@inclusive_therapy_v3_root_path))=@inclusive_therapy_v3_root_path
);
SET @staff_therapy_next_location = (SELECT COALESCE(MAX(`location`),0)+1 FROM `sys_menu`);
SET @inclusive_therapy_v3_next_location = (SELECT COALESCE(MAX(`location`),0)+1 FROM `sys_menu`);
INSERT INTO `sys_menu`
(`id`,`parentId`,`path`,`name`,`type`,`href`,`target`,`icon`,`showit`,`disabled`,`permission`,`location`,`hasChildren`,`platform`,`moduleId`,`createdBy`,`createdAt`,`updatedBy`,`updatedAt`,`delFlag`)
SELECT @staff_therapy_menu_agency,@staff_therapy_menu_root,@staff_therapy_next_path,'旅行社管理','menu','/platform/staffTherapyRecuperation?screen=agency','_self','fa fa-heart',1,0,'staffTherapyRecuperation.travelAgency',
@staff_therapy_next_location,0,'pc',@staff_therapy_pc_module,'',@staff_therapy_now,'',@staff_therapy_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `permission`='staffTherapyRecuperation.travelAgency');
SELECT @inclusive_therapy_v3_menu_agency,@inclusive_therapy_v3_menu_root,@inclusive_therapy_v3_next_path,'旅行社管理','menu','/platform/inclusiveTherapyV3?screen=agency','_self','fa fa-heart',1,0,'inclusiveTherapyV3.travelAgency',
@inclusive_therapy_v3_next_location,0,'pc',@inclusive_therapy_v3_pc_module,'',@inclusive_therapy_v3_now,'',@inclusive_therapy_v3_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `permission`='inclusiveTherapyV3.travelAgency');
-- 线路管理
SET @staff_therapy_menu_line = COALESCE((SELECT `id` FROM `sys_menu` WHERE `permission`='staffTherapyRecuperation.line' LIMIT 1),REPLACE(UUID(),'-',''));
SET @staff_therapy_next_path = (
SELECT CONCAT(@staff_therapy_root_path,LPAD(COALESCE(MAX(CAST(RIGHT(`path`,4) AS UNSIGNED)),0)+1,4,'0'))
FROM `sys_menu` WHERE CHAR_LENGTH(`path`)=CHAR_LENGTH(@staff_therapy_root_path)+4 AND LEFT(`path`,CHAR_LENGTH(@staff_therapy_root_path))=@staff_therapy_root_path
SET @inclusive_therapy_v3_menu_line = COALESCE((SELECT `id` FROM `sys_menu` WHERE `permission`='inclusiveTherapyV3.line' LIMIT 1),REPLACE(UUID(),'-',''));
SET @inclusive_therapy_v3_next_path = (
SELECT CONCAT(@inclusive_therapy_v3_root_path,LPAD(COALESCE(MAX(CAST(RIGHT(`path`,4) AS UNSIGNED)),0)+1,4,'0'))
FROM `sys_menu` WHERE CHAR_LENGTH(`path`)=CHAR_LENGTH(@inclusive_therapy_v3_root_path)+4 AND LEFT(`path`,CHAR_LENGTH(@inclusive_therapy_v3_root_path))=@inclusive_therapy_v3_root_path
);
SET @staff_therapy_next_location = (SELECT COALESCE(MAX(`location`),0)+1 FROM `sys_menu`);
SET @inclusive_therapy_v3_next_location = (SELECT COALESCE(MAX(`location`),0)+1 FROM `sys_menu`);
INSERT INTO `sys_menu`
(`id`,`parentId`,`path`,`name`,`type`,`href`,`target`,`icon`,`showit`,`disabled`,`permission`,`location`,`hasChildren`,`platform`,`moduleId`,`createdBy`,`createdAt`,`updatedBy`,`updatedAt`,`delFlag`)
SELECT @staff_therapy_menu_line,@staff_therapy_menu_root,@staff_therapy_next_path,'线路管理','menu','/platform/staffTherapyRecuperation?screen=line','_self','fa fa-heart',1,0,'staffTherapyRecuperation.line',
@staff_therapy_next_location,0,'pc',@staff_therapy_pc_module,'',@staff_therapy_now,'',@staff_therapy_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `permission`='staffTherapyRecuperation.line');
SELECT @inclusive_therapy_v3_menu_line,@inclusive_therapy_v3_menu_root,@inclusive_therapy_v3_next_path,'线路管理','menu','/platform/inclusiveTherapyV3?screen=line','_self','fa fa-heart',1,0,'inclusiveTherapyV3.line',
@inclusive_therapy_v3_next_location,0,'pc',@inclusive_therapy_v3_pc_module,'',@inclusive_therapy_v3_now,'',@inclusive_therapy_v3_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `permission`='inclusiveTherapyV3.line');
-- 目的地管理
SET @staff_therapy_menu_base = COALESCE((SELECT `id` FROM `sys_menu` WHERE `permission`='staffTherapyRecuperation.TheBaseManagement' LIMIT 1),REPLACE(UUID(),'-',''));
SET @staff_therapy_next_path = (
SELECT CONCAT(@staff_therapy_root_path,LPAD(COALESCE(MAX(CAST(RIGHT(`path`,4) AS UNSIGNED)),0)+1,4,'0'))
FROM `sys_menu` WHERE CHAR_LENGTH(`path`)=CHAR_LENGTH(@staff_therapy_root_path)+4 AND LEFT(`path`,CHAR_LENGTH(@staff_therapy_root_path))=@staff_therapy_root_path
SET @inclusive_therapy_v3_menu_base = COALESCE((SELECT `id` FROM `sys_menu` WHERE `permission`='inclusiveTherapyV3.TheBaseManagement' LIMIT 1),REPLACE(UUID(),'-',''));
SET @inclusive_therapy_v3_next_path = (
SELECT CONCAT(@inclusive_therapy_v3_root_path,LPAD(COALESCE(MAX(CAST(RIGHT(`path`,4) AS UNSIGNED)),0)+1,4,'0'))
FROM `sys_menu` WHERE CHAR_LENGTH(`path`)=CHAR_LENGTH(@inclusive_therapy_v3_root_path)+4 AND LEFT(`path`,CHAR_LENGTH(@inclusive_therapy_v3_root_path))=@inclusive_therapy_v3_root_path
);
SET @staff_therapy_next_location = (SELECT COALESCE(MAX(`location`),0)+1 FROM `sys_menu`);
SET @inclusive_therapy_v3_next_location = (SELECT COALESCE(MAX(`location`),0)+1 FROM `sys_menu`);
INSERT INTO `sys_menu`
(`id`,`parentId`,`path`,`name`,`type`,`href`,`target`,`icon`,`showit`,`disabled`,`permission`,`location`,`hasChildren`,`platform`,`moduleId`,`createdBy`,`createdAt`,`updatedBy`,`updatedAt`,`delFlag`)
SELECT @staff_therapy_menu_base,@staff_therapy_menu_root,@staff_therapy_next_path,'目的地管理','menu','/platform/staffTherapyRecuperation?screen=base','_self','fa fa-heart',1,0,'staffTherapyRecuperation.TheBaseManagement',
@staff_therapy_next_location,0,'pc',@staff_therapy_pc_module,'',@staff_therapy_now,'',@staff_therapy_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `permission`='staffTherapyRecuperation.TheBaseManagement');
SELECT @inclusive_therapy_v3_menu_base,@inclusive_therapy_v3_menu_root,@inclusive_therapy_v3_next_path,'目的地管理','menu','/platform/inclusiveTherapyV3?screen=base','_self','fa fa-heart',1,0,'inclusiveTherapyV3.TheBaseManagement',
@inclusive_therapy_v3_next_location,0,'pc',@inclusive_therapy_v3_pc_module,'',@inclusive_therapy_v3_now,'',@inclusive_therapy_v3_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `permission`='inclusiveTherapyV3.TheBaseManagement');
-- 分工会选择线路
SET @staff_therapy_menu_branchSelect = COALESCE((SELECT `id` FROM `sys_menu` WHERE `permission`='staffTherapyRecuperation.lineFghSelect' LIMIT 1),REPLACE(UUID(),'-',''));
SET @staff_therapy_next_path = (
SELECT CONCAT(@staff_therapy_root_path,LPAD(COALESCE(MAX(CAST(RIGHT(`path`,4) AS UNSIGNED)),0)+1,4,'0'))
FROM `sys_menu` WHERE CHAR_LENGTH(`path`)=CHAR_LENGTH(@staff_therapy_root_path)+4 AND LEFT(`path`,CHAR_LENGTH(@staff_therapy_root_path))=@staff_therapy_root_path
SET @inclusive_therapy_v3_menu_branchSelect = COALESCE((SELECT `id` FROM `sys_menu` WHERE `permission`='inclusiveTherapyV3.lineFghSelect' LIMIT 1),REPLACE(UUID(),'-',''));
SET @inclusive_therapy_v3_next_path = (
SELECT CONCAT(@inclusive_therapy_v3_root_path,LPAD(COALESCE(MAX(CAST(RIGHT(`path`,4) AS UNSIGNED)),0)+1,4,'0'))
FROM `sys_menu` WHERE CHAR_LENGTH(`path`)=CHAR_LENGTH(@inclusive_therapy_v3_root_path)+4 AND LEFT(`path`,CHAR_LENGTH(@inclusive_therapy_v3_root_path))=@inclusive_therapy_v3_root_path
);
SET @staff_therapy_next_location = (SELECT COALESCE(MAX(`location`),0)+1 FROM `sys_menu`);
SET @inclusive_therapy_v3_next_location = (SELECT COALESCE(MAX(`location`),0)+1 FROM `sys_menu`);
INSERT INTO `sys_menu`
(`id`,`parentId`,`path`,`name`,`type`,`href`,`target`,`icon`,`showit`,`disabled`,`permission`,`location`,`hasChildren`,`platform`,`moduleId`,`createdBy`,`createdAt`,`updatedBy`,`updatedAt`,`delFlag`)
SELECT @staff_therapy_menu_branchSelect,@staff_therapy_menu_root,@staff_therapy_next_path,'分工会选择线路','menu','/platform/staffTherapyRecuperation?screen=branchSelect','_self','fa fa-heart',1,0,'staffTherapyRecuperation.lineFghSelect',
@staff_therapy_next_location,0,'pc',@staff_therapy_pc_module,'',@staff_therapy_now,'',@staff_therapy_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `permission`='staffTherapyRecuperation.lineFghSelect');
SELECT @inclusive_therapy_v3_menu_branchSelect,@inclusive_therapy_v3_menu_root,@inclusive_therapy_v3_next_path,'分工会选择线路','menu','/platform/inclusiveTherapyV3?screen=branchSelect','_self','fa fa-heart',1,0,'inclusiveTherapyV3.lineFghSelect',
@inclusive_therapy_v3_next_location,0,'pc',@inclusive_therapy_v3_pc_module,'',@inclusive_therapy_v3_now,'',@inclusive_therapy_v3_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `permission`='inclusiveTherapyV3.lineFghSelect');
-- 校工会选择线路
SET @staff_therapy_menu_schoolSelect = COALESCE((SELECT `id` FROM `sys_menu` WHERE `permission`='staffTherapyRecuperation.lineXghSelect' LIMIT 1),REPLACE(UUID(),'-',''));
SET @staff_therapy_next_path = (
SELECT CONCAT(@staff_therapy_root_path,LPAD(COALESCE(MAX(CAST(RIGHT(`path`,4) AS UNSIGNED)),0)+1,4,'0'))
FROM `sys_menu` WHERE CHAR_LENGTH(`path`)=CHAR_LENGTH(@staff_therapy_root_path)+4 AND LEFT(`path`,CHAR_LENGTH(@staff_therapy_root_path))=@staff_therapy_root_path
SET @inclusive_therapy_v3_menu_schoolSelect = COALESCE((SELECT `id` FROM `sys_menu` WHERE `permission`='inclusiveTherapyV3.lineXghSelect' LIMIT 1),REPLACE(UUID(),'-',''));
SET @inclusive_therapy_v3_next_path = (
SELECT CONCAT(@inclusive_therapy_v3_root_path,LPAD(COALESCE(MAX(CAST(RIGHT(`path`,4) AS UNSIGNED)),0)+1,4,'0'))
FROM `sys_menu` WHERE CHAR_LENGTH(`path`)=CHAR_LENGTH(@inclusive_therapy_v3_root_path)+4 AND LEFT(`path`,CHAR_LENGTH(@inclusive_therapy_v3_root_path))=@inclusive_therapy_v3_root_path
);
SET @staff_therapy_next_location = (SELECT COALESCE(MAX(`location`),0)+1 FROM `sys_menu`);
SET @inclusive_therapy_v3_next_location = (SELECT COALESCE(MAX(`location`),0)+1 FROM `sys_menu`);
INSERT INTO `sys_menu`
(`id`,`parentId`,`path`,`name`,`type`,`href`,`target`,`icon`,`showit`,`disabled`,`permission`,`location`,`hasChildren`,`platform`,`moduleId`,`createdBy`,`createdAt`,`updatedBy`,`updatedAt`,`delFlag`)
SELECT @staff_therapy_menu_schoolSelect,@staff_therapy_menu_root,@staff_therapy_next_path,'校工会选择线路','menu','/platform/staffTherapyRecuperation?screen=schoolSelect','_self','fa fa-heart',1,0,'staffTherapyRecuperation.lineXghSelect',
@staff_therapy_next_location,0,'pc',@staff_therapy_pc_module,'',@staff_therapy_now,'',@staff_therapy_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `permission`='staffTherapyRecuperation.lineXghSelect');
SELECT @inclusive_therapy_v3_menu_schoolSelect,@inclusive_therapy_v3_menu_root,@inclusive_therapy_v3_next_path,'校工会选择线路','menu','/platform/inclusiveTherapyV3?screen=schoolSelect','_self','fa fa-heart',1,0,'inclusiveTherapyV3.lineXghSelect',
@inclusive_therapy_v3_next_location,0,'pc',@inclusive_therapy_v3_pc_module,'',@inclusive_therapy_v3_now,'',@inclusive_therapy_v3_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `permission`='inclusiveTherapyV3.lineXghSelect');
-- 线路选择总览
SET @staff_therapy_menu_overview = COALESCE((SELECT `id` FROM `sys_menu` WHERE `permission`='staffTherapyRecuperation.lineSelectionOverview' LIMIT 1),REPLACE(UUID(),'-',''));
SET @staff_therapy_next_path = (
SELECT CONCAT(@staff_therapy_root_path,LPAD(COALESCE(MAX(CAST(RIGHT(`path`,4) AS UNSIGNED)),0)+1,4,'0'))
FROM `sys_menu` WHERE CHAR_LENGTH(`path`)=CHAR_LENGTH(@staff_therapy_root_path)+4 AND LEFT(`path`,CHAR_LENGTH(@staff_therapy_root_path))=@staff_therapy_root_path
SET @inclusive_therapy_v3_menu_overview = COALESCE((SELECT `id` FROM `sys_menu` WHERE `permission`='inclusiveTherapyV3.lineSelectionOverview' LIMIT 1),REPLACE(UUID(),'-',''));
SET @inclusive_therapy_v3_next_path = (
SELECT CONCAT(@inclusive_therapy_v3_root_path,LPAD(COALESCE(MAX(CAST(RIGHT(`path`,4) AS UNSIGNED)),0)+1,4,'0'))
FROM `sys_menu` WHERE CHAR_LENGTH(`path`)=CHAR_LENGTH(@inclusive_therapy_v3_root_path)+4 AND LEFT(`path`,CHAR_LENGTH(@inclusive_therapy_v3_root_path))=@inclusive_therapy_v3_root_path
);
SET @staff_therapy_next_location = (SELECT COALESCE(MAX(`location`),0)+1 FROM `sys_menu`);
SET @inclusive_therapy_v3_next_location = (SELECT COALESCE(MAX(`location`),0)+1 FROM `sys_menu`);
INSERT INTO `sys_menu`
(`id`,`parentId`,`path`,`name`,`type`,`href`,`target`,`icon`,`showit`,`disabled`,`permission`,`location`,`hasChildren`,`platform`,`moduleId`,`createdBy`,`createdAt`,`updatedBy`,`updatedAt`,`delFlag`)
SELECT @staff_therapy_menu_overview,@staff_therapy_menu_root,@staff_therapy_next_path,'线路选择总览','menu','/platform/staffTherapyRecuperation?screen=overview','_self','fa fa-heart',1,0,'staffTherapyRecuperation.lineSelectionOverview',
@staff_therapy_next_location,0,'pc',@staff_therapy_pc_module,'',@staff_therapy_now,'',@staff_therapy_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `permission`='staffTherapyRecuperation.lineSelectionOverview');
SELECT @inclusive_therapy_v3_menu_overview,@inclusive_therapy_v3_menu_root,@inclusive_therapy_v3_next_path,'线路选择总览','menu','/platform/inclusiveTherapyV3?screen=overview','_self','fa fa-heart',1,0,'inclusiveTherapyV3.lineSelectionOverview',
@inclusive_therapy_v3_next_location,0,'pc',@inclusive_therapy_v3_pc_module,'',@inclusive_therapy_v3_now,'',@inclusive_therapy_v3_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `permission`='inclusiveTherapyV3.lineSelectionOverview');
-- 线路组团
SET @staff_therapy_menu_cluster = COALESCE((SELECT `id` FROM `sys_menu` WHERE `permission`='staffTherapyRecuperation.lineCluster' LIMIT 1),REPLACE(UUID(),'-',''));
SET @staff_therapy_next_path = (
SELECT CONCAT(@staff_therapy_root_path,LPAD(COALESCE(MAX(CAST(RIGHT(`path`,4) AS UNSIGNED)),0)+1,4,'0'))
FROM `sys_menu` WHERE CHAR_LENGTH(`path`)=CHAR_LENGTH(@staff_therapy_root_path)+4 AND LEFT(`path`,CHAR_LENGTH(@staff_therapy_root_path))=@staff_therapy_root_path
SET @inclusive_therapy_v3_menu_cluster = COALESCE((SELECT `id` FROM `sys_menu` WHERE `permission`='inclusiveTherapyV3.lineCluster' LIMIT 1),REPLACE(UUID(),'-',''));
SET @inclusive_therapy_v3_next_path = (
SELECT CONCAT(@inclusive_therapy_v3_root_path,LPAD(COALESCE(MAX(CAST(RIGHT(`path`,4) AS UNSIGNED)),0)+1,4,'0'))
FROM `sys_menu` WHERE CHAR_LENGTH(`path`)=CHAR_LENGTH(@inclusive_therapy_v3_root_path)+4 AND LEFT(`path`,CHAR_LENGTH(@inclusive_therapy_v3_root_path))=@inclusive_therapy_v3_root_path
);
SET @staff_therapy_next_location = (SELECT COALESCE(MAX(`location`),0)+1 FROM `sys_menu`);
SET @inclusive_therapy_v3_next_location = (SELECT COALESCE(MAX(`location`),0)+1 FROM `sys_menu`);
INSERT INTO `sys_menu`
(`id`,`parentId`,`path`,`name`,`type`,`href`,`target`,`icon`,`showit`,`disabled`,`permission`,`location`,`hasChildren`,`platform`,`moduleId`,`createdBy`,`createdAt`,`updatedBy`,`updatedAt`,`delFlag`)
SELECT @staff_therapy_menu_cluster,@staff_therapy_menu_root,@staff_therapy_next_path,'线路组团','menu','/platform/staffTherapyRecuperation?screen=cluster','_self','fa fa-heart',1,0,'staffTherapyRecuperation.lineCluster',
@staff_therapy_next_location,0,'pc',@staff_therapy_pc_module,'',@staff_therapy_now,'',@staff_therapy_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `permission`='staffTherapyRecuperation.lineCluster');
SELECT @inclusive_therapy_v3_menu_cluster,@inclusive_therapy_v3_menu_root,@inclusive_therapy_v3_next_path,'线路组团','menu','/platform/inclusiveTherapyV3?screen=cluster','_self','fa fa-heart',1,0,'inclusiveTherapyV3.lineCluster',
@inclusive_therapy_v3_next_location,0,'pc',@inclusive_therapy_v3_pc_module,'',@inclusive_therapy_v3_now,'',@inclusive_therapy_v3_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `permission`='inclusiveTherapyV3.lineCluster');
-- 线路调剂
SET @staff_therapy_menu_adjustment = COALESCE((SELECT `id` FROM `sys_menu` WHERE `permission`='staffTherapyRecuperation.line.adjustment' LIMIT 1),REPLACE(UUID(),'-',''));
SET @staff_therapy_next_path = (
SELECT CONCAT(@staff_therapy_root_path,LPAD(COALESCE(MAX(CAST(RIGHT(`path`,4) AS UNSIGNED)),0)+1,4,'0'))
FROM `sys_menu` WHERE CHAR_LENGTH(`path`)=CHAR_LENGTH(@staff_therapy_root_path)+4 AND LEFT(`path`,CHAR_LENGTH(@staff_therapy_root_path))=@staff_therapy_root_path
SET @inclusive_therapy_v3_menu_adjustment = COALESCE((SELECT `id` FROM `sys_menu` WHERE `permission`='inclusiveTherapyV3.line.adjustment' LIMIT 1),REPLACE(UUID(),'-',''));
SET @inclusive_therapy_v3_next_path = (
SELECT CONCAT(@inclusive_therapy_v3_root_path,LPAD(COALESCE(MAX(CAST(RIGHT(`path`,4) AS UNSIGNED)),0)+1,4,'0'))
FROM `sys_menu` WHERE CHAR_LENGTH(`path`)=CHAR_LENGTH(@inclusive_therapy_v3_root_path)+4 AND LEFT(`path`,CHAR_LENGTH(@inclusive_therapy_v3_root_path))=@inclusive_therapy_v3_root_path
);
SET @staff_therapy_next_location = (SELECT COALESCE(MAX(`location`),0)+1 FROM `sys_menu`);
SET @inclusive_therapy_v3_next_location = (SELECT COALESCE(MAX(`location`),0)+1 FROM `sys_menu`);
INSERT INTO `sys_menu`
(`id`,`parentId`,`path`,`name`,`type`,`href`,`target`,`icon`,`showit`,`disabled`,`permission`,`location`,`hasChildren`,`platform`,`moduleId`,`createdBy`,`createdAt`,`updatedBy`,`updatedAt`,`delFlag`)
SELECT @staff_therapy_menu_adjustment,@staff_therapy_menu_root,@staff_therapy_next_path,'线路调剂','menu','/platform/staffTherapyRecuperation?screen=adjustment','_self','fa fa-heart',1,0,'staffTherapyRecuperation.line.adjustment',
@staff_therapy_next_location,0,'pc',@staff_therapy_pc_module,'',@staff_therapy_now,'',@staff_therapy_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `permission`='staffTherapyRecuperation.line.adjustment');
SELECT @inclusive_therapy_v3_menu_adjustment,@inclusive_therapy_v3_menu_root,@inclusive_therapy_v3_next_path,'线路调剂','menu','/platform/inclusiveTherapyV3?screen=adjustment','_self','fa fa-heart',1,0,'inclusiveTherapyV3.line.adjustment',
@inclusive_therapy_v3_next_location,0,'pc',@inclusive_therapy_v3_pc_module,'',@inclusive_therapy_v3_now,'',@inclusive_therapy_v3_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `permission`='inclusiveTherapyV3.line.adjustment');
-- 参加人员导入
SET @staff_therapy_menu_import = COALESCE((SELECT `id` FROM `sys_menu` WHERE `permission`='staffTherapyRecuperation.joinUser.import' LIMIT 1),REPLACE(UUID(),'-',''));
SET @staff_therapy_next_path = (
SELECT CONCAT(@staff_therapy_root_path,LPAD(COALESCE(MAX(CAST(RIGHT(`path`,4) AS UNSIGNED)),0)+1,4,'0'))
FROM `sys_menu` WHERE CHAR_LENGTH(`path`)=CHAR_LENGTH(@staff_therapy_root_path)+4 AND LEFT(`path`,CHAR_LENGTH(@staff_therapy_root_path))=@staff_therapy_root_path
SET @inclusive_therapy_v3_menu_import = COALESCE((SELECT `id` FROM `sys_menu` WHERE `permission`='inclusiveTherapyV3.joinUser.import' LIMIT 1),REPLACE(UUID(),'-',''));
SET @inclusive_therapy_v3_next_path = (
SELECT CONCAT(@inclusive_therapy_v3_root_path,LPAD(COALESCE(MAX(CAST(RIGHT(`path`,4) AS UNSIGNED)),0)+1,4,'0'))
FROM `sys_menu` WHERE CHAR_LENGTH(`path`)=CHAR_LENGTH(@inclusive_therapy_v3_root_path)+4 AND LEFT(`path`,CHAR_LENGTH(@inclusive_therapy_v3_root_path))=@inclusive_therapy_v3_root_path
);
SET @staff_therapy_next_location = (SELECT COALESCE(MAX(`location`),0)+1 FROM `sys_menu`);
SET @inclusive_therapy_v3_next_location = (SELECT COALESCE(MAX(`location`),0)+1 FROM `sys_menu`);
INSERT INTO `sys_menu`
(`id`,`parentId`,`path`,`name`,`type`,`href`,`target`,`icon`,`showit`,`disabled`,`permission`,`location`,`hasChildren`,`platform`,`moduleId`,`createdBy`,`createdAt`,`updatedBy`,`updatedAt`,`delFlag`)
SELECT @staff_therapy_menu_import,@staff_therapy_menu_root,@staff_therapy_next_path,'参加人员导入','menu','/platform/staffTherapyRecuperation?screen=import','_self','fa fa-heart',1,0,'staffTherapyRecuperation.joinUser.import',
@staff_therapy_next_location,0,'pc',@staff_therapy_pc_module,'',@staff_therapy_now,'',@staff_therapy_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `permission`='staffTherapyRecuperation.joinUser.import');
SELECT @inclusive_therapy_v3_menu_import,@inclusive_therapy_v3_menu_root,@inclusive_therapy_v3_next_path,'参加人员导入','menu','/platform/inclusiveTherapyV3?screen=import','_self','fa fa-heart',1,0,'inclusiveTherapyV3.joinUser.import',
@inclusive_therapy_v3_next_location,0,'pc',@inclusive_therapy_v3_pc_module,'',@inclusive_therapy_v3_now,'',@inclusive_therapy_v3_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `permission`='inclusiveTherapyV3.joinUser.import');
-- 分工会审核
SET @staff_therapy_menu_branchAudit = COALESCE((SELECT `id` FROM `sys_menu` WHERE `permission`='staffTherapyRecuperation.TheRapyAudit' LIMIT 1),REPLACE(UUID(),'-',''));
SET @staff_therapy_next_path = (
SELECT CONCAT(@staff_therapy_root_path,LPAD(COALESCE(MAX(CAST(RIGHT(`path`,4) AS UNSIGNED)),0)+1,4,'0'))
FROM `sys_menu` WHERE CHAR_LENGTH(`path`)=CHAR_LENGTH(@staff_therapy_root_path)+4 AND LEFT(`path`,CHAR_LENGTH(@staff_therapy_root_path))=@staff_therapy_root_path
SET @inclusive_therapy_v3_menu_branchAudit = COALESCE((SELECT `id` FROM `sys_menu` WHERE `permission`='inclusiveTherapyV3.TheRapyAudit' LIMIT 1),REPLACE(UUID(),'-',''));
SET @inclusive_therapy_v3_next_path = (
SELECT CONCAT(@inclusive_therapy_v3_root_path,LPAD(COALESCE(MAX(CAST(RIGHT(`path`,4) AS UNSIGNED)),0)+1,4,'0'))
FROM `sys_menu` WHERE CHAR_LENGTH(`path`)=CHAR_LENGTH(@inclusive_therapy_v3_root_path)+4 AND LEFT(`path`,CHAR_LENGTH(@inclusive_therapy_v3_root_path))=@inclusive_therapy_v3_root_path
);
SET @staff_therapy_next_location = (SELECT COALESCE(MAX(`location`),0)+1 FROM `sys_menu`);
SET @inclusive_therapy_v3_next_location = (SELECT COALESCE(MAX(`location`),0)+1 FROM `sys_menu`);
INSERT INTO `sys_menu`
(`id`,`parentId`,`path`,`name`,`type`,`href`,`target`,`icon`,`showit`,`disabled`,`permission`,`location`,`hasChildren`,`platform`,`moduleId`,`createdBy`,`createdAt`,`updatedBy`,`updatedAt`,`delFlag`)
SELECT @staff_therapy_menu_branchAudit,@staff_therapy_menu_root,@staff_therapy_next_path,'分工会审核','menu','/platform/staffTherapyRecuperation?screen=branchAudit','_self','fa fa-heart',1,0,'staffTherapyRecuperation.TheRapyAudit',
@staff_therapy_next_location,0,'pc',@staff_therapy_pc_module,'',@staff_therapy_now,'',@staff_therapy_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `permission`='staffTherapyRecuperation.TheRapyAudit');
SELECT @inclusive_therapy_v3_menu_branchAudit,@inclusive_therapy_v3_menu_root,@inclusive_therapy_v3_next_path,'分工会审核','menu','/platform/inclusiveTherapyV3?screen=branchAudit','_self','fa fa-heart',1,0,'inclusiveTherapyV3.TheRapyAudit',
@inclusive_therapy_v3_next_location,0,'pc',@inclusive_therapy_v3_pc_module,'',@inclusive_therapy_v3_now,'',@inclusive_therapy_v3_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `permission`='inclusiveTherapyV3.TheRapyAudit');
-- 自由组团审核
SET @staff_therapy_menu_travelAudit = COALESCE((SELECT `id` FROM `sys_menu` WHERE `permission`='staffTherapyRecuperation.TheRapyTravelAudit' LIMIT 1),REPLACE(UUID(),'-',''));
SET @staff_therapy_next_path = (
SELECT CONCAT(@staff_therapy_root_path,LPAD(COALESCE(MAX(CAST(RIGHT(`path`,4) AS UNSIGNED)),0)+1,4,'0'))
FROM `sys_menu` WHERE CHAR_LENGTH(`path`)=CHAR_LENGTH(@staff_therapy_root_path)+4 AND LEFT(`path`,CHAR_LENGTH(@staff_therapy_root_path))=@staff_therapy_root_path
SET @inclusive_therapy_v3_menu_travelAudit = COALESCE((SELECT `id` FROM `sys_menu` WHERE `permission`='inclusiveTherapyV3.TheRapyTravelAudit' LIMIT 1),REPLACE(UUID(),'-',''));
SET @inclusive_therapy_v3_next_path = (
SELECT CONCAT(@inclusive_therapy_v3_root_path,LPAD(COALESCE(MAX(CAST(RIGHT(`path`,4) AS UNSIGNED)),0)+1,4,'0'))
FROM `sys_menu` WHERE CHAR_LENGTH(`path`)=CHAR_LENGTH(@inclusive_therapy_v3_root_path)+4 AND LEFT(`path`,CHAR_LENGTH(@inclusive_therapy_v3_root_path))=@inclusive_therapy_v3_root_path
);
SET @staff_therapy_next_location = (SELECT COALESCE(MAX(`location`),0)+1 FROM `sys_menu`);
SET @inclusive_therapy_v3_next_location = (SELECT COALESCE(MAX(`location`),0)+1 FROM `sys_menu`);
INSERT INTO `sys_menu`
(`id`,`parentId`,`path`,`name`,`type`,`href`,`target`,`icon`,`showit`,`disabled`,`permission`,`location`,`hasChildren`,`platform`,`moduleId`,`createdBy`,`createdAt`,`updatedBy`,`updatedAt`,`delFlag`)
SELECT @staff_therapy_menu_travelAudit,@staff_therapy_menu_root,@staff_therapy_next_path,'自由组团审核','menu','/platform/staffTherapyRecuperation?screen=travelAudit','_self','fa fa-heart',1,0,'staffTherapyRecuperation.TheRapyTravelAudit',
@staff_therapy_next_location,0,'pc',@staff_therapy_pc_module,'',@staff_therapy_now,'',@staff_therapy_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `permission`='staffTherapyRecuperation.TheRapyTravelAudit');
SELECT @inclusive_therapy_v3_menu_travelAudit,@inclusive_therapy_v3_menu_root,@inclusive_therapy_v3_next_path,'自由组团审核','menu','/platform/inclusiveTherapyV3?screen=travelAudit','_self','fa fa-heart',1,0,'inclusiveTherapyV3.TheRapyTravelAudit',
@inclusive_therapy_v3_next_location,0,'pc',@inclusive_therapy_v3_pc_module,'',@inclusive_therapy_v3_now,'',@inclusive_therapy_v3_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `permission`='inclusiveTherapyV3.TheRapyTravelAudit');
-- 校工会审核
SET @staff_therapy_menu_schoolAudit = COALESCE((SELECT `id` FROM `sys_menu` WHERE `permission`='staffTherapyRecuperation.TheRapyXghAudit' LIMIT 1),REPLACE(UUID(),'-',''));
SET @staff_therapy_next_path = (
SELECT CONCAT(@staff_therapy_root_path,LPAD(COALESCE(MAX(CAST(RIGHT(`path`,4) AS UNSIGNED)),0)+1,4,'0'))
FROM `sys_menu` WHERE CHAR_LENGTH(`path`)=CHAR_LENGTH(@staff_therapy_root_path)+4 AND LEFT(`path`,CHAR_LENGTH(@staff_therapy_root_path))=@staff_therapy_root_path
SET @inclusive_therapy_v3_menu_schoolAudit = COALESCE((SELECT `id` FROM `sys_menu` WHERE `permission`='inclusiveTherapyV3.TheRapyXghAudit' LIMIT 1),REPLACE(UUID(),'-',''));
SET @inclusive_therapy_v3_next_path = (
SELECT CONCAT(@inclusive_therapy_v3_root_path,LPAD(COALESCE(MAX(CAST(RIGHT(`path`,4) AS UNSIGNED)),0)+1,4,'0'))
FROM `sys_menu` WHERE CHAR_LENGTH(`path`)=CHAR_LENGTH(@inclusive_therapy_v3_root_path)+4 AND LEFT(`path`,CHAR_LENGTH(@inclusive_therapy_v3_root_path))=@inclusive_therapy_v3_root_path
);
SET @staff_therapy_next_location = (SELECT COALESCE(MAX(`location`),0)+1 FROM `sys_menu`);
SET @inclusive_therapy_v3_next_location = (SELECT COALESCE(MAX(`location`),0)+1 FROM `sys_menu`);
INSERT INTO `sys_menu`
(`id`,`parentId`,`path`,`name`,`type`,`href`,`target`,`icon`,`showit`,`disabled`,`permission`,`location`,`hasChildren`,`platform`,`moduleId`,`createdBy`,`createdAt`,`updatedBy`,`updatedAt`,`delFlag`)
SELECT @staff_therapy_menu_schoolAudit,@staff_therapy_menu_root,@staff_therapy_next_path,'校工会审核','menu','/platform/staffTherapyRecuperation?screen=schoolAudit','_self','fa fa-heart',1,0,'staffTherapyRecuperation.TheRapyXghAudit',
@staff_therapy_next_location,0,'pc',@staff_therapy_pc_module,'',@staff_therapy_now,'',@staff_therapy_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `permission`='staffTherapyRecuperation.TheRapyXghAudit');
SELECT @inclusive_therapy_v3_menu_schoolAudit,@inclusive_therapy_v3_menu_root,@inclusive_therapy_v3_next_path,'校工会审核','menu','/platform/inclusiveTherapyV3?screen=schoolAudit','_self','fa fa-heart',1,0,'inclusiveTherapyV3.TheRapyXghAudit',
@inclusive_therapy_v3_next_location,0,'pc',@inclusive_therapy_v3_pc_module,'',@inclusive_therapy_v3_now,'',@inclusive_therapy_v3_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `permission`='inclusiveTherapyV3.TheRapyXghAudit');
-- 分工会查询
SET @staff_therapy_menu_branchQuery = COALESCE((SELECT `id` FROM `sys_menu` WHERE `permission`='staffTherapyRecuperation.TheRapyQuery' LIMIT 1),REPLACE(UUID(),'-',''));
SET @staff_therapy_next_path = (
SELECT CONCAT(@staff_therapy_root_path,LPAD(COALESCE(MAX(CAST(RIGHT(`path`,4) AS UNSIGNED)),0)+1,4,'0'))
FROM `sys_menu` WHERE CHAR_LENGTH(`path`)=CHAR_LENGTH(@staff_therapy_root_path)+4 AND LEFT(`path`,CHAR_LENGTH(@staff_therapy_root_path))=@staff_therapy_root_path
SET @inclusive_therapy_v3_menu_branchQuery = COALESCE((SELECT `id` FROM `sys_menu` WHERE `permission`='inclusiveTherapyV3.TheRapyQuery' LIMIT 1),REPLACE(UUID(),'-',''));
SET @inclusive_therapy_v3_next_path = (
SELECT CONCAT(@inclusive_therapy_v3_root_path,LPAD(COALESCE(MAX(CAST(RIGHT(`path`,4) AS UNSIGNED)),0)+1,4,'0'))
FROM `sys_menu` WHERE CHAR_LENGTH(`path`)=CHAR_LENGTH(@inclusive_therapy_v3_root_path)+4 AND LEFT(`path`,CHAR_LENGTH(@inclusive_therapy_v3_root_path))=@inclusive_therapy_v3_root_path
);
SET @staff_therapy_next_location = (SELECT COALESCE(MAX(`location`),0)+1 FROM `sys_menu`);
SET @inclusive_therapy_v3_next_location = (SELECT COALESCE(MAX(`location`),0)+1 FROM `sys_menu`);
INSERT INTO `sys_menu`
(`id`,`parentId`,`path`,`name`,`type`,`href`,`target`,`icon`,`showit`,`disabled`,`permission`,`location`,`hasChildren`,`platform`,`moduleId`,`createdBy`,`createdAt`,`updatedBy`,`updatedAt`,`delFlag`)
SELECT @staff_therapy_menu_branchQuery,@staff_therapy_menu_root,@staff_therapy_next_path,'分工会查询','menu','/platform/staffTherapyRecuperation?screen=branchQuery','_self','fa fa-heart',1,0,'staffTherapyRecuperation.TheRapyQuery',
@staff_therapy_next_location,0,'pc',@staff_therapy_pc_module,'',@staff_therapy_now,'',@staff_therapy_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `permission`='staffTherapyRecuperation.TheRapyQuery');
SELECT @inclusive_therapy_v3_menu_branchQuery,@inclusive_therapy_v3_menu_root,@inclusive_therapy_v3_next_path,'分工会查询','menu','/platform/inclusiveTherapyV3?screen=branchQuery','_self','fa fa-heart',1,0,'inclusiveTherapyV3.TheRapyQuery',
@inclusive_therapy_v3_next_location,0,'pc',@inclusive_therapy_v3_pc_module,'',@inclusive_therapy_v3_now,'',@inclusive_therapy_v3_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `permission`='inclusiveTherapyV3.TheRapyQuery');
-- 报名人员查询
SET @staff_therapy_menu_userQuery = COALESCE((SELECT `id` FROM `sys_menu` WHERE `permission`='staffTherapyRecuperation.TheRapyUserQuery' LIMIT 1),REPLACE(UUID(),'-',''));
SET @staff_therapy_next_path = (
SELECT CONCAT(@staff_therapy_root_path,LPAD(COALESCE(MAX(CAST(RIGHT(`path`,4) AS UNSIGNED)),0)+1,4,'0'))
FROM `sys_menu` WHERE CHAR_LENGTH(`path`)=CHAR_LENGTH(@staff_therapy_root_path)+4 AND LEFT(`path`,CHAR_LENGTH(@staff_therapy_root_path))=@staff_therapy_root_path
SET @inclusive_therapy_v3_menu_userQuery = COALESCE((SELECT `id` FROM `sys_menu` WHERE `permission`='inclusiveTherapyV3.TheRapyUserQuery' LIMIT 1),REPLACE(UUID(),'-',''));
SET @inclusive_therapy_v3_next_path = (
SELECT CONCAT(@inclusive_therapy_v3_root_path,LPAD(COALESCE(MAX(CAST(RIGHT(`path`,4) AS UNSIGNED)),0)+1,4,'0'))
FROM `sys_menu` WHERE CHAR_LENGTH(`path`)=CHAR_LENGTH(@inclusive_therapy_v3_root_path)+4 AND LEFT(`path`,CHAR_LENGTH(@inclusive_therapy_v3_root_path))=@inclusive_therapy_v3_root_path
);
SET @staff_therapy_next_location = (SELECT COALESCE(MAX(`location`),0)+1 FROM `sys_menu`);
SET @inclusive_therapy_v3_next_location = (SELECT COALESCE(MAX(`location`),0)+1 FROM `sys_menu`);
INSERT INTO `sys_menu`
(`id`,`parentId`,`path`,`name`,`type`,`href`,`target`,`icon`,`showit`,`disabled`,`permission`,`location`,`hasChildren`,`platform`,`moduleId`,`createdBy`,`createdAt`,`updatedBy`,`updatedAt`,`delFlag`)
SELECT @staff_therapy_menu_userQuery,@staff_therapy_menu_root,@staff_therapy_next_path,'报名人员查询','menu','/platform/staffTherapyRecuperation?screen=userQuery','_self','fa fa-heart',1,0,'staffTherapyRecuperation.TheRapyUserQuery',
@staff_therapy_next_location,0,'pc',@staff_therapy_pc_module,'',@staff_therapy_now,'',@staff_therapy_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `permission`='staffTherapyRecuperation.TheRapyUserQuery');
SELECT @inclusive_therapy_v3_menu_userQuery,@inclusive_therapy_v3_menu_root,@inclusive_therapy_v3_next_path,'报名人员查询','menu','/platform/inclusiveTherapyV3?screen=userQuery','_self','fa fa-heart',1,0,'inclusiveTherapyV3.TheRapyUserQuery',
@inclusive_therapy_v3_next_location,0,'pc',@inclusive_therapy_v3_pc_module,'',@inclusive_therapy_v3_now,'',@inclusive_therapy_v3_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `permission`='inclusiveTherapyV3.TheRapyUserQuery');
-- 查询统计
SET @staff_therapy_menu_queryStatistics = COALESCE((SELECT `id` FROM `sys_menu` WHERE `permission`='staffTherapyRecuperation.queryStatics' LIMIT 1),REPLACE(UUID(),'-',''));
SET @staff_therapy_next_path = (
SELECT CONCAT(@staff_therapy_root_path,LPAD(COALESCE(MAX(CAST(RIGHT(`path`,4) AS UNSIGNED)),0)+1,4,'0'))
FROM `sys_menu` WHERE CHAR_LENGTH(`path`)=CHAR_LENGTH(@staff_therapy_root_path)+4 AND LEFT(`path`,CHAR_LENGTH(@staff_therapy_root_path))=@staff_therapy_root_path
SET @inclusive_therapy_v3_menu_queryStatistics = COALESCE((SELECT `id` FROM `sys_menu` WHERE `permission`='inclusiveTherapyV3.queryStatics' LIMIT 1),REPLACE(UUID(),'-',''));
SET @inclusive_therapy_v3_next_path = (
SELECT CONCAT(@inclusive_therapy_v3_root_path,LPAD(COALESCE(MAX(CAST(RIGHT(`path`,4) AS UNSIGNED)),0)+1,4,'0'))
FROM `sys_menu` WHERE CHAR_LENGTH(`path`)=CHAR_LENGTH(@inclusive_therapy_v3_root_path)+4 AND LEFT(`path`,CHAR_LENGTH(@inclusive_therapy_v3_root_path))=@inclusive_therapy_v3_root_path
);
SET @staff_therapy_next_location = (SELECT COALESCE(MAX(`location`),0)+1 FROM `sys_menu`);
SET @inclusive_therapy_v3_next_location = (SELECT COALESCE(MAX(`location`),0)+1 FROM `sys_menu`);
INSERT INTO `sys_menu`
(`id`,`parentId`,`path`,`name`,`type`,`href`,`target`,`icon`,`showit`,`disabled`,`permission`,`location`,`hasChildren`,`platform`,`moduleId`,`createdBy`,`createdAt`,`updatedBy`,`updatedAt`,`delFlag`)
SELECT @staff_therapy_menu_queryStatistics,@staff_therapy_menu_root,@staff_therapy_next_path,'查询统计','menu','/platform/staffTherapyRecuperation?screen=queryStatistics','_self','fa fa-heart',1,0,'staffTherapyRecuperation.queryStatics',
@staff_therapy_next_location,0,'pc',@staff_therapy_pc_module,'',@staff_therapy_now,'',@staff_therapy_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `permission`='staffTherapyRecuperation.queryStatics');
SELECT @inclusive_therapy_v3_menu_queryStatistics,@inclusive_therapy_v3_menu_root,@inclusive_therapy_v3_next_path,'查询统计','menu','/platform/inclusiveTherapyV3?screen=queryStatistics','_self','fa fa-heart',1,0,'inclusiveTherapyV3.queryStatics',
@inclusive_therapy_v3_next_location,0,'pc',@inclusive_therapy_v3_pc_module,'',@inclusive_therapy_v3_now,'',@inclusive_therapy_v3_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `permission`='inclusiveTherapyV3.queryStatics');
-- 线路统计
SET @staff_therapy_menu_lineStatistics = COALESCE((SELECT `id` FROM `sys_menu` WHERE `permission`='staffTherapyRecuperation.statistics' LIMIT 1),REPLACE(UUID(),'-',''));
SET @staff_therapy_next_path = (
SELECT CONCAT(@staff_therapy_root_path,LPAD(COALESCE(MAX(CAST(RIGHT(`path`,4) AS UNSIGNED)),0)+1,4,'0'))
FROM `sys_menu` WHERE CHAR_LENGTH(`path`)=CHAR_LENGTH(@staff_therapy_root_path)+4 AND LEFT(`path`,CHAR_LENGTH(@staff_therapy_root_path))=@staff_therapy_root_path
SET @inclusive_therapy_v3_menu_lineStatistics = COALESCE((SELECT `id` FROM `sys_menu` WHERE `permission`='inclusiveTherapyV3.statistics' LIMIT 1),REPLACE(UUID(),'-',''));
SET @inclusive_therapy_v3_next_path = (
SELECT CONCAT(@inclusive_therapy_v3_root_path,LPAD(COALESCE(MAX(CAST(RIGHT(`path`,4) AS UNSIGNED)),0)+1,4,'0'))
FROM `sys_menu` WHERE CHAR_LENGTH(`path`)=CHAR_LENGTH(@inclusive_therapy_v3_root_path)+4 AND LEFT(`path`,CHAR_LENGTH(@inclusive_therapy_v3_root_path))=@inclusive_therapy_v3_root_path
);
SET @staff_therapy_next_location = (SELECT COALESCE(MAX(`location`),0)+1 FROM `sys_menu`);
SET @inclusive_therapy_v3_next_location = (SELECT COALESCE(MAX(`location`),0)+1 FROM `sys_menu`);
INSERT INTO `sys_menu`
(`id`,`parentId`,`path`,`name`,`type`,`href`,`target`,`icon`,`showit`,`disabled`,`permission`,`location`,`hasChildren`,`platform`,`moduleId`,`createdBy`,`createdAt`,`updatedBy`,`updatedAt`,`delFlag`)
SELECT @staff_therapy_menu_lineStatistics,@staff_therapy_menu_root,@staff_therapy_next_path,'线路统计','menu','/platform/staffTherapyRecuperation?screen=lineStatistics','_self','fa fa-heart',1,0,'staffTherapyRecuperation.statistics',
@staff_therapy_next_location,0,'pc',@staff_therapy_pc_module,'',@staff_therapy_now,'',@staff_therapy_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `permission`='staffTherapyRecuperation.statistics');
SELECT @inclusive_therapy_v3_menu_lineStatistics,@inclusive_therapy_v3_menu_root,@inclusive_therapy_v3_next_path,'线路统计','menu','/platform/inclusiveTherapyV3?screen=lineStatistics','_self','fa fa-heart',1,0,'inclusiveTherapyV3.statistics',
@inclusive_therapy_v3_next_location,0,'pc',@inclusive_therapy_v3_pc_module,'',@inclusive_therapy_v3_now,'',@inclusive_therapy_v3_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `permission`='inclusiveTherapyV3.statistics');
-- 旅行社月度统计
SET @staff_therapy_menu_agencyStatistics = COALESCE((SELECT `id` FROM `sys_menu` WHERE `permission`='staffTherapyRecuperation.travelAgencyMonthlyStatistics' LIMIT 1),REPLACE(UUID(),'-',''));
SET @staff_therapy_next_path = (
SELECT CONCAT(@staff_therapy_root_path,LPAD(COALESCE(MAX(CAST(RIGHT(`path`,4) AS UNSIGNED)),0)+1,4,'0'))
FROM `sys_menu` WHERE CHAR_LENGTH(`path`)=CHAR_LENGTH(@staff_therapy_root_path)+4 AND LEFT(`path`,CHAR_LENGTH(@staff_therapy_root_path))=@staff_therapy_root_path
SET @inclusive_therapy_v3_menu_agencyStatistics = COALESCE((SELECT `id` FROM `sys_menu` WHERE `permission`='inclusiveTherapyV3.travelAgencyMonthlyStatistics' LIMIT 1),REPLACE(UUID(),'-',''));
SET @inclusive_therapy_v3_next_path = (
SELECT CONCAT(@inclusive_therapy_v3_root_path,LPAD(COALESCE(MAX(CAST(RIGHT(`path`,4) AS UNSIGNED)),0)+1,4,'0'))
FROM `sys_menu` WHERE CHAR_LENGTH(`path`)=CHAR_LENGTH(@inclusive_therapy_v3_root_path)+4 AND LEFT(`path`,CHAR_LENGTH(@inclusive_therapy_v3_root_path))=@inclusive_therapy_v3_root_path
);
SET @staff_therapy_next_location = (SELECT COALESCE(MAX(`location`),0)+1 FROM `sys_menu`);
SET @inclusive_therapy_v3_next_location = (SELECT COALESCE(MAX(`location`),0)+1 FROM `sys_menu`);
INSERT INTO `sys_menu`
(`id`,`parentId`,`path`,`name`,`type`,`href`,`target`,`icon`,`showit`,`disabled`,`permission`,`location`,`hasChildren`,`platform`,`moduleId`,`createdBy`,`createdAt`,`updatedBy`,`updatedAt`,`delFlag`)
SELECT @staff_therapy_menu_agencyStatistics,@staff_therapy_menu_root,@staff_therapy_next_path,'旅行社月度统计','menu','/platform/staffTherapyRecuperation?screen=agencyStatistics','_self','fa fa-heart',1,0,'staffTherapyRecuperation.travelAgencyMonthlyStatistics',
@staff_therapy_next_location,0,'pc',@staff_therapy_pc_module,'',@staff_therapy_now,'',@staff_therapy_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `permission`='staffTherapyRecuperation.travelAgencyMonthlyStatistics');
SELECT @inclusive_therapy_v3_menu_agencyStatistics,@inclusive_therapy_v3_menu_root,@inclusive_therapy_v3_next_path,'旅行社月度统计','menu','/platform/inclusiveTherapyV3?screen=agencyStatistics','_self','fa fa-heart',1,0,'inclusiveTherapyV3.travelAgencyMonthlyStatistics',
@inclusive_therapy_v3_next_location,0,'pc',@inclusive_therapy_v3_pc_module,'',@inclusive_therapy_v3_now,'',@inclusive_therapy_v3_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `permission`='inclusiveTherapyV3.travelAgencyMonthlyStatistics');
-- 分工会线路数量统计
SET @staff_therapy_menu_unionStatistics = COALESCE((SELECT `id` FROM `sys_menu` WHERE `permission`='staffTherapyRecuperation.unionLineNumberStatistics' LIMIT 1),REPLACE(UUID(),'-',''));
SET @staff_therapy_next_path = (
SELECT CONCAT(@staff_therapy_root_path,LPAD(COALESCE(MAX(CAST(RIGHT(`path`,4) AS UNSIGNED)),0)+1,4,'0'))
FROM `sys_menu` WHERE CHAR_LENGTH(`path`)=CHAR_LENGTH(@staff_therapy_root_path)+4 AND LEFT(`path`,CHAR_LENGTH(@staff_therapy_root_path))=@staff_therapy_root_path
SET @inclusive_therapy_v3_menu_unionStatistics = COALESCE((SELECT `id` FROM `sys_menu` WHERE `permission`='inclusiveTherapyV3.unionLineNumberStatistics' LIMIT 1),REPLACE(UUID(),'-',''));
SET @inclusive_therapy_v3_next_path = (
SELECT CONCAT(@inclusive_therapy_v3_root_path,LPAD(COALESCE(MAX(CAST(RIGHT(`path`,4) AS UNSIGNED)),0)+1,4,'0'))
FROM `sys_menu` WHERE CHAR_LENGTH(`path`)=CHAR_LENGTH(@inclusive_therapy_v3_root_path)+4 AND LEFT(`path`,CHAR_LENGTH(@inclusive_therapy_v3_root_path))=@inclusive_therapy_v3_root_path
);
SET @staff_therapy_next_location = (SELECT COALESCE(MAX(`location`),0)+1 FROM `sys_menu`);
SET @inclusive_therapy_v3_next_location = (SELECT COALESCE(MAX(`location`),0)+1 FROM `sys_menu`);
INSERT INTO `sys_menu`
(`id`,`parentId`,`path`,`name`,`type`,`href`,`target`,`icon`,`showit`,`disabled`,`permission`,`location`,`hasChildren`,`platform`,`moduleId`,`createdBy`,`createdAt`,`updatedBy`,`updatedAt`,`delFlag`)
SELECT @staff_therapy_menu_unionStatistics,@staff_therapy_menu_root,@staff_therapy_next_path,'分工会线路数量统计','menu','/platform/staffTherapyRecuperation?screen=unionStatistics','_self','fa fa-heart',1,0,'staffTherapyRecuperation.unionLineNumberStatistics',
@staff_therapy_next_location,0,'pc',@staff_therapy_pc_module,'',@staff_therapy_now,'',@staff_therapy_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `permission`='staffTherapyRecuperation.unionLineNumberStatistics');
SELECT @inclusive_therapy_v3_menu_unionStatistics,@inclusive_therapy_v3_menu_root,@inclusive_therapy_v3_next_path,'分工会线路数量统计','menu','/platform/inclusiveTherapyV3?screen=unionStatistics','_self','fa fa-heart',1,0,'inclusiveTherapyV3.unionLineNumberStatistics',
@inclusive_therapy_v3_next_location,0,'pc',@inclusive_therapy_v3_pc_module,'',@inclusive_therapy_v3_now,'',@inclusive_therapy_v3_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `permission`='inclusiveTherapyV3.unionLineNumberStatistics');
SET @staff_therapy_menu_signup = COALESCE((SELECT `id` FROM `sys_menu` WHERE `permission`='staffTherapyRecuperation.signup' LIMIT 1),REPLACE(UUID(),'-',''));
SET @staff_therapy_next_path = (
SELECT CONCAT(@staff_therapy_root_path,LPAD(COALESCE(MAX(CAST(RIGHT(`path`,4) AS UNSIGNED)),0)+1,4,'0'))
FROM `sys_menu` WHERE CHAR_LENGTH(`path`)=CHAR_LENGTH(@staff_therapy_root_path)+4 AND LEFT(`path`,CHAR_LENGTH(@staff_therapy_root_path))=@staff_therapy_root_path
SET @inclusive_therapy_v3_menu_signup = COALESCE((SELECT `id` FROM `sys_menu` WHERE `permission`='inclusiveTherapyV3.signup' LIMIT 1),REPLACE(UUID(),'-',''));
SET @inclusive_therapy_v3_next_path = (
SELECT CONCAT(@inclusive_therapy_v3_root_path,LPAD(COALESCE(MAX(CAST(RIGHT(`path`,4) AS UNSIGNED)),0)+1,4,'0'))
FROM `sys_menu` WHERE CHAR_LENGTH(`path`)=CHAR_LENGTH(@inclusive_therapy_v3_root_path)+4 AND LEFT(`path`,CHAR_LENGTH(@inclusive_therapy_v3_root_path))=@inclusive_therapy_v3_root_path
);
SET @staff_therapy_next_location = (SELECT COALESCE(MAX(`location`),0)+1 FROM `sys_menu`);
SET @inclusive_therapy_v3_next_location = (SELECT COALESCE(MAX(`location`),0)+1 FROM `sys_menu`);
INSERT INTO `sys_menu`
(`id`,`parentId`,`path`,`name`,`type`,`href`,`target`,`icon`,`showit`,`disabled`,`permission`,`location`,`hasChildren`,`platform`,`moduleId`,`createdBy`,`createdAt`,`updatedBy`,`updatedAt`,`delFlag`)
SELECT @staff_therapy_menu_signup,@staff_therapy_menu_root,@staff_therapy_next_path,'疗休养报名','menu','/platform/staffTherapyRecuperation?screen=signup','_self','fa fa-heart',1,0,'staffTherapyRecuperation.signup',
@staff_therapy_next_location,0,'pc',@staff_therapy_pc_module,'',@staff_therapy_now,'',@staff_therapy_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `permission`='staffTherapyRecuperation.signup');
SELECT @inclusive_therapy_v3_menu_signup,@inclusive_therapy_v3_menu_root,@inclusive_therapy_v3_next_path,'疗休养报名','menu','/platform/inclusiveTherapyV3?screen=signup','_self','fa fa-heart',1,0,'inclusiveTherapyV3.signup',
@inclusive_therapy_v3_next_location,0,'pc',@inclusive_therapy_v3_pc_module,'',@inclusive_therapy_v3_now,'',@inclusive_therapy_v3_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `permission`='inclusiveTherapyV3.signup');
SET @staff_therapy_menu_mobile = COALESCE((SELECT `id` FROM `sys_menu` WHERE `permission`='staffTherapyRecuperation.mobile' LIMIT 1),REPLACE(UUID(),'-',''));
SET @staff_therapy_next_path = (
SET @inclusive_therapy_v3_menu_mobile = COALESCE((SELECT `id` FROM `sys_menu` WHERE `permission`='inclusiveTherapyV3.mobile' LIMIT 1),REPLACE(UUID(),'-',''));
SET @inclusive_therapy_v3_next_path = (
SELECT CONCAT('',LPAD(COALESCE(MAX(CAST(RIGHT(`path`,4) AS UNSIGNED)),0)+1,4,'0'))
FROM `sys_menu` WHERE CHAR_LENGTH(`path`)=4
);
SET @staff_therapy_next_location = (SELECT COALESCE(MAX(`location`),0)+1 FROM `sys_menu`);
SET @inclusive_therapy_v3_next_location = (SELECT COALESCE(MAX(`location`),0)+1 FROM `sys_menu`);
INSERT INTO `sys_menu`
(`id`,`parentId`,`path`,`name`,`type`,`href`,`target`,`icon`,`showit`,`disabled`,`permission`,`location`,`hasChildren`,`platform`,`moduleId`,`createdBy`,`createdAt`,`updatedBy`,`updatedAt`,`delFlag`)
SELECT @staff_therapy_menu_mobile,'',@staff_therapy_next_path,'惠普疗休养V3','menu','/platform/staffTherapyRecuperation/mobile/index','_self','fa fa-heart',1,0,'staffTherapyRecuperation.mobile',
@staff_therapy_next_location,0,'h5',@staff_therapy_h5_module,'',@staff_therapy_now,'',@staff_therapy_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `permission`='staffTherapyRecuperation.mobile');
SELECT @inclusive_therapy_v3_menu_mobile,'',@inclusive_therapy_v3_next_path,'普惠疗休养V3','menu','/platform/inclusiveTherapyV3/mobile/index','_self','fa fa-heart',1,0,'inclusiveTherapyV3.mobile',
@inclusive_therapy_v3_next_location,0,'h5',@inclusive_therapy_v3_h5_module,'',@inclusive_therapy_v3_now,'',@inclusive_therapy_v3_now,0
WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `permission`='inclusiveTherapyV3.mobile');
INSERT INTO `sys_role_menu` (`roleId`,`menuId`)
SELECT r.`id`,m.`id` FROM `sys_role` r CROSS JOIN `sys_menu` m
WHERE r.`disabled`=0 AND r.`code` IN ('sysadmin','superadmin','A06','SchoolUnionMemberAdmin','SYSADMIN','SCHOOL_UNION_ADMIN','SCHOOL_UNION_WELFARE_ADMIN','SCHOOL_UNION_MEMBER_ADMIN')
AND m.`permission` IN ('staffTherapyRecuperation','staffTherapyRecuperation.TheRapyConfig','staffTherapyRecuperation.travelAgency','staffTherapyRecuperation.line','staffTherapyRecuperation.TheBaseManagement','staffTherapyRecuperation.lineFghSelect','staffTherapyRecuperation.lineXghSelect','staffTherapyRecuperation.lineSelectionOverview','staffTherapyRecuperation.lineCluster','staffTherapyRecuperation.line.adjustment','staffTherapyRecuperation.joinUser.import','staffTherapyRecuperation.TheRapyAudit','staffTherapyRecuperation.TheRapyTravelAudit','staffTherapyRecuperation.TheRapyXghAudit','staffTherapyRecuperation.TheRapyQuery','staffTherapyRecuperation.TheRapyUserQuery','staffTherapyRecuperation.queryStatics','staffTherapyRecuperation.statistics','staffTherapyRecuperation.travelAgencyMonthlyStatistics','staffTherapyRecuperation.unionLineNumberStatistics')
AND m.`permission` IN ('inclusiveTherapyV3','inclusiveTherapyV3.TheRapyConfig','inclusiveTherapyV3.travelAgency','inclusiveTherapyV3.line','inclusiveTherapyV3.TheBaseManagement','inclusiveTherapyV3.lineFghSelect','inclusiveTherapyV3.lineXghSelect','inclusiveTherapyV3.lineSelectionOverview','inclusiveTherapyV3.lineCluster','inclusiveTherapyV3.line.adjustment','inclusiveTherapyV3.joinUser.import','inclusiveTherapyV3.TheRapyAudit','inclusiveTherapyV3.TheRapyTravelAudit','inclusiveTherapyV3.TheRapyXghAudit','inclusiveTherapyV3.TheRapyQuery','inclusiveTherapyV3.TheRapyUserQuery','inclusiveTherapyV3.queryStatics','inclusiveTherapyV3.statistics','inclusiveTherapyV3.travelAgencyMonthlyStatistics','inclusiveTherapyV3.unionLineNumberStatistics')
AND NOT EXISTS (SELECT 1 FROM `sys_role_menu` rel WHERE rel.`roleId`=r.`id` AND rel.`menuId`=m.`id`);
INSERT INTO `sys_role_menu` (`roleId`,`menuId`)
SELECT r.`id`,m.`id` FROM `sys_role` r CROSS JOIN `sys_menu` m
WHERE r.`disabled`=0 AND r.`code` IN ('H03','H04','H06','BRANCH_UNION_ADMIN','BRANCH_UNION_CHAIRMAN')
AND m.`permission` IN ('staffTherapyRecuperation','staffTherapyRecuperation.line','staffTherapyRecuperation.TheBaseManagement','staffTherapyRecuperation.lineFghSelect','staffTherapyRecuperation.lineSelectionOverview','staffTherapyRecuperation.lineCluster','staffTherapyRecuperation.line.adjustment','staffTherapyRecuperation.TheRapyAudit','staffTherapyRecuperation.TheRapyTravelAudit','staffTherapyRecuperation.TheRapyQuery')
AND m.`permission` IN ('inclusiveTherapyV3','inclusiveTherapyV3.line','inclusiveTherapyV3.TheBaseManagement','inclusiveTherapyV3.lineFghSelect','inclusiveTherapyV3.lineSelectionOverview','inclusiveTherapyV3.lineCluster','inclusiveTherapyV3.line.adjustment','inclusiveTherapyV3.TheRapyAudit','inclusiveTherapyV3.TheRapyTravelAudit','inclusiveTherapyV3.TheRapyQuery')
AND NOT EXISTS (SELECT 1 FROM `sys_role_menu` rel WHERE rel.`roleId`=r.`id` AND rel.`menuId`=m.`id`);
INSERT INTO `sys_role_menu` (`roleId`,`menuId`)
SELECT r.`id`,m.`id` FROM `sys_role` r CROSS JOIN `sys_menu` m
WHERE r.`disabled`=0 AND r.`code` IN ('public','PUBLIC','MEMBER','sysadmin','superadmin','SYSADMIN')
AND m.`permission` IN ('staffTherapyRecuperation','staffTherapyRecuperation.signup','staffTherapyRecuperation.mobile')
AND m.`permission` IN ('inclusiveTherapyV3','inclusiveTherapyV3.signup','inclusiveTherapyV3.mobile')
AND NOT EXISTS (SELECT 1 FROM `sys_role_menu` rel WHERE rel.`roleId`=r.`id` AND rel.`menuId`=m.`id`);
COMMIT;