package crm import "hongze/fms_api/global" // ContractServiceAndDetail 合同的服务内容 type ContractServiceAndDetail struct { ContractServiceId int `description:"套餐ID"` ContractId int `description:"合同id"` ProductId int `description:"产品id,1:ficc;2:权益"` ServiceTemplateId int `description:"合同服务模板id"` Pid int `json:"pid" description:"父级ID"` Title string `description:"套餐标题"` Value string `description:"套餐的值"` HasDetail string `description:"是否有详情,枚举值:是、否;默认:否"` TableValue string `description:"表格数据,用于word生成时的json数据"` ChartPermissionId int `description:"权限id"` ChartPermissionIds []int `description:"小套餐-权限IDs"` DetailList []*ContractServiceDetail } type ContractServiceAndDetailQueryItem struct { ContractServiceId int `description:"套餐ID"` ContractId int `description:"合同id"` ProductId int `description:"产品id,1:ficc;2:权益"` ServiceTemplateId int `description:"合同服务模板id"` Pid int `json:"pid" description:"父级ID"` Title string `description:"套餐标题"` Value string `description:"套餐的值"` HasDetail string `description:"是否有详情,枚举值:是、否;默认:否"` TableValue string `description:"表格数据,用于word生成时的json数据"` ChartPermissionId int `description:"权限id"` } func GetContractServiceAndDetailList(contractId int) (list []*ContractServiceAndDetailRespItem, err error) { results := make([]*ContractServiceAndDetailQueryItem, 0) list = make([]*ContractServiceAndDetailRespItem, 0) query := global.MYSQL["report"]. Table("contract_service"). Where("contract_id = ?", contractId) err = query.Find(&results).Error if err != nil { return } for i := range results { list = append(list, &ContractServiceAndDetailRespItem{ ContractServiceId: results[i].ContractServiceId, ContractId: results[i].ContractId, ProductId: results[i].ProductId, ServiceTemplateId: results[i].ServiceTemplateId, Pid: results[i].Pid, Title: results[i].Title, Value: results[i].Value, HasDetail: results[i].HasDetail, TableValue: results[i].TableValue, ChartPermissionId: results[i].ChartPermissionId, }) } return } // ContractServiceAndDetailRespItem type ContractServiceAndDetailRespItem struct { ContractServiceId int `description:"套餐ID"` ContractId int `description:"合同id"` ProductId int `description:"产品id,1:ficc;2:权益"` ServiceTemplateId int `description:"合同服务模板id"` Pid int `json:"pid" description:"父级ID"` Title string `description:"套餐标题"` Value string `description:"套餐的值"` HasDetail string `description:"是否有详情,枚举值:是、否;默认:否"` TableValue string `description:"表格数据,用于word生成时的json数据"` ChartPermissionId int `description:"权限id"` ChartPermissionIds []int `description:"小套餐-权限IDs"` FMSServiceTemplateId int `description:"fms里的模版id"` FMSServiceTemplatePId int `description:"fms里的父级模版id"` FMSTitle string `description:"fms里的模版名称"` FMSPTitle string `description:"fms里的父级模版名称"` DetailList []*ContractServiceDetail }