contract_service_template.go 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. package contract
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type ContractServiceTemplate struct {
  7. ServiceTemplateId int `orm:"column(service_template_id);pk"`
  8. ProductId string `description:"产品id"`
  9. Pid int `description:"父级id"`
  10. Title string `description:"套餐名称"`
  11. Value string `description:"对应的数据"`
  12. SelectType string `description:"选择器类型,单选还是多选,radio;单选:checkbox"`
  13. SelectName string `description:"选择器名称"`
  14. TableValue string `description:"表格数据,用于word生成时的json数据"`
  15. Remark string `description:"表头备注"`
  16. ChartPermissionId int `description:"权限id"`
  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. ChartPermissionId int `description:"权限id"`
  29. Children []*ContractServiceTemplateMapItems
  30. Detail []*ContractServiceDetail
  31. }
  32. //根据服务模板id获取合同模板详情
  33. func GetContractServiceTemplateById(contractServiceTemplateId int) (contractServiceTemplate *ContractServiceTemplate, err error) {
  34. o := orm.NewOrm()
  35. sql := `select * from contract_service_template where service_template_id = ? `
  36. err = o.Raw(sql, contractServiceTemplateId).QueryRow(&contractServiceTemplate)
  37. return
  38. }
  39. type ContractServiceTemplateMapResp struct {
  40. FiccTemplate []*ContractServiceTemplateMapItems
  41. RiaTemplate []*ContractServiceTemplateMapItems
  42. }
  43. func GetContractServiceTemplateMapByProductId(productId int) (items []*ContractServiceTemplateMapItems, err error) {
  44. o := orm.NewOrm()
  45. sql := ` SELECT * FROM contract_service_template WHERE product_id=? and pid=0 and is_delete=0`
  46. _, err = o.Raw(sql, productId).QueryRows(&items)
  47. return
  48. }
  49. func GetContractServiceTemplateMapByParentId(parentId int) (items []*ContractServiceTemplateMapItems, err error) {
  50. o := orm.NewOrm()
  51. sql := ` SELECT * FROM contract_service_template WHERE pid=? and is_delete=0`
  52. _, err = o.Raw(sql, parentId).QueryRows(&items)
  53. return
  54. }
  55. //获取所有的合同套餐列表
  56. func GetAllContractServiceTemplateList() (items []*ContractServiceTemplate, err error) {
  57. o := orm.NewOrm()
  58. sql := ` SELECT * FROM contract_service_template`
  59. _, err = o.Raw(sql).QueryRows(&items)
  60. return
  61. }
  62. func GetContractServiceTemplateMapByChartPermissionId() (items []*ContractServiceTemplateMapItems, err error) {
  63. o := orm.NewOrm()
  64. sql := ` SELECT * FROM contract_service_template WHERE pid=999 and is_delete=0`
  65. _, err = o.Raw(sql).QueryRows(&items)
  66. return
  67. }