123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- package models
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- type CygxReportSelectionLogApply struct {
- ReportSelectionLogApplyId int `orm:"column(report_selection_log_apply_id);pk"`
- UserId int
- CreateTime time.Time
- Mobile string `description:"手机号"`
- Email string `description:"邮箱"`
- CompanyId int `description:"公司id"`
- CompanyName string `description:"公司名称"`
- ModifyTime time.Time `description:"修改时间"`
- RealName string `description:"用户实际名称"`
- SellerName string `description:"所属销售"`
- RegisterPlatform int `description:"来源 1小程序,2:网页"`
- ArticleId int `description:"报告Id"`
- IndustrialSubjectId int `description:"标的ID"`
- SubjectName string `description:"标的名称"`
- }
- type CygxReportSelectionLogApplyReq struct {
- ArticleId int `description:"报告Id"`
- SubjectName string `description:"标的ID"`
- }
- // 添加信息
- func AddCygxReportSelectionLogApply(item *CygxReportSelectionLogApply) (lastId int64, err error) {
- o, err := orm.NewOrm().Begin()
- if err != nil {
- return
- }
- defer func() {
- if err == nil {
- o.Commit()
- } else {
- o.Rollback()
- }
- }()
- //更新申请数量
- sql := ` UPDATE cygx_report_selection SET apply_total= 1 + apply_total WHERE article_id = ?`
- _, err = o.Raw(sql, item.ArticleId).Exec()
- if err != nil {
- return
- }
- lastId, err = o.Insert(item)
- return
- }
- // 获取数量
- func GetCygxReportSelectionLogApplyCount(condition string, pars []interface{}) (count int, err error) {
- sqlCount := ` SELECT COUNT(1) AS count FROM cygx_report_selection_log_apply as art WHERE 1= 1 `
- if condition != "" {
- sqlCount += condition
- }
- o := orm.NewOrm()
- err = o.Raw(sqlCount, pars).QueryRow(&count)
- return
- }
|