|
|
|
@ -32,7 +32,16 @@ func (c *Category) AfterQuery(session basedboperat.DbTransactionSession) {
|
|
|
|
Children: c.Children,
|
|
|
|
Children: c.Children,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
c.Children = findChildren(cs, session)
|
|
|
|
children := findChildren(cs, session)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
c.Id = children[0].Id
|
|
|
|
|
|
|
|
c.Image = children[0].Image
|
|
|
|
|
|
|
|
c.Description = children[0].Description
|
|
|
|
|
|
|
|
c.Name = children[0].Name
|
|
|
|
|
|
|
|
c.Type = children[0].Type
|
|
|
|
|
|
|
|
c.Pid = children[0].Pid
|
|
|
|
|
|
|
|
c.Weigh = children[0].Weigh
|
|
|
|
|
|
|
|
c.Children = children[0].Children
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -49,12 +58,9 @@ func findChildren(categories []Category, session basedboperat.DbTransactionSessi
|
|
|
|
Operator: "=",
|
|
|
|
Operator: "=",
|
|
|
|
Value: category.Id,
|
|
|
|
Value: category.Id,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
session.ListScan(&list, category, children)
|
|
|
|
session.ListScan(&list, &category, &children) // 传递切片的指针
|
|
|
|
category.Children = findChildren(children, session)
|
|
|
|
category.Children = findChildren(children, session)
|
|
|
|
result = append(result, category)
|
|
|
|
result = append(result, category)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result
|
|
|
|
return result
|
|
|
|
}
|
|
|
|
}
|
|
|
|
func (c *Category) TreeList(session basedboperat.DbTransactionSession) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|