This commit is contained in:
2024-09-11 13:20:33 +08:00
parent af6c39f5f0
commit c44a1e565b
4 changed files with 40 additions and 2 deletions
+9
View File
@@ -28,6 +28,15 @@ func (r *ArticleAuthorDao) GetArticleAuthorPreloadById(AuthorId int64) (m *model
return m, nil
}
// GetArticleAuthorListPreloadByAuthorId 获取数据-列表-文章id
func (r *ArticleAuthorDao) GetArticleAuthorListPreloadByAuthorId(articleId int64) (m []*model.ArticleAuthor, err error) {
err = global.Db.Preload(clause.Associations).Where("article_id = ?", articleId).Find(&m).Error
if err != nil {
return nil, err
}
return m, nil
}
// DeleteArticleAuthor 删除
func (r *ArticleAuthorDao) DeleteArticleAuthor(tx *gorm.DB, maps interface{}) error {
err := tx.Where(maps).Delete(&model.ArticleAuthor{}).Error
+9
View File
@@ -28,6 +28,15 @@ func (r *VideoAuthorDao) GetVideoAuthorPreloadById(authorId int64) (m *model.Vid
return m, nil
}
// GetVideoAuthorListPreloadByVideoId 获取数据-列表-视频id
func (r *VideoAuthorDao) GetVideoAuthorListPreloadByVideoId(videoId int64) (m []*model.VideoAuthor, err error) {
err = global.Db.Preload(clause.Associations).Where("video_id = ?", videoId).Find(&m).Error
if err != nil {
return nil, err
}
return m, nil
}
// DeleteVideoAuthor 删除
func (r *VideoAuthorDao) DeleteVideoAuthor(tx *gorm.DB, maps interface{}) error {
err := tx.Where(maps).Delete(&model.VideoAuthor{}).Error