package group_power_cv import ( "git.hilo.cn/hilo-common/resource/mysql" "gorm.io/gorm" "hilo-group/domain/model/groupPower_m" ) func BatchGetGroupPower(db *gorm.DB, userIds []uint64) (map[uint64]uint64, map[uint64]string, error) { if len(userIds) <= 0 { return nil, nil, nil } groupPowers, err := groupPower_m.GetGroupPowerMap(db, userIds) if err != nil { return nil, nil, err } gpIds := make([]uint64, 0) for _, i := range groupPowers { gpIds = append(gpIds, i) } powerNames, err := groupPower_m.GetGroupPowerNames(db, gpIds) if err != nil { return nil, nil, err } groupPowerNames := make(map[mysql.ID]string, 0) for i, g := range groupPowers { groupPowerNames[i] = powerNames[g] } return groupPowers, groupPowerNames, nil }