123456789101112131415161718192021222324252627282930313233343536373839 |
- package models
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- // CompanyEndDate 客户产品结束日期表(临时表,只是用来做同步同花顺的截止日期使用)
- type CompanyEndDate struct {
- Id int `description:"自增id"`
- CompanyId int `description:"客户id"`
- ProductId int `description:"产品id"`
- Status string `description:"客户状态:试用,永续,冻结,流失,正式,潜在"`
- EndDate time.Time `description:"结束日期"`
- CreateTime time.Time `description:"记录生成时间"`
- }
- // GetAllCompanyProductEndDate 根据获取客户结束日期表列表(临时表,只是用来做同步同花顺的截止日期使用)
- func GetAllCompanyProductEndDate(startDate, endDate string) (list []*CompanyEndDate, err error) {
- o := orm.NewOrm()
- sql := ` SELECT * from company_end_date WHERE create_time >= ? and create_time < ? `
- _, err = o.Raw(sql, startDate, endDate).QueryRows(&list)
- return
- }
- // GetCompanyEndDate 查询客户产品结束日期记录
- func GetCompanyEndDate(createTime string) (item *CompanyEndDate, err error) {
- o := orm.NewOrm()
- sql := ` SELECT * from company_end_date WHERE create_time > ? limit 1`
- err = o.Raw(sql, createTime).QueryRow(&item)
- return
- }
- // AddCompanyEndDate 添加客户产品结束日期记录
- func AddCompanyEndDate(companyEndDate *CompanyEndDate) (err error) {
- o := orm.NewOrm()
- _, err = o.Insert(companyEndDate)
- return
- }
|