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.
62 lines
2.0 KiB
62 lines
2.0 KiB
package modelshr
|
|
|
|
import (
|
|
"appPlatform/overall"
|
|
"strings"
|
|
)
|
|
|
|
// 轮询规则
|
|
type Genesis struct {
|
|
Id int64 `gorm:"primaryKey;column:id" json:"id"` //type:int64
|
|
TypeId int64 `gorm:"column:type_id" json:"typeid"` //type:int64 comment:类型
|
|
PeriodId int64 `gorm:"column:period_id" json:"periodid"` //type:int64 comment:锚定工作段
|
|
Rules int64 `gorm:"column:rules" json:"rules"` //type:int64 comment:锚定轮询规则起点
|
|
StartTime int64 `gorm:"column:start_time" json:"starttime"` //type:int64 comment:锚定历史原点
|
|
Time int64 `gorm:"column:time" json:"time"` //type:int64
|
|
OrgId int64 `gorm:"column:orgId" json:"orgId"` //type:int64 行政组织Id
|
|
}
|
|
|
|
func (Genesis *Genesis) TableName() string {
|
|
return "genesis"
|
|
}
|
|
|
|
// 编辑内容
|
|
func (cont *Genesis) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
|
|
err = overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Updates(saveData).Error
|
|
return
|
|
}
|
|
|
|
// 获取内容
|
|
func (cont *Genesis) 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 *Genesis) CountCont(whereMap interface{}) (countId int64) {
|
|
overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Count(&countId)
|
|
return
|
|
}
|
|
|
|
// 读取全部信息
|
|
func (cont *Genesis) ContMap(whereMap interface{}, field ...string) (countAry []Genesis, 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 *Genesis) DelCont(whereMap interface{}) (err error) {
|
|
err = overall.CONSTANT_DB_HR.Where(whereMap).Delete(&cont).Error
|
|
return
|
|
}
|
|
|