package modelskpi import ( "key_performance_indicators/overall" "strings" ) // 流程步进器 type EvaluationProcess struct { Id int64 `json:"id" gorm:"primaryKey;column:ep_id;type:bigint(20) unsigned;not null"` OrderKey int64 `json:"orderkey" gorm:"column:ep_order_key;type:bigint(20) unsigned;default:0;not null;comment:发起表单key"` Step int `json:"step" gorm:"column:ep_step;type:int(7) unsigned;default:1;not null;comment:当前执行到第几部"` Content string `json:"content" gorm:"column:ep_cont;type:longtext;comment:流程步进值"` NextContent string `json:"nextcontent" gorm:"column:ep_next_cont;type:mediumtext;comment:下一步内容"` Time int64 `json:"time" gorm:"column:ep_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` State int `json:"state" gorm:"column:ep_state;type:int(2) unsigned;default:1;not null;comment:1:起草,2:审批中;3:通过;4:驳回"` RoleGroup int64 `json:"rolegroup" gorm:"column:ep_role_group;type:bigint(20) unsigned;default:0;not null;comment:角色组"` TypeClass int `json:"type" gorm:"column:ep_type;type:tinyint(1) unsigned;default:1;not null;comment:1、定性;2、定量"` Participants string `json:"participants" gorm:"column:ep_participants;type:mediumtext;comment:参与人"` StartTime int64 `json:"starttime" gorm:"column:ep_start_time;type:bigint(20) unsigned;default:0;not null;comment:流程开始时间"` NextStep int `json:"nextstep" gorm:"column:ep_next_step;type:int(7) unsigned;default:1;not null;comment:下一步"` NextExecutor string `json:"nextexecutor" gorm:"column:ep_next_executor;type:mediumtext;comment:下一步执行人"` SetupDepartment int64 `json:"setupdepartment" gorm:"column:ep_setup_department;type:bigint(20) unsigned;default:0;not null;comment:发起部门"` Dimension string `json:"dimension" gorm:"column:ep_dimension;type:mediumtext;comment:维度"` Target string `json:"target" gorm:"column:ep_target;type:mediumtext;comment:指标"` DetailedTarget string `json:"detailedtarget" gorm:"column:ep_detailedtarget;type:mediumtext;comment:指标细则"` AcceptDepartment int64 `json:"acceptdepartment" gorm:"column:ep_accept_department;type:bigint(20) unsigned;default:0;not null;comment:接受考核部门"` } func (EvaluationProcess *EvaluationProcess) TableName() string { return "evaluation_process" } // 编辑内容 func (cont *EvaluationProcess) EiteCont(whereMap interface{}, saveData interface{}) (err error) { err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error return } // 获取内容 func (cont *EvaluationProcess) 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 *EvaluationProcess) CountCont(whereMap interface{}) (countId int64) { overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) return } // 读取全部信息 func (cont *EvaluationProcess) ContMap(whereMap interface{}, field ...string) (countAry []EvaluationProcess, 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 *EvaluationProcess) DelCont(whereMap interface{}) (err error) { err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error return }