knowledge_resource_file.go 655 B

12345678910111213141516171819
  1. package knowledge
  2. import "eta_gn/eta_api/global"
  3. type KnowledgeResourceFile struct {
  4. KnowledgeResourceFileId int `gorm:"column:knowledge_resource_file_id;primaryKey;autoIncrement"`
  5. KnowledgeResourceId int `gorm:"column:knowledge_resource_id"`
  6. FileUrl string `gorm:"column:file_url"`
  7. }
  8. func (k KnowledgeResourceFile) TableName() string {
  9. return "knowledge_resource_file"
  10. }
  11. func (k *KnowledgeResourceFile) GetByResourceId(id int) (item []*KnowledgeResourceFile, err error) {
  12. sql := "SELECT * FROM knowledge_resource_file WHERE knowledge_resource_id =?"
  13. err = global.DmSQL["rddp"].Raw(sql, id).Find(&item).Error
  14. return
  15. }