gorm的sum查询
var amount1 float64 DB.Model(&product).Debug().Where("`type` = 0 AND `category_id` = ?", cat.ID).Pluck("COALESCE(SUM(price), 0) as amount1", &amount1).Error
微信号
var amount1 float64 DB.Model(&product).Debug().Where("`type` = 0 AND `category_id` = ?", cat.ID).Pluck("COALESCE(SUM(price), 0) as amount1", &amount1).Error