- dao.GetLastTotalRowCount
This commit is contained in:
@@ -384,21 +384,18 @@ func GetSkuNames(ctx *jxcontext.Context, keyword string, params map[string]inter
|
||||
// globals.SugarLogger.Debug(sqlData)
|
||||
// globals.SugarLogger.Debug(utils.Format4Output(sqlParams, false))
|
||||
if err = dao.GetRows(db, &skuNamesInfo.SkuNames, sqlData, sqlParams...); err == nil {
|
||||
countInfo := &struct{ Ct int }{}
|
||||
if err = dao.GetRow(db, countInfo, "SELECT FOUND_ROWS() ct"); err == nil {
|
||||
skuNamesInfo.TotalCount = countInfo.Ct
|
||||
for _, skuName := range skuNamesInfo.SkuNames {
|
||||
if skuName.SkusStr != "" {
|
||||
if err = utils.UnmarshalUseNumber([]byte(skuName.SkusStr), &skuName.Skus); err != nil {
|
||||
dao.Rollback(db)
|
||||
return nil, err
|
||||
}
|
||||
skuNamesInfo.TotalCount = dao.GetLastTotalRowCount(db)
|
||||
for _, skuName := range skuNamesInfo.SkuNames {
|
||||
if skuName.SkusStr != "" {
|
||||
if err = utils.UnmarshalUseNumber([]byte(skuName.SkusStr), &skuName.Skus); err != nil {
|
||||
dao.Rollback(db)
|
||||
return nil, err
|
||||
}
|
||||
if skuName.PlacesStr != "" {
|
||||
if err = utils.UnmarshalUseNumber([]byte(skuName.PlacesStr), &skuName.Places); err != nil {
|
||||
dao.Rollback(db)
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
if skuName.PlacesStr != "" {
|
||||
if err = utils.UnmarshalUseNumber([]byte(skuName.PlacesStr), &skuName.Places); err != nil {
|
||||
dao.Rollback(db)
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -628,12 +628,10 @@ func GetJdPromotions(ctx *jxcontext.Context, keyword string, params map[string]i
|
||||
}
|
||||
}
|
||||
}
|
||||
pagedInfo = &model.PagedInfo{}
|
||||
countInfo := &struct{ Ct int }{}
|
||||
if err = dao.GetRow(db, countInfo, "SELECT FOUND_ROWS() ct"); err == nil {
|
||||
pagedInfo.TotalCount = countInfo.Ct
|
||||
pagedInfo = &model.PagedInfo{
|
||||
TotalCount: dao.GetLastTotalRowCount(db),
|
||||
Data: promotionList,
|
||||
}
|
||||
pagedInfo.Data = promotionList
|
||||
}
|
||||
dao.Commit(db)
|
||||
return pagedInfo, err
|
||||
|
||||
Reference in New Issue
Block a user