contract_service_detail.go 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. package contract
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. // ContractServiceDetail 合同的服务内容详情,表单数据
  7. type ContractServiceDetail struct {
  8. Id int `orm:"column(id);pk"`
  9. ContractServiceId int `description:"合同服务id"`
  10. ContractId int `description:"合同id"`
  11. ServiceTemplateId int `description:"服务模板id"`
  12. Col1 string `orm:"column(col_1)" description:"第1列数据"`
  13. Col2 string `orm:"column(col_2)" description:"第2列数据"`
  14. Col3 string `orm:"column(col_3)" description:"第3列数据"`
  15. Col4 string `orm:"column(col_4)" description:"第4列数据"`
  16. Col5 string `orm:"column(col_5)" description:"第5列数据"`
  17. Col6 string `orm:"column(col_6)" description:"第6列数据"`
  18. Col7 string `orm:"column(col_7)" description:"第7列数据"`
  19. CreateTime time.Time `description:"数据添加时间"`
  20. }
  21. type ServiceTemplateDetailCol2 struct {
  22. CanEdit bool `json:"CanEdit"`
  23. Type string `json:"Type"`
  24. ValueId []int `json:"ValueId"`
  25. Value string `json:"Value"`
  26. HeadName string `json:"HeadName"`
  27. RowName string `json:"RowName"`
  28. }
  29. // 根据服务模板id获取对应的套餐表格数据详情
  30. func GetContractServiceDetailByTemplateId(serviceTemplateId int) (list []*ContractServiceDetail, err error) {
  31. o := orm.NewOrm()
  32. sql := `select * from contract_service_detail where service_template_id = ? and contract_service_id = 0 order by id asc`
  33. _, err = o.Raw(sql, serviceTemplateId).QueryRows(&list)
  34. return
  35. }
  36. // GetContractServiceDetailListByServiceId 根据合同服务id获取对应的套餐表格数据详情
  37. func GetContractServiceDetailListByServiceId(contractServiceId int) (list []*ContractServiceDetail, err error) {
  38. o := orm.NewOrm()
  39. sql := `select * from contract_service_detail where contract_service_id = ? order by id asc`
  40. _, err = o.Raw(sql, contractServiceId).QueryRows(&list)
  41. return
  42. }
  43. // GetContractServiceDetailListByServiceIds 根据合同服务id集合获取对应的套餐表格数据详情
  44. func GetContractServiceDetailListByServiceIds(contractServiceIds string) (list []*ContractServiceDetail, err error) {
  45. o := orm.NewOrm()
  46. sql := `select * from contract_service_detail where contract_service_id in (` + contractServiceIds + `) order by id asc`
  47. _, err = o.Raw(sql).QueryRows(&list)
  48. return
  49. }
  50. // 根据服务模板id获取对应的套餐表格数据详情
  51. func GetContractServiceDetailList() (list []*ContractServiceDetail, err error) {
  52. o := orm.NewOrm()
  53. sql := `select * from contract_service_detail order by id asc`
  54. _, err = o.Raw(sql).QueryRows(&list)
  55. return
  56. }