//if err := model.DB().Table("group_power_day_exp").Select("group_power_id,SUM(exp) as exp").Where("date BETWEEN ? AND ?", beginDate, endDate).Group("group_power_id")
iferr:=model.DB().Table("group_power_day_exp p").Joins(",(SELECT @curRank := 0) p").Where("date BETWEEN ? AND ?",beginDate,endDate).
Select("group_power_id,SUM(exp) as exp,@curRank := @curRank + 1 `rank`").