Browse Source

fixed: Find两次数据库, db := global.GVA_DB加上Model 防止Count报错

main
SliverHorn 3 years ago
parent
commit
0016632778
  1. 4
      server/service/example/exa_file_upload_download.go
  2. 4
      server/service/system/sys_autocode_history.go

4
server/service/example/exa_file_upload_download.go

@ -62,9 +62,9 @@ func (e *FileUploadAndDownloadService) DeleteFile(file example.ExaFileUploadAndD
func (e *FileUploadAndDownloadService) GetFileRecordInfoList(info request.PageInfo) (err error, list interface{}, total int64) { func (e *FileUploadAndDownloadService) GetFileRecordInfoList(info request.PageInfo) (err error, list interface{}, total int64) {
limit := info.PageSize limit := info.PageSize
offset := info.PageSize * (info.Page - 1) offset := info.PageSize * (info.Page - 1)
db := global.GVA_DB
db := global.GVA_DB.Model(&example.ExaFileUploadAndDownload{})
var fileLists []example.ExaFileUploadAndDownload var fileLists []example.ExaFileUploadAndDownload
err = db.Find(&fileLists).Count(&total).Error
err = db.Count(&total).Error
if err != nil { if err != nil {
return return
} }

4
server/service/system/sys_autocode_history.go

@ -108,9 +108,9 @@ func (autoCodeHistoryService *AutoCodeHistoryService) GetMeta(id uint) (string,
func (autoCodeHistoryService *AutoCodeHistoryService) GetSysHistoryPage(info request.PageInfo) (err error, list interface{}, total int64) { func (autoCodeHistoryService *AutoCodeHistoryService) GetSysHistoryPage(info request.PageInfo) (err error, list interface{}, total int64) {
limit := info.PageSize limit := info.PageSize
offset := info.PageSize * (info.Page - 1) offset := info.PageSize * (info.Page - 1)
db := global.GVA_DB
db := global.GVA_DB.Model(&system.SysAutoCodeHistory{})
var fileLists []system.SysAutoCodeHistory var fileLists []system.SysAutoCodeHistory
err = db.Find(&fileLists).Count(&total).Error
err = db.Count(&total).Error
if err != nil { if err != nil {
return return
} }

Loading…
Cancel
Save