feat:增加查询api

This commit is contained in:
songzhibin97
2021-07-10 19:01:56 +08:00
parent 686163808d
commit 14371c0e45
5 changed files with 49 additions and 6 deletions

View File

@@ -4,6 +4,7 @@ import (
"errors"
"gin-vue-admin/global"
"gin-vue-admin/model"
"gin-vue-admin/model/request"
"gin-vue-admin/utils"
"strings"
@@ -20,6 +21,7 @@ func CreateAutoCodeHistory(autoCodeMeta string, injectionMeta string, tableName
}).Error
}
// RollBack 回滚
func RollBack(id uint) error {
md := model.SysAutoCodeHistory{}
if err := global.GVA_DB.First(&md, id).Error; err != nil {
@@ -61,3 +63,13 @@ func RollBack(id uint) error {
md.Flag = 1
return global.GVA_DB.Save(&md).Error
}
func GetSysHistoryPage(info request.PageInfo) (err error, list interface{}, total int64) {
limit := info.PageSize
offset := info.PageSize * (info.Page - 1)
db := global.GVA_DB
var fileLists []model.SysAutoCodeHistory
err = db.Find(&fileLists).Count(&total).Error
err = db.Limit(limit).Offset(offset).Order("updated_at desc").Find(&fileLists).Error
return err, fileLists, total
}