实现文档编辑

This commit is contained in:
Minho
2017-04-27 18:19:37 +08:00
parent 8c85227c30
commit ca1b1a4b83
18 changed files with 1095 additions and 173 deletions

View File

@@ -9,9 +9,11 @@ import (
// Attachment struct .
type Attachment struct {
AttachmentId int `orm:"column(attachment_id);pk;auto;unique" json:"attachment_id"`
DocumentId int `orm:"column(document_id);type(int)" json:"document_id"`
FileName string `orm:"column(file_name);size(2000)" json:"file_name"`
BookId int `orm:"column(book_id);type(int)" json:"book_id"`
FileName string `orm:"column(file_name);size(255)" json:"file_name"`
FilePath string `orm:"column(file_path);size(2000)" json:"file_path"`
FileSize float64 `orm:"column(file_size);type(float)" json:"file_size"`
HttpPath string `orm:"column(http_path);size(2000)" json:"http_path"`
FileExt string `orm:"column(file_ext);size(50)" json:"file_ext"`
CreateTime time.Time `orm:"type(datetime);column(create_time);auto_now_add"`
CreateAt int `orm:"column(create_at);type(int)" json:"create_at"`
@@ -41,6 +43,11 @@ func (m *Attachment) Insert() error {
return err
}
func (m *Attachment) Update() error {
o := orm.NewOrm()
_,err := o.Update(m)
return err
}
func (m *Attachment) Find(id int) (*Attachment,error) {
if id <= 0 {