add prev&next read (#941)

* add prev&next read
* add prev&next in default read.tpl
* update prev&next
This commit is contained in:
hotqin888
2024-05-09 13:33:27 +08:00
committed by GitHub
parent c810f81fc1
commit 22589e344c
16 changed files with 192 additions and 13 deletions

View File

@@ -1,4 +1,4 @@
//数据库模型.
// 数据库模型.
package models
import (
@@ -12,8 +12,15 @@ import (
"github.com/beego/beego/v2/core/logs"
"github.com/mindoc-org/mindoc/conf"
"github.com/mindoc-org/mindoc/utils/filetil"
// "gorm.io/driver/sqlite"
// "gorm.io/gorm"
// "gorm.io/gorm/logger"
// "gorm.io/gorm/schema"
)
// 定义全局的db对象我们执行数据库操作主要通过他实现。
// var _db *gorm.DB
// Attachment struct .
type Attachment struct {
AttachmentId int `orm:"column(attachment_id);pk;auto;unique" json:"attachment_id"`
@@ -83,7 +90,7 @@ func (m *Attachment) Find(id int) (*Attachment, error) {
return m, err
}
//查询指定文档的附件列表
// 查询指定文档的附件列表
func (m *Attachment) FindListByDocumentId(docId int) (attaches []*Attachment, err error) {
o := orm.NewOrm()
@@ -91,7 +98,7 @@ func (m *Attachment) FindListByDocumentId(docId int) (attaches []*Attachment, er
return
}
//分页查询附件
// 分页查询附件
func (m *Attachment) FindToPager(pageIndex, pageSize int) (attachList []*AttachmentResult, totalCount int, err error) {
o := orm.NewOrm()