go-gorm / playground

GORM Playground (Please Create PR for this project to report issues)
MIT License
88 stars 666 forks source link

joins 关联表没有自动对软删除进行过滤 #724

Closed shangyin2024 closed 3 months ago

shangyin2024 commented 3 months ago

使用join关联查询数据时候发现关联表没有自动过滤掉软删除的数据

代码:

    err := DB.Debug().Model(artistModel).
        Select([]string{"artists.name"}).
        Joins("left join song_artists on artists.id = song_artists.artist_id").
        Where("song_artists.song_id = ?", songID).
        Scan(artistsNameArr).Error