From fff8f11fcef5e05c49999464a75a15cf91e4d075 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Tue, 26 Nov 2024 10:55:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E7=AB=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/dao/article_cate_dao.go | 1 + src/implement/article_cate_implement.go | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/src/dao/article_cate_dao.go b/src/dao/article_cate_dao.go index 1086288..23b912e 100644 --- a/src/dao/article_cate_dao.go +++ b/src/dao/article_cate_dao.go @@ -9,4 +9,5 @@ type ArticleCateDao interface { ArticleCateByPid(pid string) (*[]model.ArticleCate, error) FindArticleCate(page, limit, pid string) (*[]model.ArticleCate, error) FindArticleCateAndTotal(page, limit, pid string) (*[]model.ArticleCate, int64, error) + FindArticleCateAndTotalPid(page, limit string) (*[]model.ArticleCate, int64, error) } diff --git a/src/implement/article_cate_implement.go b/src/implement/article_cate_implement.go index 70c4d90..d84b451 100644 --- a/src/implement/article_cate_implement.go +++ b/src/implement/article_cate_implement.go @@ -60,3 +60,13 @@ func (a ArticleCateDb) FindArticleCateAndTotal(page, limit, pid string) (*[]mode } return &m, count, nil } +func (a ArticleCateDb) FindArticleCateAndTotalPid(page, limit string) (*[]model.ArticleCate, int64, error) { + var m []model.ArticleCate + sess := a.Db.Where("pid>0") + start := (zhios_order_relate_utils.StrToInt(page) - 1) * zhios_order_relate_utils.StrToInt(limit) + count, err := sess.Limit(zhios_order_relate_utils.StrToInt(limit), start).OrderBy("sort desc,id desc").FindAndCount(&m) + if err != nil { + return nil, count, zhios_order_relate_logx.Error(err) + } + return &m, count, nil +}