This commit is contained in:
simonzhangsz committed 2023-09-07 10:47:34 +08:00
1 parent 51a9c29a6f
commit c2aadc123b
29 files changed
+4183

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
## EMS Database
---
### 1. Relationship of menu, account, account_menu, title_info
![1679033737734](image/database/1679033737734.png)
通过多表联合查询可一次性获取某个账号的目录结果:
example, acouunt name='manager', lang-key='cn':
```sql
SELECT m.id, json_unquote(json_extract(t.title_json, '$.en')) as title, m.parent_id, m.sort_id FROM title_info t, menu m WHERE m.id IN (SELECT am.menu_id FROM account_menu am WHERE am.account_id = (SELECT id FROM account WHERE name='manager')) AND m.title_id = t.id ORDER BY m.id
```