package teamlog import ( "appPlatform/overall" "strings" ) // 排班记录 type TeamsLog struct { Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;index"` OrgId int64 `json:"orgId" gorm:"column:orgId;type:bigint(20) unsigned;default:0;not null;comment:班组ID"` TeamsTime int64 `json:"teamsTime" gorm:"column:teamsTime;type:bigint(20) unsigned;default:0;not null;comment:日期"` IsmId int64 `json:"ismId" gorm:"column:ismId;type:bigint(20) unsigned;default:0;not null;comment:制度ID"` RankId int64 `json:"rankId" gorm:"column:rankId;type:bigint(20) unsigned;default:0;not null;comment:班次"` RulesId int64 `json:"rulesId" gorm:"column:rulesId;type:bigint(20) unsigned;default:0;not null;comment:轮询规则Id"` TeamsId int64 `json:"teamsId" gorm:"column:teamsId;type:bigint(20) unsigned;default:0;not null;comment:班组id"` Days int `json:"days" gorm:"column:days;type:int(4) unsigned;default:0;not null;comment:日"` Months int `json:"months" gorm:"column:months;type:int(4) unsigned;default:0;not null;comment:月"` Years int `json:"years" gorm:"column:years;type:int(6) unsigned;default:0;not null;comment:年"` Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:编辑时间"` IsmName string `json:"ismName" gorm:"column:ismName;type:varchar(255);comment:制度名称"` RankName string `json:"rankName" gorm:"column:rankName;type:varchar(255);comment:班次名称"` RulesName string `json:"rulesName" gorm:"column:rulesName;type:varchar(255);comment:轮询班组"` Sort int `json:"sort" gorm:"column:sort;type:int(6) unsigned;default:0;not null;comment:轮询排序"` } func (TeamsLog *TeamsLog) TableName() string { return "teamsLog" } // 编辑内容 func (cont *TeamsLog) EiteCont(whereMap interface{}, saveData interface{}) (err error) { err = overall.CONSTANT_DB_TeamsLog.Model(&cont).Where(whereMap).Updates(saveData).Error return } // 获取内容 func (cont *TeamsLog) GetCont(whereMap interface{}, field ...string) (err error) { gormDb := overall.CONSTANT_DB_TeamsLog.Model(&cont) if len(field) > 0 { fieldStr := strings.Join(field, ",") gormDb = gormDb.Select(fieldStr) } gormDb = gormDb.Where(whereMap) err = gormDb.First(&cont).Error return } // 根据条件获取总数 func (cont *TeamsLog) CountCont(whereMap interface{}) (countId int64) { overall.CONSTANT_DB_TeamsLog.Model(&cont).Where(whereMap).Count(&countId) return } // 读取全部信息 func (cont *TeamsLog) ContMap(whereMap interface{}, field ...string) (countAry []TeamsLog, err error) { gormDb := overall.CONSTANT_DB_TeamsLog.Model(&cont) if len(field) > 0 { fieldStr := strings.Join(field, ",") gormDb = gormDb.Select(fieldStr) } err = gormDb.Where(whereMap).Find(&countAry).Error return } // 删除内容 func (cont *TeamsLog) DelCont(whereMap interface{}) (err error) { err = overall.CONSTANT_DB_TeamsLog.Where(whereMap).Delete(&cont).Error return }