1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- package rai_serve
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- type CygxRaiServeWeekBill struct {
- ServeWeekBillId int `orm:"column(serve_week_bill_id);pk" description:"服务周账单ID"`
- CompanyId int `comment:"公司ID"`
- CompanyName string `comment:"公司名称"`
- UserTotal int `comment:"用户数量"`
- WeekServeCount float64 `comment:"周度服务量总计"`
- CoverageRate float64 `comment:"覆盖率"`
- WeekStartDate string `comment:"周一开始日期"`
- WeekEndDate string `comment:"周日结束日期"`
- CreateTime time.Time `comment:"创建时间"`
- ModifyTime time.Time `comment:"修改时间"`
- }
- // AddCygxRaiServeWeekBillMulti 批量添加
- func AddCygxRaiServeWeekBillMulti(items []*CygxRaiServeWeekBill) (err error) {
- if len(items) == 0 {
- return
- }
- o, err := orm.NewOrm().Begin()
- if err != nil {
- return
- }
- defer func() {
- if err == nil {
- o.Commit()
- } else {
- o.Rollback()
- }
- }()
- if len(items) > 0 {
- //批量添加流水信息
- _, err = o.InsertMulti(len(items), items)
- }
- return
- }
- // 列表
- func GetCygxRaiServeWeekBillListAll(condition string, pars []interface{}) (items []*CygxRaiServeWeekBill, err error) {
- if condition == "" {
- return
- }
- o := orm.NewOrm()
- sql := `SELECT * FROM cygx_rai_serve_week_bill WHERE 1= 1 `
- if condition != "" {
- sql += condition
- }
- _, err = o.Raw(sql, pars).QueryRows(&items)
- return
- }
|