user_seller_relation.go 1.6 KB

12345678910111213141516171819202122232425262728
  1. package models
  2. import (
  3. "eta_gn/eta_api/global"
  4. "time"
  5. )
  6. type UserSellerRelation struct {
  7. RelationId int64 `gorm:"column:relation_id;primaryKey;type:bigint" orm:"column(relation_id);pk" description:"关系ID"`
  8. UserId int `gorm:"column:user_id;type:int" orm:"column(user_id)" description:"用户ID"`
  9. CompanyId int `gorm:"column:company_id;type:int" orm:"column(company_id)" description:"企业用户ID"`
  10. SellerId int `gorm:"column:seller_id;type:int" orm:"column(seller_id)" description:"销售ID"`
  11. Seller string `gorm:"column:seller;type:varchar(255)" orm:"column(seller)" description:"销售员名称"`
  12. ProductId int `gorm:"column:product_id;type:int" orm:"column(product_id)" description:"产品ID"`
  13. Mobile string `gorm:"column:mobile;type:varchar(255)" orm:"column(mobile)" description:"手机号"`
  14. Email string `gorm:"column:email;type:varchar(255)" orm:"column(email)" description:"邮箱"`
  15. ModifyTime time.Time `gorm:"column:modify_time;type:datetime" orm:"column(modify_time)" description:"修改时间"`
  16. CreateTime time.Time `gorm:"column:create_time;type:datetime" orm:"column(create_time)" description:"创建时间"`
  17. }
  18. // DeleteUserSellerRelationByProductId 根据产品id删除销售员与员工的关系
  19. func DeleteUserSellerRelationByProductId(userId, productId int) (err error) {
  20. //o := orm.NewOrmUsingDB("weekly")
  21. sql := ` DELETE FROM user_seller_relation WHERE user_id=? and product_id = ?`
  22. //_, err = o.Raw(sql, userId, productId).Exec()
  23. err = global.DmSQL["weekly"].Exec(sql, userId, productId).Error
  24. return
  25. }