package entity

import (
	. "app.yhyue.com/moapp/jybase/common"
	. "bp.jydev.jianyu360.cn/BaseService/resourceCenter/public/db"
)

var Base_goods_spec = base_goods_spec{}

//商品规格表
type base_goods_spec struct {
	Id                     int64
	Appid                  string
	Name                   string //规格名称
	Cycle                  string //周期
	Calculation_type       int64  //权益计算类型
	Base_goods_spec_powers []*base_goods_spec_power
}

//根据代码查找功能详情
func (b *base_goods_spec) FindById(id int64, appid, goodsCode string) *[]*base_goods_spec {
	bgss := Mysql_BaseService.SelectBySql(`select * from base_goods_spec where id=? and appid=? and goods_code=? limit 1`, id, appid, goodsCode)
	list := JsonUnmarshal(*bgss, &[]*base_goods_spec{}).(*[]*base_goods_spec)
	if list != nil {
		for _, v := range *list {
			v.Base_goods_spec_powers = *Base_goods_spec_power.FindByGoodsCode(v.Id, v.Appid, goodsCode)
		}
	}
	return list
}
