package models import ( "github.com/beego/beego/v2/client/orm" "time" ) type CygxUserAdminShareCode struct { UserAdminCodeId int `orm:"column(user_admin_share_code_id);pk";comment:"主键ID"` SellerName string `comment:"所属销售"` SellerId int `comment:"所属销售id"` Mobile string `comment:"手机号"` CreateTime time.Time `comment:"创建时间"` ModifyTime time.Time `comment:"修改时间"` ShareCode string `comment:"分享码,对seller_id进行MD5加密的结果"` } // 获取数量 func GetCygxUserAdminShareCodeByShareCodeCount(chareCode string) (count int, err error) { o := orm.NewOrm() sqlCount := ` SELECT COUNT(1) AS count FROM cygx_user_admin_share_code WHERE share_code = ? ` err = o.Raw(sqlCount, chareCode).QueryRow(&count) return } func AddCygxUserAdminShareCode(item *CygxUserAdminShareCode) (err error) { o := orm.NewOrm() _, err = o.Insert(item) return } func GetUserAdminShareCodeByShareCode(shareCode string) (item *CygxUserAdminShareCode, err error) { o := orm.NewOrm() sql := ` SELECT * FROM cygx_user_admin_share_code WHERE share_code = ? ` err = o.Raw(sql, shareCode).QueryRow(&item) return }