123456789101112131415161718192021222324252627282930313233343536 |
- package english_company
- import (
- "hongze/hongze_yb_en_api/global"
- "hongze/hongze_yb_en_api/models/base"
- )
- // 英文客户表
- type Company struct {
- CompanyId uint `gorm:"primaryKey;column:company_id" json:"company_id"` //公司ID
- CompanyName string `gorm:"column:company_name" json:"company_name"` //公司名称
- CountryCode string `gorm:"column:country_code" json:"country_code"` //国家代码
- Country string `gorm:"column:country" json:"country"` //国家
- SellerId uint `gorm:"column:seller_id" json:"seller_id"` //销售ID
- SellerName string `gorm:"column:seller_name" json:"seller_name"` //销售姓名
- ViewTotal uint `gorm:"column:view_total" json:"view_total"` //累计点击量/阅读量
- IsDeleted uint8 `gorm:"column:is_deleted" json:"is_deleted"` //删除状态:0-正常;1-已删除
- base.TimeBase
- }
- // TableName get sql table name.获取数据库表名
- func (c *Company) TableName() string {
- return "english_company"
- }
- // 修改
- func (c *Company) Update(updateCols []string) (err error) {
- err = global.DEFAULT_MYSQL.Model(c).Select(updateCols).Updates(c).Error
- return
- }
- func (c *Company) UpdateViewTotalByCompanyId(companyId uint) (err error) {
- sql := `UPDATE english_company SET view_total = view_total+1 WHERE company_id = ? `
- err = global.DEFAULT_MYSQL.Exec(sql, companyId).Error
- return
- }
|