zhangzengfei
2023-09-05 63645d248c765244488cd34dbc1bb6528ca6b7c7
system-service/models/sysInit.go
@@ -1,48 +1,48 @@
package models
type SysInit struct {
   InitPwd      bool   `gorm:"column:initPwd;default:false" json:"initPwd"` //是否已配置过登录密码
   InitUsername string `gorm:"column:initUsername" json:"initUsername"`     //初始化的用户名
   NetName      string `gorm:"column:netName" json:"netName"`               //网络名称
   UserType     string `gorm:"column:userType" json:"userType"`             //个人:personal  公司: company
   PhoneNum     string `gorm:"column:phoneNum" json:"phoneNum"`             //手机号码
   Name         string `gorm:"column:name" json:"name"`                     //姓名或公司名称
   ProvinceId   string `gorm:"column:provinceId" json:"provinceId"`         //省
   CityId       string `gorm:"column:cityId" json:"cityId"`                 //市
   CountyId     string `gorm:"column:countyId" json:"countyId"`             //县
   Email        string `gorm:"column:email" json:"email"`                   //邮箱
   InitTime     string `gorm:"column:initTime" json:"initTime"`             //初始化时间
}
func (SysInit) TableName() string {
   return "sys_init"
}
func (ds *SysInit) Insert() bool {
   result := db.Table(ds.TableName()).Create(&ds)
   if result.Error == nil && result.RowsAffected > 0 {
      return true
   }
   return false
}
func (ds *SysInit) Update() bool {
   result := db.Table(ds.TableName()).Update(&ds)
   if result.Error == nil && result.RowsAffected > 0 {
      return true
   }
   return false
}
func (ds *SysInit) Select() (int64, error) {
   result := db.Table(ds.TableName()).First(&ds)
   return result.RowsAffected, result.Error
}
func (ds *SysInit) DeleteById() bool {
   result := db.Exec("delete from " + ds.TableName() + "")
   if result.Error == nil && result.RowsAffected > 0 {
      return true
   }
   return false
}
package models
type SysInit struct {
   InitPwd      bool   `gorm:"column:initPwd;default:false" json:"initPwd"` //是否已配置过登录密码
   InitUsername string `gorm:"column:initUsername" json:"initUsername"`     //初始化的用户名
   NetName      string `gorm:"column:netName" json:"netName"`               //网络名称
   UserType     string `gorm:"column:userType" json:"userType"`             //个人:personal  公司: company
   PhoneNum     string `gorm:"column:phoneNum" json:"phoneNum"`             //手机号码
   Name         string `gorm:"column:name" json:"name"`                     //姓名或公司名称
   ProvinceId   string `gorm:"column:provinceId" json:"provinceId"`         //省
   CityId       string `gorm:"column:cityId" json:"cityId"`                 //市
   CountyId     string `gorm:"column:countyId" json:"countyId"`             //县
   Email        string `gorm:"column:email" json:"email"`                   //邮箱
   InitTime     string `gorm:"column:initTime" json:"initTime"`             //初始化时间
}
func (SysInit) TableName() string {
   return "sys_init"
}
func (ds *SysInit) Insert() bool {
   result := db.Table(ds.TableName()).Create(&ds)
   if result.Error == nil && result.RowsAffected > 0 {
      return true
   }
   return false
}
func (ds *SysInit) Update() bool {
   result := db.Table(ds.TableName()).Update(&ds)
   if result.Error == nil && result.RowsAffected > 0 {
      return true
   }
   return false
}
func (ds *SysInit) Select() (int64, error) {
   result := db.Table(ds.TableName()).First(&ds)
   return result.RowsAffected, result.Error
}
func (ds *SysInit) DeleteById() bool {
   result := db.Exec("delete from " + ds.TableName() + "")
   if result.Error == nil && result.RowsAffected > 0 {
      return true
   }
   return false
}