contract_service.go 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. package crm
  2. import "hongze/fms_api/global"
  3. // ContractServiceAndDetail 合同的服务内容
  4. type ContractServiceAndDetail struct {
  5. ContractServiceId int `description:"套餐ID"`
  6. ContractId int `description:"合同id"`
  7. ProductId int `description:"产品id,1:ficc;2:权益"`
  8. ServiceTemplateId int `description:"合同服务模板id"`
  9. Pid int `json:"pid" description:"父级ID"`
  10. Title string `description:"套餐标题"`
  11. Value string `description:"套餐的值"`
  12. HasDetail string `description:"是否有详情,枚举值:是、否;默认:否"`
  13. TableValue string `description:"表格数据,用于word生成时的json数据"`
  14. ChartPermissionId int `description:"权限id"`
  15. ChartPermissionIds []int `description:"小套餐-权限IDs"`
  16. DetailList []*ContractServiceDetail
  17. }
  18. type ContractServiceAndDetailQueryItem struct {
  19. ContractServiceId int `description:"套餐ID"`
  20. ContractId int `description:"合同id"`
  21. ProductId int `description:"产品id,1:ficc;2:权益"`
  22. ServiceTemplateId int `description:"合同服务模板id"`
  23. Pid int `json:"pid" description:"父级ID"`
  24. Title string `description:"套餐标题"`
  25. Value string `description:"套餐的值"`
  26. HasDetail string `description:"是否有详情,枚举值:是、否;默认:否"`
  27. TableValue string `description:"表格数据,用于word生成时的json数据"`
  28. ChartPermissionId int `description:"权限id"`
  29. }
  30. func GetContractServiceAndDetailList(contractId int) (list []*ContractServiceAndDetailRespItem, err error) {
  31. results := make([]*ContractServiceAndDetailQueryItem, 0)
  32. list = make([]*ContractServiceAndDetailRespItem, 0)
  33. query := global.MYSQL["report"].
  34. Table("contract_service").
  35. Where("contract_id = ?", contractId)
  36. err = query.Find(&results).Error
  37. if err != nil {
  38. return
  39. }
  40. for i := range results {
  41. list = append(list, &ContractServiceAndDetailRespItem{
  42. ContractServiceId: results[i].ContractServiceId,
  43. ContractId: results[i].ContractId,
  44. ProductId: results[i].ProductId,
  45. ServiceTemplateId: results[i].ServiceTemplateId,
  46. Pid: results[i].Pid,
  47. Title: results[i].Title,
  48. Value: results[i].Value,
  49. HasDetail: results[i].HasDetail,
  50. TableValue: results[i].TableValue,
  51. ChartPermissionId: results[i].ChartPermissionId,
  52. })
  53. }
  54. return
  55. }
  56. // ContractServiceAndDetailRespItem
  57. type ContractServiceAndDetailRespItem struct {
  58. ContractServiceId int `description:"套餐ID"`
  59. ContractId int `description:"合同id"`
  60. ProductId int `description:"产品id,1:ficc;2:权益"`
  61. ServiceTemplateId int `description:"合同服务模板id"`
  62. Pid int `json:"pid" description:"父级ID"`
  63. Title string `description:"套餐标题"`
  64. Value string `description:"套餐的值"`
  65. HasDetail string `description:"是否有详情,枚举值:是、否;默认:否"`
  66. TableValue string `description:"表格数据,用于word生成时的json数据"`
  67. ChartPermissionId int `description:"权限id"`
  68. ChartPermissionIds []int `description:"小套餐-权限IDs"`
  69. FMSServiceTemplateId int `description:"fms里的模版id"`
  70. FMSServiceTemplatePId int `description:"fms里的父级模版id"`
  71. FMSTitle string `description:"fms里的模版名称"`
  72. FMSPTitle string `description:"fms里的父级模版名称"`
  73. DetailList []*ContractServiceDetail
  74. }