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

69 lines
2.7 KiB

package modelskpi
import (
"appPlatform/overall"
"strings"
)
// 当前节点是否可操作
type OperatorIsTrue struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"`
OrderId int64 `json:"orderid" gorm:"column:orderid;type:bigint(20) unsigned;default:0;not null;comment:订单ID"`
Step int `json:"step" gorm:"column:step;type:int(5) unsigned;default:1;not null;comment:审批到第几步"`
State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态:1:可操作;2:不可操作"`
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:操作时间"`
Msgid string `json:"msgid" gorm:"column:msgid;type:varchar(255);comment:消息id,用于撤回应用消息"`
ResponseCode string `json:"responsecode" gorm:"column:response_code;type:varchar(255);comment:仅消息类型为“按钮交互型”,“投票选择型”和“多项选择型”的模板卡片消息返回,应用可使用response_code调用更新模版卡片消息接口,24小时内有效,且只能使用一次"`
Stepper int `json:"stepper" gorm:"column:stepper;type:int(5) unsigned;default:1;not null;comment:步进器"`
}
func (OperatorIsTrue *OperatorIsTrue) TableName() string {
return "operator_is_true"
}
// 编辑内容
func (cont *OperatorIsTrue) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error
return
}
// 获取内容
func (cont *OperatorIsTrue) 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 *OperatorIsTrue) CountCont(whereMap interface{}) (countId int64) {
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId)
return
}
// 读取全部信息
func (cont *OperatorIsTrue) ContMap(whereMap interface{}, field ...string) (countAry []OperatorIsTrue, 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).Order("sort ASC").Find(&countAry).Error
return
}
// 删除内容
func (cont *OperatorIsTrue) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error
return
}
// 添加记录
func (cont *OperatorIsTrue) AddCont() (err error) {
err = overall.CONSTANT_DB_KPI.Create(&cont).Error
return
}