package modelskpi import ( "appPlatform/overall" "strings" ) /* * @ 作者: 秦东 @ 时间: 2023-04-08 10:28:42 @ 功能: 审批记录视图 @ 参数 # @ 返回值 # @ 方法原型 # */ type ApprovalRecord 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:归档;5:删除"` 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:接受考核部门"` HappenTime int64 `json:"happentime" gorm:"column:ep_happen_time;type:bigint(20) unsigned;default:0;not null;comment:发生时间"` FlowKey int64 `json:"flowkey" gorm:"column:ep_flow_key;type:bigint(20) unsigned;default:0;not null;comment:工作流识别符"` FlowVid int64 `json:"flowvid" gorm:"column:ep_flow_vid;type:bigint(20) unsigned;default:0;not null;comment:当前工作流版本号"` EpOld int `json:"epold" gorm:"column:ep_old;type:int(1) unsigned;default:1;not null;comment:1:旧流程;2:新流程"` Creater int64 `json:"creater" gorm:"column:ep_creater;type:bigint(20) unsigned;default:0;not null;comment:流程创始人"` TargetTitle string `json:"targettitle" gorm:"column:target_title;type:varchar(255);comment:指标名称"` BylawsTitle string `json:"bylawstitle" gorm:"column:bylaws_title;type:varchar(255);comment:细则名称"` Clique int64 `json:"clique" gorm:"column:ep_clique;type:bigint(20) unsigned;default:0;not null;comment:公司"` } func (ApprovalRecord *ApprovalRecord) TableName() string { return "approval_record" } // 编辑内容 func (cont *ApprovalRecord) EiteCont(whereMap interface{}, saveData interface{}) (err error) { err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error return } // 获取内容 func (cont *ApprovalRecord) 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 *ApprovalRecord) CountCont(whereMap interface{}) (countId int64) { overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) return } // 读取全部信息 func (cont *ApprovalRecord) ContMap(whereMap interface{}, field ...string) (countAry []ApprovalRecord, 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 *ApprovalRecord) DelCont(whereMap interface{}) (err error) { err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error return }