package models import ( "github.com/beego/beego/v2/client/orm" "time" ) // EnglishCompanyTodoPublic 英文客户公共TODO任务 type EnglishCompanyTodoPublic struct { Id int `orm:"column(id);pk"` Content string `description:"任务描述"` CreateUserId int `description:"创建人用户id"` CreateUserName string `description:"创建人用户姓名"` ModifyTime time.Time `description:"修改时间"` CreateTime time.Time `description:"创建时间"` IsDelete int `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) return } func (item *EnglishCompanyTodoPublic) Update(cols []string) (err error) { o := orm.NewOrmUsingDB("rddp") _, err = o.Update(item, cols...) 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) return }