package service import ( "XT_New/models" "github.com/jinzhu/gorm" ) func GetHomeData(adminUserId int64) (adminUser models.VMAdminUser, err error) { err = readUserDb.Model(&models.VMAdminUser{}).Where("status = 1 AND id = ?", adminUserId). Preload("Org", "status = 1"). Preload("VMApp_Role", func(db *gorm.DB) *gorm.DB { return db.Preload("Org", "status = 1").Where("status = 1") }).Find(&adminUser).Error return } func GetAllApp(org_id int64) (apps []*models.OrgApp, err error) { err = readUserDb.Model(&models.OrgApp{}).Where("status = 1 AND pid > 0 AND org_id = ?", org_id).Order("number asc").Find(&apps).Error return } func GetSystemBanner() (banners []*models.VMAdminBanner, err error) { err = readUserDb.Model(&models.VMAdminBanner{}).Where("status = 1 ").Find(&banners).Error return }