Explorar el Código

文章

master
huangjiajun hace 4 días
padre
commit
fff8f11fce
Se han modificado 2 ficheros con 11 adiciones y 0 borrados
  1. +1
    -0
      src/dao/article_cate_dao.go
  2. +10
    -0
      src/implement/article_cate_implement.go

+ 1
- 0
src/dao/article_cate_dao.go Ver fichero

@@ -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)
}

+ 10
- 0
src/implement/article_cate_implement.go Ver fichero

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

Cargando…
Cancelar
Guardar