1234567891011121314151617181920212223242526272829 |
- package user
- import (
- "eta/eta_mini_ht_api/models"
- "time"
- )
- const (
- defaultColumn = "id,real_name,id_no,id_end_date,account_status"
- )
- type User struct {
- ID int `gorm:"column:id;primaryKey"`
- TemplateUserID int `gorm:"column:template_user_id"`
- RealName string `gorm:"column:real_name;size:255"`
- IDNo string `gorm:"column:id_no;size:15"`
- IDKind int `gorm:"column:id_kind"`
- IDBeginDate time.Time `gorm:"column:id_begin_date"`
- IDEndDate time.Time `gorm:"column:id_end_date"`
- AccountStatus string `gorm:"column:account_status;type:enum('unopen','opening','opened')"`
- CreatedTime time.Time `gorm:"column:created_time"`
- UpdatedTime time.Time `gorm:"column:updated_time"`
- }
- func GetUserByTemplateUserId(templateUserId int) (user User, err error) {
- db := models.Main()
- err = db.Select(defaultColumn).Where("template_user_id=?", templateUserId).First(&user).Error
- return
- }
|