应用集成平台服务端
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.
 
 
 

66 lines
2.6 KiB

package modelshr
import (
"appPlatform/overall"
"strings"
)
// 排班记录
type TeamsRules struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;index"`
RuleTypeId int64 `json:"ruleTypeId" gorm:"column:ruleTypeId;type:bigint(20) unsigned;default:0;not null;comment:排班制度ID"`
RuleTypeName string `json:"ruleTypeName" gorm:"column:ruleTypeName;type:varchar(255);comment:制度名称"`
Cycle int `json:"cycle" gorm:"column:cycle;type:int(4) unsigned;default:1;not null;comment:周期类型"`
TeamsId int64 `json:"teamsId" gorm:"column:teamsId;type:bigint(20) unsigned;default:0;not null;comment:班组Id"`
TeamsName string `json:"teamsName" gorm:"column:teamsName;type:varchar(255);comment:班组姓名"`
CycleSort int64 `json:"cycleSort" gorm:"column:cycleSort;type:int(4) unsigned;default:1;not null;comment:周期排序"`
CycleName string `json:"cycleName" gorm:"column:cycleName;type:varchar(255);comment:周期名称"`
CycleWorkTime int64 `json:"cycleWorkTime" gorm:"column:cycleWorkTime;type:bigint(20) unsigned;default:0;not null;comment:工作时间段Id"`
CycleWorkName string `json:"cycleWorkName" gorm:"column:cycleWorkName;type:varchar(255);comment:工作时间段名称"`
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:编辑时间"`
}
func (TeamsRules *TeamsRules) TableName() string {
return "teams_rules"
}
// 编辑内容
func (cont *TeamsRules) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Updates(saveData).Error
return
}
// 获取内容
func (cont *TeamsRules) 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 *TeamsRules) CountCont(whereMap interface{}) (countId int64) {
overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Count(&countId)
return
}
// 读取全部信息
func (cont *TeamsRules) ContMap(whereMap interface{}, field ...string) (countAry []TeamsRules, 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 *TeamsRules) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_HR.Where(whereMap).Delete(&cont).Error
return
}