package models import ( "eta_gn/eta_api/global" "time" ) // EnglishCompanyTodoPublic 英文客户公共TODO任务 type EnglishCompanyTodoPublic struct { Id int `gorm:"column:id;primaryKey" description:"任务ID"` Content string `gorm:"column:content" description:"任务描述"` CreateUserId int `gorm:"column:create_user_id" description:"创建人用户ID"` CreateUserName string `gorm:"column:create_user_name" description:"创建人用户姓名"` ModifyTime time.Time `gorm:"column:modify_time" description:"修改时间"` CreateTime time.Time `gorm:"column:create_time" description:"创建时间"` IsDelete int `gorm:"column:is_delete;default:0" json:"-" description:"是否已经删除,0:未删除,1:已删除;默认:0"` } func (item *EnglishCompanyTodoPublic) TableName() string { return "english_company_todo_public" } // EnglishCompanyTodoPublicResp 英文客户公共TODO响应体 type EnglishCompanyTodoPublicResp struct { Content string `description:"任务描述"` CreateUserId int `description:"创建人用户id"` CreateUserName string `description:"创建人用户姓名"` ModifyTime string `description:"修改时间"` CreateTime string `description:"创建时间"` } func (item *EnglishCompanyTodoPublic) Create() (err error) { //o := orm.NewOrmUsingDB("rddp") //id, err := o.Insert(item) //if err != nil { // return //} //item.Id = int(id) err = global.DmSQL["rddp"].Create(item).Error return } func (item *EnglishCompanyTodoPublic) Update(cols []string) (err error) { //o := orm.NewOrmUsingDB("rddp") //_, err = o.Update(item, cols...) err = global.DmSQL["rddp"].Select(cols).Updates(item).Error return } // EnglishCompanyTodoPublicAddReq 新增公共任务请求 type EnglishCompanyTodoPublicAddReq struct { Description string `description:"任务描述"` } // GetLastEnglishCompanyTodoPublic 获取最新的公共任务TODO func GetLastEnglishCompanyTodoPublic() (item *EnglishCompanyTodoPublic, err error) { //o := orm.NewOrmUsingDB("rddp") sql := `SELECT * FROM english_company_todo_public ORDER BY create_time DESC LIMIT 1` //err = o.Raw(sql).QueryRow(&item) err = global.DmSQL["rddp"].Raw(sql).First(&item).Error return }