- dao.GetLastTotalRowCount

This commit is contained in:
gazebo
2018-12-21 11:07:18 +08:00
parent acb073cb92
commit c7577e6005
5 changed files with 26 additions and 40 deletions

View File

@@ -220,10 +220,7 @@ func GetStores(ctx *jxcontext.Context, keyword string, params map[string]interfa
// globals.SugarLogger.Debug(utils.Format4Output(sqlParams, false))
// globals.SugarLogger.Debug(sql)
if err = dao.GetRows(db, &retVal.Stores, sql, sqlParams...); err == nil {
countInfo := &struct{ Ct int }{}
if err = dao.GetRow(db, countInfo, "SELECT FOUND_ROWS() ct"); err == nil {
retVal.TotalCount = countInfo.Ct
}
retVal.TotalCount = dao.GetLastTotalRowCount(db)
for _, v := range retVal.Stores {
if v.StoreMapStr != "" {
if err = utils.UnmarshalUseNumber([]byte(v.StoreMapStr), &v.StoreMaps); err != nil {
@@ -498,14 +495,11 @@ func TmpGetJxBadCommentsByStoreId(ctx *jxcontext.Context, storeID, page, size, c
}()
globals.SugarLogger.Debug(sql)
if err = dao.GetRows(db, &commentList, sql, utils.Int2Str(storeID), size, (page-1)*size); err == nil {
countInfo := &struct{ Ct int }{}
if err = dao.GetRow(db, countInfo, "SELECT FOUND_ROWS() ct"); err == nil {
dao.Commit(db)
retVal = map[string]interface{}{
"total": countInfo.Ct,
"list": commentList,
}
retVal = map[string]interface{}{
"total": dao.GetLastTotalRowCount(db),
"list": commentList,
}
dao.Commit(db)
}
return retVal, err
}