1234567891011121314151617181920212223242526272829303132333435363738 |
- package service
-
- import (
- "Xcx_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 GetCreator(id int64, orgid int64) (models.SgjUserAdminRole, error) {
- role := models.SgjUserAdminRole{}
- err := UserReadDB().Model(&role).Where("admin_user_id = ? and org_id = ? and status =1", id, orgid).Find(&role).Error
- return role, err
- }
-
- func GetSuperAdmin(id int64) (models.SgjUserAdmin, error) {
- admin := models.SgjUserAdmin{}
- err := UserReadDB().Model(&admin).Where("id=? and status =1", id).Find(&admin).Error
- return admin, err
- }
-
- 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
- }
|