info_tables.go 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. package youngee_talent_service
  2. import (
  3. "youngmini_server/app/dao"
  4. "youngmini_server/app/model"
  5. "youngmini_server/app/model/youngee_talent_model"
  6. "github.com/gogf/gf/frame/g"
  7. )
  8. func GetInfoTables() *TalentHttpResult {
  9. allInfos := youngee_talent_model.InfoTables{}
  10. //Scan 将查询结果扫描到提供的变量中
  11. err := g.DB().Model(model.InfoTalentAgeBracket{}).Scan(&allInfos.AgeBracket)
  12. if err != nil {
  13. return &TalentHttpResult{Code: -1, Msg: "query age bracket failed"}
  14. }
  15. err = g.DB().Model(model.InfoTalentSkilledArea{}).Scan(&allInfos.SkilledArea)
  16. if err != nil {
  17. return &TalentHttpResult{Code: -2, Msg: "query skilled area failed"}
  18. }
  19. err = g.DB().Model(model.InfoProductType{}).Scan(&allInfos.ProductType)
  20. if err != nil {
  21. return &TalentHttpResult{Code: -3, Msg: "query product type failed"}
  22. }
  23. err = g.DB().Model(model.InfoTaskStage{}).OrderAsc(dao.InfoTaskStage.Columns.TaskStageId).Scan(&allInfos.TaskStage)
  24. if err != nil {
  25. return &TalentHttpResult{Code: -4, Msg: "query infoTask stage failed"}
  26. }
  27. err = g.DB().Model(model.InfoBank{}).Scan(&allInfos.Bank)
  28. if err != nil {
  29. return &TalentHttpResult{Code: -5, Msg: "query bank failed"}
  30. }
  31. err = g.DB().Model(model.InfoMessage{}).Scan(&allInfos.MessageInfo)
  32. if err != nil {
  33. return &TalentHttpResult{Code: -6, Msg: "query skilled area failed"}
  34. }
  35. err = g.DB().Model(model.InfoSectaskStage{}).OrderAsc(dao.InfoSectaskStage.Columns.TaskStageId).Scan(&allInfos.SecTaskStage)
  36. if err != nil {
  37. return &TalentHttpResult{Code: -7, Msg: "query InfoSectaskStage failed"}
  38. }
  39. err = g.DB().Model(dao.InfoThirdPlatform.Table).Fields(
  40. dao.InfoThirdPlatform.Columns.PlatformId,
  41. dao.InfoThirdPlatform.Columns.PlatformIcon,
  42. dao.InfoThirdPlatform.Columns.PlatformName).OrderAsc(dao.InfoThirdPlatform.Columns.PlatformId).Scan(&allInfos.ThirdPlatform)
  43. if err != nil {
  44. return &TalentHttpResult{Code: -7, Msg: "query third platform info failed"}
  45. }
  46. return &TalentHttpResult{Code: 0, Msg: "success", Data: allInfos}
  47. }