package contract_service_template import ( "github.com/beego/beego/v2/client/orm" "hongze/hongze_mobile_admin/models/tables/contract_service_detail" "time" ) type ContractServiceTemplate struct { ServiceTemplateId int `orm:"column(service_template_id);pk"` ProductId string `description:"产品id"` Pid int `description:"父级id"` Title string `description:"套餐名称"` Value string `description:"对应的数据"` SelectType string `description:"选择器类型,单选还是多选,radio;单选:checkbox"` SelectName string `description:"选择器名称"` TableValue string `description:"表格数据,用于word生成时的json数据"` Remark string `description:"表头备注"` CreateTime time.Time `description:"创建时间"` ModifyTime time.Time `description:"修改时间"` } type ContractServiceTemplateMapItems struct { ServiceTemplateId int `orm:"column(service_template_id);pk"` ProductId string `description:"产品id"` Pid int `description:"父级id"` Title string `description:"套餐名称"` Value string `description:"对应的数据"` SelectType string `description:"选择器类型,单选还是多选,radio;单选:checkbox"` SelectName string `description:"选择器名称"` Children []*ContractServiceTemplateMapItems Detail []*contract_service_detail.ContractServiceDetail } //根据服务模板id获取合同模板详情 func GetContractServiceTemplateById(contractServiceTemplateId int) (contractServiceTemplate *ContractServiceTemplate, err error) { o := orm.NewOrm() sql := `select * from contract_service_template where service_template_id = ? ` err = o.Raw(sql, contractServiceTemplateId).QueryRow(&contractServiceTemplate) return } type ContractServiceTemplateMapResp struct { FiccTemplate []*ContractServiceTemplateMapItems RiaTemplate []*ContractServiceTemplateMapItems } func GetContractServiceTemplateMapByProductId(productId int) (items []*ContractServiceTemplateMapItems, err error) { o := orm.NewOrm() sql := ` SELECT * FROM contract_service_template WHERE product_id=? and pid=0` _, err = o.Raw(sql, productId).QueryRows(&items) return } func GetContractServiceTemplateMapByParentId(parentId int) (items []*ContractServiceTemplateMapItems, err error) { o := orm.NewOrm() sql := ` SELECT * FROM contract_service_template WHERE pid=?` _, err = o.Raw(sql, parentId).QueryRows(&items) return } //获取所有的合同套餐列表 func GetAllContractServiceTemplateList() (items []*ContractServiceTemplate, err error) { o := orm.NewOrm() sql := ` SELECT * FROM contract_service_template` _, err = o.Raw(sql).QueryRows(&items) return }