feat (infra): add filter data that only have children
This commit is contained in:
@@ -55,6 +55,16 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.In
|
||||
|
||||
plh.SearchCodeOrName(input.Search, tx)
|
||||
|
||||
if input.OnlyHaveChildren {
|
||||
tx = tx.Where(`
|
||||
EXISTS (
|
||||
SELECT 1
|
||||
FROM "Infra" c
|
||||
WHERE c."Parent_Id" = "Infra"."Id"
|
||||
)
|
||||
`)
|
||||
}
|
||||
|
||||
tx = tx.
|
||||
Model(&e.Infra{}).
|
||||
Scopes(gh.Filter(input.FilterDto)).
|
||||
|
||||
Reference in New Issue
Block a user