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

49 lines
2.2 KiB

package modelbookimg
import (
"appPlatform/overall"
"strings"
)
// 追问
type Traceing struct {
Id int64 `json:"id" gorm:"primaryKey;column:tr_id;type:bigint unsigned;not null;auto_increment;comment:ID"`
AnsId int64 `json:"ansid" gorm:"column:tr_ans_id;type:bigint unsigned;not null;default:0;comment:答案ID"`
UserKey int64 `json:"userkey" gorm:"column:tr_user_key;type:bigint unsigned;not null;default:0;comment:追问人Key"`
UserJson string `json:"userjson" gorm:"column:tr_user_json;type:mediumtext;comment:追问人基本信息"`
Cont string `json:"cont" gorm:"column:tr_cont;type:mediumtext;comment:内容"`
Type int `json:"type" gorm:"column:tr_type;type:tinyint unsigned;not null;default:1;comment:类型(1:追问;2:追答)"`
State int `json:"state" gorm:"column:tr_state;type:tinyint unsigned;not null;default:1;comment:状态(1:启用;2:禁用)"`
Time int64 `json:"time" gorm:"column:tr_time;type:bigint unsigned;not null;default:0;comment:时间"`
EiteTime int64 `json:"eitetime" gorm:"column:tr_eite_time;type:bigint unsigned;not null;default:0;comment:编辑时间"`
AnsUserKey int64 `json:"ansuserkey" gorm:"column:tr_ans_user_key;type:bigint unsigned;not null;default:0;comment:问题回答人"`
IsRes int `json:"isres" gorm:"column:tr_is_res;type:tinyint unsigned;not null;default:1;comment:是否已经解决(1:未解决;2:已解决)"`
}
func (ri *Traceing) TableName() string {
return "traceing"
}
// 编辑追问内容
func (cont *Traceing) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_FILE_BOOK.Model(&cont).Where(whereMap).Updates(saveData).Error
return
}
// 获取追问内容
func (cont *Traceing) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_FILE_BOOK.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 *Traceing) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_FILE_BOOK.Where(whereMap).Delete(&cont).Error
return
}