go-gorm / playground

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

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

Closed shangyin2024 closed 7 months ago

shangyin2024 commented 7 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