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

67 lines
2.9 KiB

package reviseform
import (
"appPlatform/overall"
"strings"
)
// 字典类型
type EditFormDataLog struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"`
SourceForm int64 `json:"source_form" gorm:"column:source_form;type:bigint(20) unsigned;default:0;not null;comment:来源表单"`
FlowKey int64 `json:"flow_key" gorm:"column:flow_key;type:bigint(20) unsigned;default:0;not null;comment:流程标识符"`
RunKey int64 `json:"runKey" gorm:"column:runKey;type:bigint(20) unsigned;default:0;not null;comment:当前执行识别符"`
AddTime int64 `json:"addTime" gorm:"column:addTime;type:bigint(20) unsigned;default:0;not null;comment:创建时间"`
State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1、新数据;2:已批准的老数据)"`
DataCont string `json:"dataCont" gorm:"column:dataCont;type:longtext;default:'';comment:数据值"`
Explicate string `json:"explicate" gorm:"column:explicate;type:longtext;default:'';comment:说明"`
SunDataCont string `json:"sunDataCont" gorm:"column:sunDataCont;type:longtext;default:'';comment:子表数值"`
EditTime int64 `json:"editTime" gorm:"column:editTime;type:bigint(20) unsigned;default:0;not null;comment:创建时间"`
Executor int64 `json:"executor" gorm:"column:executor;type:bigint(20) unsigned;default:0;not null;comment:执行人"`
MastersKey int64 `json:"masters_key" gorm:"column:masters_key;type:bigint(20) unsigned;default:0;not null;comment:主表标识"`
}
func (EditFormDataLog *EditFormDataLog) TableName() string {
return "edit_form_data_log"
}
// 编辑内容
func (cont *EditFormDataLog) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_ReviseFormData.Model(&cont).Where(whereMap).Updates(saveData).Error
return
}
// 获取内容
func (cont *EditFormDataLog) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_ReviseFormData.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 *EditFormDataLog) CountCont(whereMap interface{}) (countId int64) {
overall.CONSTANT_DB_ReviseFormData.Model(&cont).Where(whereMap).Count(&countId)
return
}
// 读取全部信息
func (cont *EditFormDataLog) ContMap(whereMap interface{}, field ...string) (countAry []EditFormDataLog, err error) {
gormDb := overall.CONSTANT_DB_ReviseFormData.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
err = gormDb.Where(whereMap).Find(&countAry).Error
return
}
// 删除内容
func (cont *EditFormDataLog) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_ReviseFormData.Where(whereMap).Delete(&cont).Error
return
}