-
数据库一些列的值能否自动获取文档里的数据
2024-06-24 16:22大佬,可以根据标题序号获取所属文档的对应标题吗,数据库长这样 章节是数据列
我让 gpt4 写都搞不定
```go .action{ $d := .章节 | int } .action{ $blocks := queryBlocks "SELECT root_id FROM blocks WHERE id='?'" .id } .action{ if not (empty $blocks) } .action{ $rootID := (first $blocks).root_id } .action{ $chapters := queryBlocks "SELECT * FROM blocks WHERE root_id = '?' AND type = 'h1' AND subtype = 'h1'" $rootID } .action{ $currentChapter := 1 } .action{ $title := "" } .action{ range $chapters } .action{ if eq $currentChapter $d } .action{ $title = .Content } .action{ end } .action{ $currentChapter = add $currentChapter 1 } .action{ end } .action{ if ne $title "" } .action{ $title } .action{ else } 无 .action{ end } .action{ end }