contract_service_template.go 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. package contract_service_template
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "hongze/hongze_mobile_admin/models/tables/contract_service_detail"
  5. "time"
  6. )
  7. type ContractServiceTemplate struct {
  8. ServiceTemplateId int `orm:"column(service_template_id);pk"`
  9. ProductId string `description:"产品id"`
  10. Pid int `description:"父级id"`
  11. Title string `description:"套餐名称"`
  12. Value string `description:"对应的数据"`
  13. SelectType string `description:"选择器类型,单选还是多选,radio;单选:checkbox"`
  14. SelectName string `description:"选择器名称"`
  15. TableValue string `description:"表格数据,用于word生成时的json数据"`
  16. Remark string `description:"表头备注"`
  17. CreateTime time.Time `description:"创建时间"`
  18. ModifyTime time.Time `description:"修改时间"`
  19. }
  20. type ContractServiceTemplateMapItems struct {
  21. ServiceTemplateId int `orm:"column(service_template_id);pk"`
  22. ProductId string `description:"产品id"`
  23. Pid int `description:"父级id"`
  24. Title string `description:"套餐名称"`
  25. Value string `description:"对应的数据"`
  26. SelectType string `description:"选择器类型,单选还是多选,radio;单选:checkbox"`
  27. SelectName string `description:"选择器名称"`
  28. Children []*ContractServiceTemplateMapItems
  29. Detail []*contract_service_detail.ContractServiceDetail
  30. }
  31. //根据服务模板id获取合同模板详情
  32. func GetContractServiceTemplateById(contractServiceTemplateId int) (contractServiceTemplate *ContractServiceTemplate, err error) {
  33. o := orm.NewOrm()
  34. sql := `select * from contract_service_template where service_template_id = ? `
  35. err = o.Raw(sql, contractServiceTemplateId).QueryRow(&contractServiceTemplate)
  36. return
  37. }
  38. type ContractServiceTemplateMapResp struct {
  39. FiccTemplate []*ContractServiceTemplateMapItems
  40. RiaTemplate []*ContractServiceTemplateMapItems
  41. }
  42. func GetContractServiceTemplateMapByProductId(productId int) (items []*ContractServiceTemplateMapItems, err error) {
  43. o := orm.NewOrm()
  44. sql := ` SELECT * FROM contract_service_template WHERE product_id=? and pid=0`
  45. _, err = o.Raw(sql, productId).QueryRows(&items)
  46. return
  47. }
  48. func GetContractServiceTemplateMapByParentId(parentId int) (items []*ContractServiceTemplateMapItems, err error) {
  49. o := orm.NewOrm()
  50. sql := ` SELECT * FROM contract_service_template WHERE pid=?`
  51. _, err = o.Raw(sql, parentId).QueryRows(&items)
  52. return
  53. }
  54. //获取所有的合同套餐列表
  55. func GetAllContractServiceTemplateList() (items []*ContractServiceTemplate, err error) {
  56. o := orm.NewOrm()
  57. sql := ` SELECT * FROM contract_service_template`
  58. _, err = o.Raw(sql).QueryRows(&items)
  59. return
  60. }