rai_company_user_bill.go 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. package rai_serve
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. // 权益服务明细表
  7. type CygxRaiCompanyUserBill struct {
  8. BillId int `orm:"column(bill_id);pk" description:"服务明细主键ID"`
  9. Content string `comment:"服务内容说明"`
  10. ServeTypeId int `comment:"服务类型ID"`
  11. ServeTypeName string `comment:"服务类型"`
  12. UserId int `comment:"用户ID"`
  13. Mobile string `comment:"手机号"`
  14. Email string `comment:"邮箱"`
  15. CompanyId int `comment:"公司ID"`
  16. CompanyName string `comment:"公司名称"`
  17. RealName string `comment:"用户实际名称"`
  18. RegisterPlatform int `comment:"来源 1小程序,2:网页"`
  19. ServeCount float64 `comment:"服务量小计"`
  20. IsKp int `comment:"是否是KP,1:是、0:否"`
  21. SourceId int `comment:"来源ID"`
  22. Source string `comment:"来源 "`
  23. WeekStartDate string `comment:"周一开始日期"`
  24. WeekEndDate string `comment:"周日结束日期"`
  25. ChartPermissionId int `description:"行业id"`
  26. ChartPermissionName string `description:"行业名称"`
  27. CreateTime time.Time `comment:"创建时间"`
  28. ViewTime string `comment:"浏览时间"`
  29. }
  30. // 列表
  31. func GetCygxRaiCompanyUserBillListAll(condition string, pars []interface{}) (items []*CygxRaiCompanyUserBill, err error) {
  32. if condition == "" {
  33. return
  34. }
  35. o := orm.NewOrm()
  36. sql := `SELECT * FROM cygx_rai_company_user_bill WHERE 1= 1 `
  37. if condition != "" {
  38. sql += condition
  39. }
  40. _, err = o.Raw(sql, pars).QueryRows(&items)
  41. return
  42. }
  43. // AddCygxRaiCompanyUserBilllMulti 批量添加
  44. func AddCygxRaiCompanyUserBilllMulti(items []*CygxRaiCompanyUserBill) (err error) {
  45. if len(items) == 0 {
  46. return
  47. }
  48. o, err := orm.NewOrm().Begin()
  49. if err != nil {
  50. return
  51. }
  52. defer func() {
  53. if err == nil {
  54. o.Commit()
  55. } else {
  56. o.Rollback()
  57. }
  58. }()
  59. if len(items) > 0 {
  60. //批量添加流水信息
  61. _, err = o.InsertMulti(len(items), items)
  62. }
  63. return
  64. }