You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
2.3 KiB
63 lines
2.3 KiB
package modelshr
|
|
|
|
import (
|
|
"appPlatform/overall"
|
|
"strings"
|
|
)
|
|
|
|
// 工作时间段
|
|
type WorkingTimePeriod struct {
|
|
Id int64 `gorm:"primaryKey;column:id" json:"id"` //type:int64 comment: version:2022-11-13 16:59
|
|
Name string `gorm:"column:name" json:"name"` //type:string comment:工作时间段名称 version:2022-11-13 16:59
|
|
Time int64 `gorm:"column:time" json:"time"` //type:int64 comment:编辑时间;0 version:2022-11-13 16:59
|
|
TypeId int64 `gorm:"column:type_id" json:"typeid"` //type:int64 comment:类型 version:2022-11-13 16:59
|
|
StartTime string `gorm:"column:start_time" json:"starttime"` //type:string comment:开始时间 version:2022-11-13 16:59
|
|
EndTime string `gorm:"column:end_time" json:"endtime"` //type:string comment:结束时间 version:2022-11-13 16:59
|
|
State int `gorm:"column:state" json:"state"`
|
|
Sort int `gorm:"column:sort" json:"sort"` //type:*int comment:排序
|
|
}
|
|
|
|
func (WorkingTimePeriod *WorkingTimePeriod) TableName() string {
|
|
return "working_time_period"
|
|
}
|
|
|
|
// 编辑内容
|
|
func (cont *WorkingTimePeriod) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
|
|
err = overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Updates(saveData).Error
|
|
return
|
|
}
|
|
|
|
// 获取内容
|
|
func (cont *WorkingTimePeriod) GetCont(whereMap interface{}, field ...string) (err error) {
|
|
gormDb := overall.CONSTANT_DB_HR.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 *WorkingTimePeriod) CountCont(whereMap interface{}) (countId int64) {
|
|
overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Count(&countId)
|
|
return
|
|
}
|
|
|
|
// 读取全部信息
|
|
func (cont *WorkingTimePeriod) ContMap(whereMap interface{}, field ...string) (countAry []WorkingTimePeriod, err error) {
|
|
gormDb := overall.CONSTANT_DB_HR.Model(&cont)
|
|
if len(field) > 0 {
|
|
fieldStr := strings.Join(field, ",")
|
|
gormDb = gormDb.Select(fieldStr)
|
|
}
|
|
err = gormDb.Where(whereMap).Find(&countAry).Error
|
|
return
|
|
}
|
|
|
|
// 删除内容
|
|
func (cont *WorkingTimePeriod) DelCont(whereMap interface{}) (err error) {
|
|
err = overall.CONSTANT_DB_HR.Where(whereMap).Delete(&cont).Error
|
|
return
|
|
}
|
|
|