123456789101112131415161718192021222324252627282930313233343536 |
- package model
- import (
- "time"
- "github.com/jaryhe/gopkgs/logger"
- "github.com/jinzhu/gorm"
- "go.uber.org/zap"
- )
- type TeamInoutInfo struct {
- ID int64 `gorm:"column:ID;PRIMARY_KEY" json:"id"`
- Code string `gorm:"column:Code" json:"code"`
- TeamSysNo int `gorm:"column:TeamSysNo" json:"team_sys_no"`
- InOut int `gorm:"column:InOut" json:"in_out"`
- OccurTime time.Time `gorm:"column:OccurTime" json:"occur_time"`
- AttInfo string `gorm:"column:AttInfo" json:"att_info"`
- ProjectId int64 `gorm:"column:ProjectId" json:"project_id"`
- }
- func (TeamInoutInfo) TableName() string {
- return "db_smart_attendance.TeamInoutInfo"
- }
- // Insert 插入一条记录
- func (p *TeamInoutInfo) Insert(db *gorm.DB) error {
- err := db.Table(p.TableName()).Create(p).Error
- if err != nil {
- fields, _ := json.MarshalToString(*p)
- logger.Error("mysql",
- zap.String("sql", "insert into TeamInoutInfo"),
- zap.String("fields", fields),
- zap.String("error", err.Error()))
- }
- return err
- }
|