This commit is contained in:
Liang Ding 2023-02-14 10:49:03 +08:00
parent d4e3c1e660
commit d5e07318ee
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
3 changed files with 57 additions and 29 deletions

View file

@ -535,13 +535,13 @@ func GetChildBlocks(parentID, condition string) (ret []*Block) {
return
}
func GetAllChildBlocks(rootID, condition string) (ret []*Block) {
func GetAllChildBlocks(rootIDs []string, condition string) (ret []*Block) {
ret = []*Block{}
sqlStmt := "SELECT * FROM blocks AS ref WHERE ref.root_id = ?"
sqlStmt := "SELECT * FROM blocks AS ref WHERE ref.root_id IN ('" + strings.Join(rootIDs, "','") + "')"
if "" != condition {
sqlStmt += " AND " + condition
}
rows, err := query(sqlStmt, rootID)
rows, err := query(sqlStmt)
if nil != err {
logging.LogErrorf("sql query [%s] failed: %s", sqlStmt, err)
return