package modelskpi import ( "appPlatform/overall" "strings" ) // 分数流水 type ScoreFlow struct { Id int64 `json:"id" gorm:"primaryKey;column:sf_id;type:bigint(20) unsigned;not null;comment:Id"` EvaluationPlan int64 `json:"evaluationplan" gorm:"column:sf_evaluation_plan;type:bigint(20) unsigned;default:0;not null;comment:考核方案项目ID"` PlusReduceScore int `json:"plusreducescore" gorm:"column:sf_plus_reduce_score;type:tinyint(1) unsigned;default:1;not null;comment:1:加分;2:减分"` Score int64 `json:"score" gorm:"column:sf_score;type:bigint(20) unsigned;default:0;not null;comment:分值(乘100录入)"` Key int64 `json:"key" gorm:"column:sf_key;type:bigint(20) unsigned;default:0;not null;comment:识别标志"` Reason string `json:"reason" gorm:"column:sf_reason;type:mediumtext;comment:操作原因"` Content string `json:"content" gorm:"column:sf_content;type:mediumtext;comment:操作结构体"` Time int64 `json:"time" gorm:"column:sf_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` EiteTime int64 `json:"eitetime" gorm:"column:sf_eite_time;type:bigint(20) unsigned;default:0;not null;comment:修改时间"` EvaluationDepartment int64 `json:"evaluationdepartment" gorm:"column:sf_evaluation_department;type:bigint(20) unsigned;default:0;not null;comment:测评部门"` EvaluationUser int64 `json:"evaluationuser" gorm:"column:sf_evaluation_user;type:bigint(20) unsigned;default:0;not null;comment:测评人"` EvaluationGroup int64 `json:"evaluationgroup" gorm:"column:sf_evaluation_group;type:bigint(20) unsigned;default:0;not null;comment:测评集团"` Year int64 `json:"year" gorm:"column:sf_year;type:int(7) unsigned;default:0;not null;comment:年分"` Quarter int64 `json:"quarter" gorm:"column:sf_quarter;type:int(2) unsigned;default:0;not null;comment:季度"` Month int64 `json:"month" gorm:"column:sf_month;type:int(2) unsigned;default:0;not null;comment:月"` Week int64 `json:"week" gorm:"column:sf_week;type:int(5) unsigned;default:0;not null;comment:周"` Enclosure string `json:"enclosure" gorm:"column:sf_enclosure;type:longtext;comment:附件"` DutyGroup int64 `json:"dutygroup" gorm:"column:sf_duty_group;type:bigint(20) unsigned;default:0;not null;comment:职责集团"` DutyDepartment int64 `json:"dutydepartment" gorm:"column:sf_duty_department;type:bigint(20) unsigned;default:0;not null;comment:职责部门"` Reply int `json:"reply" gorm:"column:sf_reply;type:int(2) unsigned;default:1;not null;comment:状态(0:删除;1:起草;2:审批;3:通过)"` Rectification int `json:"rectification" gorm:"column:sf_rectification;type:tinyint(1) unsigned;default:1;not null;comment:1、需要整改;2:无需整改"` HappenTime int64 `json:"happentime" gorm:"column:sf_happen_time;type:bigint(20) unsigned;default:0;not null;comment:发生时间"` Count int `json:"count" gorm:"column:sf_count;type:int(5) unsigned;default:1;not null;comment:发生次数"` CorrectionTime int64 `json:"correctiontime" gorm:"column:sf_correctiontime;type:bigint(20) unsigned;default:0;not null;comment:整改期限"` PlanVersion string `json:"planversion" gorm:"column:sf_planversion;type:varchar(255);comment:版本号"` TargetId int64 `json:"targetid" gorm:"column:sf_target_id;type:bigint(20) unsigned;default:0;not null;comment:指标ID"` DetailedId int64 `json:"detailedid" gorm:"column:sf_detailed_id;type:bigint(20) unsigned;default:0;not null;comment:指标细则"` } func (ScoreFlow *ScoreFlow) TableName() string { return "score_flow" } // 编辑内容 func (cont *ScoreFlow) EiteCont(whereMap interface{}, saveData interface{}) (err error) { err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error return } // 获取内容 func (cont *ScoreFlow) GetCont(whereMap interface{}, field ...string) (err error) { gormDb := overall.CONSTANT_DB_KPI.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 *ScoreFlow) CountCont(whereMap interface{}) (countId int64) { overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) return } // 读取全部信息 func (cont *ScoreFlow) ContMap(whereMap interface{}, field ...string) (countAry []ScoreFlow, err error) { gormDb := overall.CONSTANT_DB_KPI.Model(&cont) if len(field) > 0 { fieldStr := strings.Join(field, ",") gormDb = gormDb.Select(fieldStr) } err = gormDb.Where(whereMap).Find(&countAry).Error return } // 删除内容 func (cont *ScoreFlow) DelCont(whereMap interface{}) (err error) { err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error return }