package contract

import (
	"github.com/beego/beego/v2/client/orm"
	"time"
)

//合同的服务内容
type ContractService struct {
	ContractServiceId int       `orm:"column(contract_service_id);pk"`
	ContractId        int       `description:"合同id"`
	ProductId         int       `description:"产品id，1：ficc；2：权益"`
	ServiceTemplateId int       `description:"合同服务模板id"`
	Title             string    `description:"套餐名称"`
	Value             string    `description:"套餐的值"`
	HasDetail         string    `description:"是否有详情，枚举值：是、否；默认：否"`
	CreateTime        time.Time `description:"合同添加时间"`
}

//合同的服务内容
type ContractServiceAndDetail struct {
	ContractServiceId int    `orm:"column(contract_service_id);pk"`
	ContractId        int    `description:"合同id"`
	ProductId         int    `description:"产品id，1：ficc；2：权益"`
	ServiceTemplateId int    `description:"合同服务模板id"`
	Title             string `description:"套餐标题"`
	Value             string `description:"套餐的值"`
	HasDetail         string `description:"是否有详情，枚举值：是、否；默认：否"`
	ChartPermissionId int    `description:"权限id"`
}

//获取合同列表数据
func GetContractServiceAndDetailList(contractId int) (list []*ContractServiceAndDetail, err error) {
	o := orm.NewOrm()
	sql := "select * from contract_service where contract_id = ?  "
	_, err = o.Raw(sql, contractId).QueryRows(&list)
	return
}
