package view import ( "time" "gorm.io/gorm" ) type MemberList struct { ID uint64 `json:"id"` Email string `json:"email"` Address string `json:"address"` Status string `json:"status"` Name string `json:"name"` EncVersion int `json:"enc_version"` CheckSum string `json:"check_sum"` Phone string `json:"phone"` Team string `json:"team,omitempty"` CreatedAt time.Time `json:"created_at"` } type AdministratorList struct { ID uint64 `json:"id"` Email string `json:"email"` Name string `json:"name"` Status string `json:"status"` User int `json:"user"` Collection int `json:"collection"` System int `json:"system"` Admin int `json:"admin"` Log int `json:"log"` Phone string `json:"phone"` Position string `json:"position"` Chargeof string `json:"chargeof"` Team string `json:"team"` CreatedAt time.Time `json:"created_at"` UpdateAt time.Time `json:"update_at"` } func GetMemberList(db *gorm.DB) *gorm.DB { querySet := db.Select(`user.id, user.status, user.created_at, user_profile.name, user_profile.phone, user_authentication.email, user_wallet.address, user_wallet.check_sum, user_wallet.enc_version, artist_profile.team`).Table("user"). Joins("INNER JOIN user_profile ON user_profile.user_id = user.id"). Joins("INNER JOIN user_authentication ON user_authentication.user_id = user.id"). Joins("INNER JOIN user_wallet ON user_wallet.user_id = user.id"). Joins("LEFT JOIN artist_profile ON artist_profile.user_id = user.id").Order("user.id desc") return querySet } func GetAdministorList(db *gorm.DB) *gorm.DB { querySet := db.Select(`admin.id, admin.email, admin.name, admin.status, admin_permission.user, admin_permission.collection, admin_permission.system, admin_permission.admin, admin_permission.log, admin.phone, admin.position, admin.chargeof, admin.team, admin.created_at, admin_permission.updated_at`).Table("admin"). Joins("INNER JOIN admin_permission ON admin_permission.admin_id = admin.id").Order("admin.id desc") return querySet }