group_info.go 806 Bytes
Newer Older
hujiebin's avatar
hujiebin committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
package groupPower_m

import (
	"git.hilo.cn/hilo-common/domain"
	"git.hilo.cn/hilo-common/resource/mysql"
)

type GroupPowerInfo struct {
	mysql.Entity
	GroupUid    string
	Name        string
	Nameplate   string
	Declaration string
	Icon        string
	Status      int
}

func (GroupPowerInfo) TableName() string {
	return "group_power"
}

// 批量获取家族信息
func MGetGroupPowerInfoMap(model *domain.Model, groupPowerIds []mysql.ID) (map[mysql.ID]GroupPowerInfo, error) {
	var rows []GroupPowerInfo
	res := make(map[mysql.ID]GroupPowerInfo)
	if err := model.DB().Model(GroupPowerInfo{}).Where("id in ?", groupPowerIds).Find(&rows).Error; err != nil {
		model.Log.Errorf("MGetGroupPowerInfo fail:%v", err)
		return res, err
	}
hujiebin's avatar
hujiebin committed
30 31 32
	for i, v := range rows {
		res[v.ID] = rows[i]
	}
hujiebin's avatar
hujiebin committed
33 34
	return res, nil
}