Skip to content

Commit

Permalink
DEV UPDATE:Resolved #34
Browse files Browse the repository at this point in the history
  • Loading branch information
misakajimmy committed Mar 8, 2023
1 parent 9fee312 commit 2b48172
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
5 changes: 5 additions & 0 deletions internal/app/api/idl/bilbil_video.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ type NewBilibiliVideo struct {
TagList pq.StringArray `gorm:"column:tag_list;type:varchar(64)[]"`
}

// TableName EoefansVideoPageBanner 表名
func (NewBilibiliVideo) TableName() string {
return "bilbil_video"
}

type BilibiliVideoOrder string

const (
Expand Down
17 changes: 9 additions & 8 deletions internal/app/api/idl/eoefans_video_page.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package idl

import (
"github.com/google/uuid"
"gorm.io/gorm"
"time"
)
Expand Down Expand Up @@ -66,14 +67,14 @@ func (EoefansVideoPageBanner) TableName() string {

type EoefansVideoPageVideo struct {
GVA_MODEL
BilbilVideo NewBilibiliVideo `json:"video" form:"video" gorm:"foreignKey:BilbilVideoUUID"`
BilbilVideoUUID string `json:"videoId" form:"videoId" gorm:"column:bilbil_video_id"`
EoefansVideoPages EoefansVideoPages `json:"vPage" form:"vPage" gorm:"foreignKey:EoefansVideoPageId"`
EoefansVideoPageId uint `json:"pageId" form:"pageId"`
Rank uint `json:"rank" form:"rank"`
CreatedBy uint `gorm:"column:created_by;comment:创建者"`
UpdatedBy uint `gorm:"column:updated_by;comment:更新者"`
DeletedBy uint `gorm:"column:deleted_by;comment:删除者"`
NewBilibiliVideo NewBilibiliVideo `json:"video" form:"video" gorm:"foreignKey:NewBilibiliVideoUUID"`
NewBilibiliVideoUUID uuid.UUID `json:"videoId" form:"videoId" gorm:"column:bilbil_video_id"`
EoefansVideoPages EoefansVideoPages `json:"vPage" form:"vPage" gorm:"foreignKey:EoefansVideoPageId"`
EoefansVideoPageId uint `json:"pageId" form:"pageId"`
Rank uint `json:"rank" form:"rank"`
CreatedBy uint `gorm:"column:created_by;comment:创建者"`
UpdatedBy uint `gorm:"column:updated_by;comment:更新者"`
DeletedBy uint `gorm:"column:deleted_by;comment:删除者"`
}

// TableName EoefansVideoPageBanner 表名
Expand Down
2 changes: 1 addition & 1 deletion internal/repository/eoefans_video_page.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ func (impl *EoefansVideoPageMysqlImpl) FindAll() (list []*idl.EoefansVideoPageRe
Find(&bannerList).Error
fmt.Println("aaaaaaaaaaaaa")
err = impl.tx.Table(idl.EoefansVideoPageVideo{}.TableName()).
Preload("BilbilVideo").
Where("eoefans_video_page_id = ?", pageList[i].ID).
Preload("NewBilibiliVideo").
//Joins("JOIN bilbil_video ON bilbil_video.id = eoefans_video_page_video.bilbil_video_id").
//Select("rank").
Find(&videoList).Error
Expand Down

0 comments on commit 2b48172

Please sign in to comment.