@oj-module/cli 0.2.66 → 0.2.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/.oj-version +1 -0
- package/bin/oj +4 -0
- package/devkit/README.md +15 -7
- package/devkit/SKILL.md +38 -4
- package/devkit/framework-dev.md +10 -4
- package/devkit/manual.md +146 -24
- package/devkit/menu-rules.md +19 -4
- package/devkit/module-dev-and-cdn-playground.md +4 -0
- package/devkit/publish-walkthrough.md +132 -37
- package/devkit/wecom-internal-app.md +8 -3
- package/devkit/wecom-multi-corp-links.md +163 -0
- package/package.json +2 -2
- package/shell-dist/assets/{index.i0kqbxp050.js → index.6alqyx6ae0.js} +21 -1
- package/shell-dist/assets/{runtime.1xfsxcajj0.js → runtime.1xzahckt10.js} +4863 -4847
- package/shell-dist/index.html +4 -4
- package/shell-dist/versions.json +3 -3
- package/src/__tests__/cli.test.ts +31 -0
- package/src/__tests__/new-scaffold.test.ts +13 -0
- package/src/__tests__/publish-keygen.test.ts +157 -0
- package/src/__tests__/templates-migration-schema-parity.test.ts +540 -0
- package/src/__tests__/templates-schema-columns.test.ts +15 -2
- package/src/__tests__/templates-tenant-scope.test.ts +6 -2
- package/src/build/module-def.ts +1 -0
- package/src/builtin.ts +3 -2
- package/src/bundle.ts +8 -3
- package/src/cli.ts +21 -5
- package/src/dev.ts +15 -10
- package/src/init.ts +47 -41
- package/src/install.ts +11 -4
- package/src/keygen.ts +54 -0
- package/src/lifecycle/__tests__/bundle.test.ts +21 -3
- package/src/lifecycle/__tests__/fixtures/fixture-valid/api/src/demo-solution/manifest.yaml +1 -1
- package/src/lifecycle/__tests__/fixtures/fixture-valid/api/src/demo-solution/migrations/0001__init.sql +2 -2
- package/src/lifecycle/__tests__/fixtures/fixture-valid/api/src/demo-solution/schema.yaml +5 -2
- package/src/lifecycle/__tests__/fixtures/fixture-valid/manifest.yaml +1 -1
- package/src/lifecycle/__tests__/manifest-contract.test.ts +75 -3
- package/src/lifecycle/__tests__/smoke.test.ts +2 -2
- package/src/manifest-contract.ts +91 -8
- package/src/market/bootstrap.ts +26 -2
- package/src/market/command.ts +1 -0
- package/src/market/publish.ts +8 -1
- package/src/market/walkthrough.ts +24 -8
- package/src/new.ts +2 -0
- package/src/scaffold-guard.ts +227 -0
- package/src/site.ts +2 -0
- package/src/usage.ts +13 -9
- package/src/vendor.ts +5 -1
- package/templates/config.yaml +4 -2
- package/templates/init.include.yaml +10 -3
- package/templates/openapi.json +460 -1
- package/templates/src/README.md +37 -0
- package/templates/src/app/api/_platform/_lifecycle/compensate.ts +136 -0
- package/templates/src/app/api/_platform/_lifecycle/installer.ts +78 -25
- package/templates/src/app/api/_platform/_lifecycle/lock.ts +23 -0
- package/templates/src/app/api/_platform/_lifecycle/steps/deploy-web.ts +28 -0
- package/templates/src/app/api/_platform/_lifecycle/steps/preflight.ts +46 -0
- package/templates/src/app/api/_platform/_lifecycle/steps/reload.ts +100 -36
- package/templates/src/app/api/_platform/_lifecycle/steps/smoke.ts +7 -15
- package/templates/src/app/api/_platform/_lifecycle/text-edit.ts +71 -19
- package/templates/src/app/api/_platform/_lifecycle/types.ts +26 -2
- package/templates/src/app/api/_platform/_lifecycle/uninstall.ts +93 -14
- package/templates/src/app/api/_platform/_shared/service/domain/settings.ts +8 -4
- package/templates/src/app/api/_platform/_shared/service/domain/solution-perms.ts +25 -10
- package/templates/src/app/api/_platform/manifest.yaml +1 -0
- package/templates/src/app/api/_platform/market/api.ts +235 -10
- package/templates/src/app/api/_platform/migrations/0001__baseline.mysql.sql +178 -0
- package/templates/src/app/api/_platform/migrations/0001__baseline.pg.sql +173 -0
- package/templates/src/app/api/_platform/migrations/0001__baseline.sql +188 -0
- package/templates/src/app/api/_platform/migrations/0002__market_release.mysql.sql +17 -0
- package/templates/src/app/api/_platform/migrations/0002__market_release.pg.sql +16 -0
- package/templates/src/app/api/_platform/migrations/0002__market_release.sql +33 -0
- package/templates/src/app/api/_platform/schema.yaml +18 -0
- package/templates/src/app/api/_platform/seed.mysql.sql +10 -0
- package/templates/src/app/api/_platform/seed.pg.sql +10 -0
- package/templates/src/app/api/auth/_shared/wecom/client.ts +24 -4
- package/templates/src/app/api/home/migrations/0001__create_home_tables.mysql.sql +14 -0
- package/templates/src/app/api/home/migrations/0001__create_home_tables.pg.sql +14 -0
- package/templates/src/app/api/home/migrations/0002__tenant.pg.sql +4 -0
- package/templates/src/app/api/home/seed.mysql.sql +71 -0
- package/templates/src/app/api/home/seed.pg.sql +71 -0
- package/templates/src/app/api/notification/_shared/notify.ts +6 -6
- package/templates/src/app/api/notification/migrations/0001__create_notifications.mysql.sql +11 -0
- package/templates/src/app/api/notification/migrations/0001__create_notifications.pg.sql +11 -0
- package/templates/src/app/api/notification/migrations/0002__notifications_user.mysql.sql +8 -0
- package/templates/src/app/api/notification/migrations/0003__notifications_broadcast.mysql.sql +21 -0
- package/templates/src/app/api/notification/migrations/0003__notifications_broadcast.pg.sql +22 -0
- package/templates/src/app/api/notification/migrations/0004__notifications_broadcast_hidden.mysql.sql +10 -0
- package/templates/src/app/api/notification/migrations/0004__notifications_broadcast_hidden.pg.sql +11 -0
- package/templates/src/app/api/notification/migrations/0005__tenant.pg.sql +6 -0
- package/templates/src/app/api/notification/seed.mysql.sql +8 -0
- package/templates/src/app/api/notification/seed.pg.sql +11 -0
- package/templates/src/app/api/publish/_shared/identity.ts +69 -0
- package/templates/src/app/api/publish/api.ts +349 -0
- package/templates/src/app/api/publish/manifest.yaml +8 -0
- package/templates/src/app/api/publish/migrations/0001__publish_credential.mysql.sql +23 -0
- package/templates/src/app/api/publish/migrations/0001__publish_credential.pg.sql +23 -0
- package/templates/src/app/api/publish/migrations/0001__publish_credential.sql +39 -0
- package/templates/src/app/api/publish/schema.yaml +33 -0
- package/templates/src/app/api/system/login-methods/api.ts +2 -1
- package/templates/src/app/web/_platform/__client/api.schemas.ts +15 -0
- package/templates/src/app/web/_platform/__client/index.ts +25 -1
- package/templates/src/app/web/entry.ts +9 -5
- package/templates/src/app/web/home/routes.ts +5 -0
- package/templates/src/app/web/login/locales/en-US.json +7 -1
- package/templates/src/app/web/login/locales/zh-CN.json +7 -1
- package/templates/src/app/web/login/pages/login.tsx +79 -86
- package/templates/src/app/web/login/routes.ts +54 -1
- package/templates/src/app/web/personal-center/locales/en-US.json +1 -0
- package/templates/src/app/web/personal-center/locales/zh-CN.json +1 -0
- package/templates/src/app/web/personal-center/pages/my-profile/index.tsx +5 -0
- package/templates/src/app/web/system/__client/api.schemas.ts +2 -1
- package/templates/src/app/web/system/locales/en-US.json +1 -8
- package/templates/src/app/web/system/locales/zh-CN.json +1 -8
- package/templates/src/app/web/system/pages/settings/index.tsx +17 -4
- package/templates/src/app/web/system/routes.ts +0 -6
- package/templates/src/oj-market/web/__tests__/CardGrid.test.tsx +33 -0
- package/templates/src/oj-market/web/__tests__/DetailDrawer.test.tsx +69 -0
- package/templates/src/oj-market/web/__tests__/marketClient.fake.ts +7 -1
- package/templates/src/oj-market/web/api/client.ts +3 -0
- package/templates/src/oj-market/web/api/defaultClient.ts +5 -0
- package/templates/src/oj-market/web/components/CardItem.tsx +44 -1
- package/templates/src/oj-market/web/components/DetailDrawer.tsx +17 -1
- package/templates/src/oj-market/web/entry.ts +31 -2
- package/templates/src/oj-market/web/locales/en-US.json +5 -1
- package/templates/src/oj-market/web/locales/zh-CN.json +5 -1
- package/templates/src/oj-market/web/publish/__client/api.schemas.ts +61 -0
- package/templates/src/oj-market/web/publish/__client/index.ts +164 -0
- package/templates/src/oj-market/web/publish/locales/en-US.json +80 -0
- package/templates/src/oj-market/web/publish/locales/zh-CN.json +80 -0
- package/templates/src/oj-market/web/publish/pages/history.tsx +112 -0
- package/templates/src/oj-market/web/publish/pages/index.tsx +196 -0
- package/templates/src/oj-market/web/publish/pages/model.ts +52 -0
- package/templates/src/oj-market/web/publish/pages/token-modal.tsx +82 -0
- package/templates/src/oj-market/web/publish/routes.ts +41 -0
- package/templates/src/oj-market/web/types.ts +30 -0
- package/templates/tests/lifecycle/compensate.spec.ts +207 -0
- package/templates/tests/lifecycle/deploy-smoke.spec.ts +38 -14
- package/templates/tests/lifecycle/installer.spec.ts +28 -9
- package/templates/tests/lifecycle/market-api.spec.ts +164 -12
- package/templates/tests/lifecycle/preflight.spec.ts +68 -0
- package/templates/tests/lifecycle/register.spec.ts +22 -0
- package/templates/tests/lifecycle/role-title-translate.spec.ts +4 -34
- package/templates/tests/lifecycle/text-edit.spec.ts +45 -27
- package/templates/tests/lifecycle/uninstall.spec.ts +36 -0
- package/templates/tests/publish-credential.spec.ts +354 -0
- package/templates/tests/publish-identity.spec.ts +44 -0
- package/templates/tests/rbac-solution-perms.spec.ts +48 -3
- package/templates/tests/wecom-client-timeout.spec.ts +33 -3
- package/templates/tests/wecom-landing.spec.ts +63 -1
- package/templates/tsconfig.paths.json +1 -0
- package/templates/web.config.ts +8 -4
- package/vendor/host-versions.json +3 -3
- package/templates/seed.mysql.sql +0 -6
- package/templates/seed.pg.sql +0 -6
- package/templates/src/app/api/_platform/migrations/0001__create_users.mysql.sql +0 -9
- package/templates/src/app/api/_platform/migrations/0001__create_users.pg.sql +0 -9
- package/templates/src/app/api/_platform/migrations/0001__create_users.sql +0 -7
- package/templates/src/app/api/_platform/migrations/0002__add_users_avatar_base64.mysql.sql +0 -3
- package/templates/src/app/api/_platform/migrations/0002__add_users_avatar_base64.sql +0 -2
- package/templates/src/app/api/_platform/migrations/0003__users_source_display_name.mysql.sql +0 -5
- package/templates/src/app/api/_platform/migrations/0003__users_source_display_name.sql +0 -5
- package/templates/src/app/api/_platform/migrations/0004__sys_rbac.mysql.sql +0 -70
- package/templates/src/app/api/_platform/migrations/0004__sys_rbac.pg.sql +0 -67
- package/templates/src/app/api/_platform/migrations/0004__sys_rbac.sql +0 -67
- package/templates/src/app/api/_platform/migrations/0005__users_must_change.mysql.sql +0 -3
- package/templates/src/app/api/_platform/migrations/0005__users_must_change.sql +0 -2
- package/templates/src/app/api/_platform/migrations/0006__users_is_forbidden.mysql.sql +0 -3
- package/templates/src/app/api/_platform/migrations/0006__users_is_forbidden.sql +0 -3
- package/templates/src/app/api/_platform/migrations/0007__users_email.sql +0 -3
- package/templates/src/app/api/_platform/migrations/0008__sys_refresh_token.mysql.sql +0 -10
- package/templates/src/app/api/_platform/migrations/0008__sys_refresh_token.pg.sql +0 -10
- package/templates/src/app/api/_platform/migrations/0008__sys_refresh_token.sql +0 -11
- package/templates/src/app/api/_platform/migrations/0009__sys_throttle.mysql.sql +0 -12
- package/templates/src/app/api/_platform/migrations/0009__sys_throttle.pg.sql +0 -12
- package/templates/src/app/api/_platform/migrations/0009__sys_throttle.sql +0 -13
- package/templates/src/app/api/_platform/migrations/0010__sys_solution_route.mysql.sql +0 -17
- package/templates/src/app/api/_platform/migrations/0010__sys_solution_route.pg.sql +0 -16
- package/templates/src/app/api/_platform/migrations/0010__sys_solution_route.sql +0 -18
- package/templates/src/app/api/_platform/migrations/0011__sys_setting_group_label.mysql.sql +0 -2
- package/templates/src/app/api/_platform/migrations/0011__sys_setting_group_label.sql +0 -4
- package/templates/src/app/api/_platform/migrations/0012__market_history.mysql.sql +0 -13
- package/templates/src/app/api/_platform/migrations/0012__market_history.pg.sql +0 -12
- package/templates/src/app/api/_platform/migrations/0012__market_history.sql +0 -14
- package/templates/src/app/api/_platform/migrations/0013__users_profile.sql +0 -4
- package/templates/src/app/api/_platform/migrations/0014__reg_source_seq.mysql.sql +0 -9
- package/templates/src/app/api/_platform/migrations/0014__reg_source_seq.pg.sql +0 -7
- package/templates/src/app/api/_platform/migrations/0014__reg_source_seq.sql +0 -8
- package/templates/src/app/api/_platform/migrations/0015__tenant.mysql.sql +0 -12
- package/templates/src/app/api/_platform/migrations/0015__tenant.pg.sql +0 -11
- package/templates/src/app/api/_platform/migrations/0015__tenant.sql +0 -44
- package/templates/src/app/api/_platform/migrations/0016__org.mysql.sql +0 -41
- package/templates/src/app/api/_platform/migrations/0016__org.pg.sql +0 -40
- package/templates/src/app/api/_platform/migrations/0016__org.sql +0 -62
- package/templates/src/app/api/_platform/migrations/0017__users_employee_no.mysql.sql +0 -7
- package/templates/src/app/api/_platform/migrations/0017__users_employee_no.pg.sql +0 -4
- package/templates/src/app/api/_platform/migrations/0017__users_employee_no.sql +0 -8
- package/templates/src/app/api/_platform/migrations/0018__sys_role_title_key.mysql.sql +0 -3
- package/templates/src/app/api/_platform/migrations/0018__sys_role_title_key.pg.sql +0 -3
- package/templates/src/app/api/_platform/migrations/0018__sys_role_title_key.sql +0 -8
- package/templates/src/app/web/system/pages/login-methods/index.tsx +0 -30
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
-- 0016__org(postgres 方言):组织架构领域。表定性与列语义同 0016__org.sql 头注释。
|
|
2
|
-
-- 差异(沿用 0001__create_users.pg.sql 的既有惯例):
|
|
3
|
-
-- · AUTOINCREMENT → BIGSERIAL(SERIAL 系允许 seed 显式 id,GENERATED ALWAYS 系不允许);
|
|
4
|
-
-- · TEXT 在 pg 合法,键列与文本列一律保留 TEXT,无需收窄;
|
|
5
|
-
-- · 秒级 epoch 的 INTEGER → BIGINT。
|
|
6
|
-
CREATE TABLE IF NOT EXISTS sys_department (
|
|
7
|
-
id BIGSERIAL PRIMARY KEY,
|
|
8
|
-
tenant_id TEXT NOT NULL,
|
|
9
|
-
origin TEXT NOT NULL DEFAULT 'local',
|
|
10
|
-
origin_id TEXT NOT NULL,
|
|
11
|
-
parent_id BIGINT,
|
|
12
|
-
name TEXT,
|
|
13
|
-
name_en TEXT,
|
|
14
|
-
order_no INTEGER NOT NULL DEFAULT 0,
|
|
15
|
-
sync_visible INTEGER NOT NULL DEFAULT 1,
|
|
16
|
-
deleted INTEGER NOT NULL DEFAULT 0,
|
|
17
|
-
seen_job_id BIGINT,
|
|
18
|
-
update_time BIGINT NOT NULL,
|
|
19
|
-
UNIQUE (tenant_id, origin, origin_id)
|
|
20
|
-
);
|
|
21
|
-
CREATE INDEX IF NOT EXISTS idx_sys_department_parent ON sys_department (tenant_id, parent_id, deleted, order_no);
|
|
22
|
-
|
|
23
|
-
CREATE TABLE IF NOT EXISTS sys_dept_member (
|
|
24
|
-
id BIGSERIAL PRIMARY KEY,
|
|
25
|
-
tenant_id TEXT NOT NULL,
|
|
26
|
-
user_id BIGINT NOT NULL,
|
|
27
|
-
dept_id BIGINT NOT NULL,
|
|
28
|
-
order_no INTEGER NOT NULL DEFAULT 0,
|
|
29
|
-
is_leader INTEGER NOT NULL DEFAULT 0,
|
|
30
|
-
is_main INTEGER NOT NULL DEFAULT 0,
|
|
31
|
-
update_time BIGINT NOT NULL,
|
|
32
|
-
UNIQUE (tenant_id, user_id, dept_id)
|
|
33
|
-
);
|
|
34
|
-
CREATE INDEX IF NOT EXISTS idx_sys_dept_member_dept ON sys_dept_member (tenant_id, dept_id, order_no);
|
|
35
|
-
CREATE INDEX IF NOT EXISTS idx_sys_dept_member_user ON sys_dept_member (tenant_id, user_id, is_main);
|
|
36
|
-
|
|
37
|
-
ALTER TABLE users ADD COLUMN activated INTEGER NOT NULL DEFAULT 0;
|
|
38
|
-
ALTER TABLE users ADD COLUMN position TEXT;
|
|
39
|
-
ALTER TABLE users ADD COLUMN external_status INTEGER;
|
|
40
|
-
UPDATE users SET activated = 1;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
-- 0016__org(sqlite 方言):组织架构领域(CRUD 基线 + 外部源适配器的落点)
|
|
2
|
-
--
|
|
3
|
-
-- 两张表都是**租户表**(tenant: true):组织架构天然按租户隔离(企微部署下 tenant_id = corp_id),
|
|
4
|
-
-- 只在有租户上下文时被读写,与 users / sys_oplog 同组(0015 A 组口径)。
|
|
5
|
-
-- 故**不**进 config.yaml 的 tenant.shared_allow——那里只放全局映射/凭证。
|
|
6
|
-
--
|
|
7
|
-
-- 定位(方案 §14:CRUD 是基线,企微 / LDAP 只是适配器):
|
|
8
|
-
-- · 表里不出现任何 wecom_* / ldap_* 字段,来源只由 origin 表达;
|
|
9
|
-
-- · origin 是**归属权**标识(D13):local = 本站管理员全权可 CRUD;
|
|
10
|
-
-- wecom / ldap / sso = 该适配器管辖,同步与回收只作用于自己 origin 的行。
|
|
11
|
-
--
|
|
12
|
-
-- 列的来源语义:
|
|
13
|
-
-- origin_id 外部源主键(企微部门 id / LDAP entryUUID);origin='local' 时由应用层生成稳定串
|
|
14
|
-
-- parent_id 本地父部门 id(不是外部 id)——本地部门与同步部门可混挂,且不随外部调整而变
|
|
15
|
-
-- name 未获权限时为 NULL(企微代开发未授权「部门名」即如此),展示层用 origin_id 兜底
|
|
16
|
-
-- sync_visible 同步可见性,**仅由同步轮次维护**(失去可见范围 → 0),本地部门恒 1
|
|
17
|
-
-- deleted 软删除。**只由外部源的删除事件置 1**(D9):本地删除走真删,见 §14.4-②
|
|
18
|
-
-- seen_job_id 最近一次完整全量命中的 job,用于墓碑回收(回收前必先校验本轮完整且无 skip)
|
|
19
|
-
CREATE TABLE IF NOT EXISTS sys_department (
|
|
20
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
21
|
-
tenant_id TEXT NOT NULL,
|
|
22
|
-
origin TEXT NOT NULL DEFAULT 'local',
|
|
23
|
-
origin_id TEXT NOT NULL,
|
|
24
|
-
parent_id INTEGER,
|
|
25
|
-
name TEXT,
|
|
26
|
-
name_en TEXT,
|
|
27
|
-
order_no INTEGER NOT NULL DEFAULT 0,
|
|
28
|
-
sync_visible INTEGER NOT NULL DEFAULT 1,
|
|
29
|
-
deleted INTEGER NOT NULL DEFAULT 0,
|
|
30
|
-
seen_job_id INTEGER,
|
|
31
|
-
update_time INTEGER NOT NULL,
|
|
32
|
-
UNIQUE (tenant_id, origin, origin_id)
|
|
33
|
-
);
|
|
34
|
-
CREATE INDEX IF NOT EXISTS idx_sys_department_parent ON sys_department (tenant_id, parent_id, deleted, order_no);
|
|
35
|
-
|
|
36
|
-
-- 成员 ↔ 部门(多对多):企微一个人可在多个部门,order / is_leader 与 department[] 逐位对应。
|
|
37
|
-
-- 全本地 id 关联(user_id + dept_id),**与来源完全无关**,接任何适配器都不用改这张表。
|
|
38
|
-
CREATE TABLE IF NOT EXISTS sys_dept_member (
|
|
39
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
40
|
-
tenant_id TEXT NOT NULL,
|
|
41
|
-
user_id INTEGER NOT NULL,
|
|
42
|
-
dept_id INTEGER NOT NULL,
|
|
43
|
-
order_no INTEGER NOT NULL DEFAULT 0,
|
|
44
|
-
is_leader INTEGER NOT NULL DEFAULT 0,
|
|
45
|
-
is_main INTEGER NOT NULL DEFAULT 0,
|
|
46
|
-
update_time INTEGER NOT NULL,
|
|
47
|
-
UNIQUE (tenant_id, user_id, dept_id)
|
|
48
|
-
);
|
|
49
|
-
CREATE INDEX IF NOT EXISTS idx_sys_dept_member_dept ON sys_dept_member (tenant_id, dept_id, order_no);
|
|
50
|
-
CREATE INDEX IF NOT EXISTS idx_sys_dept_member_user ON sys_dept_member (tenant_id, user_id, is_main);
|
|
51
|
-
|
|
52
|
-
-- users 扩列(三列都是与源无关的通用字段)
|
|
53
|
-
-- activated 是否登录过本站。同步会为「从未登录」的全员建档,若不加这道闸门,
|
|
54
|
-
-- contacts 目录(60 次/分、keyword≥2)可被用来遍历拖走整份企业名册(§9.1)
|
|
55
|
-
-- position 职务(本地 / LDAP / 企微都能填)
|
|
56
|
-
-- external_status 外部源侧的状态快照(企微 1/2/4/5)。**绝不自动改写 is_forbidden**——
|
|
57
|
-
-- 那会和本站管理员的手动启停互相覆盖(§4.3)
|
|
58
|
-
ALTER TABLE users ADD COLUMN activated INTEGER NOT NULL DEFAULT 0;
|
|
59
|
-
ALTER TABLE users ADD COLUMN position TEXT;
|
|
60
|
-
ALTER TABLE users ADD COLUMN external_status INTEGER;
|
|
61
|
-
-- 存量账号一律视为已激活:保持 contacts 的既有行为不变(它此前本就返回全部 users)
|
|
62
|
-
UPDATE users SET activated = 1;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
-- 0017__users_employee_no(mysql 方言):工号列 + 租户内唯一。列语义同 0017__users_employee_no.sql 头注释。
|
|
2
|
-
-- 差异(沿用 0015__tenant.mysql.sql 惯例):
|
|
3
|
-
-- · 键列不能用 TEXT 落唯一键 → 按业务长度收窄为 VARCHAR(64);
|
|
4
|
-
-- · 无部分索引 → 普通唯一键,NULL 在 MySQL 里可重复出现,效果等同「有值才唯一」;
|
|
5
|
-
-- · (255 + 64) × 4B = 1276B < InnoDB 3072B 上限。
|
|
6
|
-
ALTER TABLE users ADD COLUMN employee_no VARCHAR(64) NULL;
|
|
7
|
-
ALTER TABLE users ADD UNIQUE KEY uk_users_employee_no (tenant_id, employee_no);
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
-- 0017__users_employee_no(postgres 方言):工号列 + 租户内唯一。列语义同 0017__users_employee_no.sql 头注释。
|
|
2
|
-
-- 差异(沿用 0016__org.pg.sql 惯例):TEXT 在 pg 合法且可用于部分唯一索引,无需收窄类型。
|
|
3
|
-
ALTER TABLE users ADD COLUMN employee_no TEXT;
|
|
4
|
-
CREATE UNIQUE INDEX IF NOT EXISTS uk_users_employee_no ON users (tenant_id, employee_no) WHERE employee_no IS NOT NULL;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
-- 0017__users_employee_no(sqlite 方言):工号列 + 租户内唯一
|
|
2
|
-
--
|
|
3
|
-
-- 为什么单开一列而不是复用 display_name / 外部 origin_id:用户 CSV 导入导出要与源系统
|
|
4
|
-
-- 9 列表头完全互通,「工号」必须是独立可查字段。
|
|
5
|
-
-- 可空是必需的:存量本地账号没有工号,外部同步号也可能不带;唯一性只在有值时有意义,
|
|
6
|
-
-- 故用部分索引(sqlite/pg 都支持 WHERE),mysql 侧靠「NULL 可重复」的唯一键等效。
|
|
7
|
-
ALTER TABLE users ADD COLUMN employee_no TEXT;
|
|
8
|
-
CREATE UNIQUE INDEX IF NOT EXISTS uk_users_employee_no ON users (tenant_id, employee_no) WHERE employee_no IS NOT NULL;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
-- 0018__sys_role_title_key(sqlite 方言):角色显示名双列(R2,计划 docs/plans/20261103-0948-role-title-translate)。
|
|
2
|
-
-- title = 安装期解析文本(站点默认语言);title_key = 原始 i18n key(UI 实时翻译锚,
|
|
3
|
-
-- 对齐 sys_permission.title_key 先例)。可空:内置角色与 custom 角色无 key。
|
|
4
|
-
-- 回填口径:builtin=0 且 title 命中裸 key 形状。sqlite 无 REGEXP → GLOB '[a-z]*:*'
|
|
5
|
-
-- (首字符小写字母 + 含冒号的近似);真实数据里含冒号的 title 只可能是裸 key
|
|
6
|
-
-- (内置中文/管理员文本不含冒号),pg/mysql 两侧用完整正则同义钉死。
|
|
7
|
-
ALTER TABLE sys_role ADD COLUMN title_key TEXT;
|
|
8
|
-
UPDATE sys_role SET title_key = title WHERE builtin = 0 AND title GLOB '[a-z]*:*';
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { useQuery } from "@tanstack/react-query";
|
|
2
|
-
import { Card, Descriptions, Tag } from "antd";
|
|
3
|
-
import { useTranslation } from "react-i18next";
|
|
4
|
-
|
|
5
|
-
import { systemLoginMethodsGet } from "../../__client";
|
|
6
|
-
|
|
7
|
-
const METHOD_KEY: Record<string, string> = {
|
|
8
|
-
local: "system:loginMethodsPage.methodLocal",
|
|
9
|
-
ldap: "system:loginMethodsPage.methodLdap",
|
|
10
|
-
sso: "system:loginMethodsPage.methodSso",
|
|
11
|
-
wecom: "system:loginMethodsPage.methodWecom",
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
/** 登录方式发现(C5/D2,只读):local 恒在,ldap/sso/wecom 由设置项开关。 */
|
|
15
|
-
export default function LoginMethodsPage() {
|
|
16
|
-
const { t } = useTranslation();
|
|
17
|
-
const query = useQuery({ queryKey: ["system", "login-methods"], queryFn: systemLoginMethodsGet });
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<Card loading={query.isLoading} title={t("system:loginMethodsPage.title")}>
|
|
21
|
-
<Descriptions column={1}>
|
|
22
|
-
<Descriptions.Item label={t("system:menu.loginMethods")}>
|
|
23
|
-
{(query.data?.methods ?? []).map(m => (
|
|
24
|
-
<Tag key={m}>{METHOD_KEY[m] ? t(METHOD_KEY[m]) : m}</Tag>
|
|
25
|
-
))}
|
|
26
|
-
</Descriptions.Item>
|
|
27
|
-
</Descriptions>
|
|
28
|
-
</Card>
|
|
29
|
-
);
|
|
30
|
-
}
|