We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2807212 commit a294ea7Copy full SHA for a294ea7
1 file changed
models/book.go
@@ -119,7 +119,7 @@ func (m *Book) Find(id int) (book *Book, err error) {
119
if id <= 0 {
120
return
121
}
122
-
+ book = &Book{}
123
o := orm.NewOrm()
124
err = o.QueryTable(m.TableNameWithPrefix()).Filter("book_id", id).One(book)
125
@@ -153,8 +153,8 @@ func (m *Book) FindByField(field string, value interface{}) (books []*Book, err
153
//根据指定字段查询一个结果.
154
func (m *Book) FindByFieldFirst(field string, value interface{}) (book *Book, err error) {
155
156
- err = o.QueryTable(m.TableNameWithPrefix()).Filter(field, value).One(book)
157
- return
+ err = o.QueryTable(m.TableNameWithPrefix()).Filter(field, value).One(m)
+ return m, err
158
159
160
func (m *Book) FindByIdentify(identify string) (book *Book, err error) {
@@ -483,7 +483,7 @@ func (m *Book) FindForLabelToPager(keyword string, pageIndex, pageSize, memberId
483
484
485
func (book *Book) ToBookResult() (m *BookResult) {
486
+ m = &BookResult{}
487
m.BookId = book.BookId
488
m.BookName = book.BookName
489
m.Identify = book.Identify
0 commit comments