rai_company_user_bill.go 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. MonthStartDate string `comment:"月份开始日期"`
  26. MonthEndDate string `comment:"月份结束日期"`
  27. ChartPermissionId int `description:"行业id"`
  28. ChartPermissionName string `description:"行业名称"`
  29. CreateTime time.Time `comment:"创建时间"`
  30. ViewTime string `comment:"浏览时间"`
  31. }
  32. // 列表
  33. func GetCygxRaiCompanyUserBillListAll(condition string, pars []interface{}) (items []*CygxRaiCompanyUserBill, err error) {
  34. if condition == "" {
  35. return
  36. }
  37. o := orm.NewOrm()
  38. sql := `SELECT * FROM cygx_rai_company_user_bill WHERE 1= 1 `
  39. if condition != "" {
  40. sql += condition
  41. }
  42. _, err = o.Raw(sql, pars).QueryRows(&items)
  43. return
  44. }
  45. // AddCygxRaiCompanyUserBilllMulti 批量添加
  46. func AddCygxRaiCompanyUserBilllMulti(items []*CygxRaiCompanyUserBill) (err error) {
  47. if len(items) == 0 {
  48. return
  49. }
  50. o, err := orm.NewOrm().Begin()
  51. if err != nil {
  52. return
  53. }
  54. defer func() {
  55. if err == nil {
  56. o.Commit()
  57. } else {
  58. o.Rollback()
  59. }
  60. }()
  61. if len(items) > 0 {
  62. //批量添加流水信息
  63. _, err = o.InsertMulti(len(items), items)
  64. }
  65. return
  66. }