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 +}