rai_serve_week_bill.go 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. package rai_serve
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type CygxRaiServeWeekBill struct {
  7. ServeWeekBillId int `orm:"column(serve_week_bill_id);pk" description:"服务周账单ID"`
  8. CompanyId int `comment:"公司ID"`
  9. CompanyName string `comment:"公司名称"`
  10. UserTotal int `comment:"用户数量"`
  11. WeekServeCount float64 `comment:"周度服务量总计"`
  12. CoverageRate float64 `comment:"覆盖率"`
  13. WeekStartDate string `comment:"周一开始日期"`
  14. WeekEndDate string `comment:"周日结束日期"`
  15. CreateTime time.Time `comment:"创建时间"`
  16. ModifyTime time.Time `comment:"修改时间"`
  17. }
  18. // AddCygxRaiServeWeekBillMulti 批量添加
  19. func AddCygxRaiServeWeekBillMulti(items []*CygxRaiServeWeekBill) (err error) {
  20. if len(items) == 0 {
  21. return
  22. }
  23. o, err := orm.NewOrm().Begin()
  24. if err != nil {
  25. return
  26. }
  27. defer func() {
  28. if err == nil {
  29. o.Commit()
  30. } else {
  31. o.Rollback()
  32. }
  33. }()
  34. if len(items) > 0 {
  35. //批量添加流水信息
  36. _, err = o.InsertMulti(len(items), items)
  37. }
  38. return
  39. }
  40. // 列表
  41. func GetCygxRaiServeWeekBillListAll(condition string, pars []interface{}) (items []*CygxRaiServeWeekBill, err error) {
  42. if condition == "" {
  43. return
  44. }
  45. o := orm.NewOrm()
  46. sql := `SELECT * FROM cygx_rai_serve_week_bill WHERE 1= 1 `
  47. if condition != "" {
  48. sql += condition
  49. }
  50. _, err = o.Raw(sql, pars).QueryRows(&items)
  51. return
  52. }