package models import ( "github.com/beego/beego/v2/client/orm" "time" ) type CompanyProduct struct { CompanyProductId int `orm:"column(company_product_id);pk" description:"客户产品id"` CompanyId int `description:"客户id"` ProductId int `description:"产品id"` ProductName string `description:"产品名称"` CompanyName string `description:"客户名称"` Source string `description:"来源"` Reasons string `description:"新增理由"` Status string `description:"客户状态"` IndustryId int `description:"行业id"` IndustryName string `description:"行业名称"` SellerId int `description:"销售id"` SellerName string `description:"销售名称"` GroupId int `description:"销售分组id"` DepartmentId int `description:"销售部门id"` IsSuspend int `description:"1:暂停,0:启用"` SuspendTime time.Time `description:"暂停启用时间"` TryOutTime time.Time `description:"正式转试用时间"` RenewalReason string `description:"正式转试用后的续约情况说明"` LastDescriptionTime time.Time `description:"上次添加说明时间"` RenewalIntention int `description:"是否勾选无续约意向,1:确认,0:未确认"` ApproveStatus string `description:"审批状态:'审批中','通过','驳回'"` FreezeTime time.Time `description:"冻结时间"` FreezeReason time.Time `description:"冻结理由"` Remark string `description:"备注信息"` CreateTime time.Time `description:"创建时间"` ModifyTime time.Time `description:"修改时间"` StartDate string `description:"开始日期"` EndDate string `description:"结束日期"` ContractEndDate time.Time `description:"合同结束日期"` LoseReason string `description:"流失原因"` LossTime time.Time `description:"流失时间"` CompanyType string `description:"客户类型"` OpenCode string `description:"开放给第三方的编码,不让第三方定位我们的客户信息"` } // 获取列表 func GetCompanyProductList(condition string, pars []interface{}) (items []*CompanyProduct, err error) { o := orm.NewOrmUsingDB("weekly_report") sql := `SELECT * FROM company_product WHERE 1= 1 ` if condition != "" { sql += condition } _, err = o.Raw(sql, pars).QueryRows(&items) return } func GetCompanyProductDetailByCompanyId(companyId, productId int) (item *CompanyProduct, err error) { sql := ` SELECT * FROM company_product WHERE company_id = ? AND product_id = ?; ` o := orm.NewOrmUsingDB("weekly_report") err = o.Raw(sql, companyId, productId).QueryRow(&item) return }