Browse Source

Merge remote-tracking branch 'origin/dm' into debug

Roc 1 tháng trước cách đây
mục cha
commit
8991cad25b

+ 2 - 1
controllers/data_manage/base_from_ly_index_controller.go

@@ -114,8 +114,9 @@ func (this *BaseFromLyIndexController) LyIndexDataList() {
 	if currentIndex <= 0 {
 		currentIndex = 1
 	}
+	startSize := utils.StartIndex(currentIndex, pageSize)
 
-	indexDataList, err := data.GetIndexDataPage(indexId, currentIndex, pageSize)
+	indexDataList, err := data.GetIndexDataPage(indexId, startSize, pageSize)
 	if err != nil {
 		br.Msg = "获取指标数据列表失败"
 		br.ErrMsg = "获取指标数据列表失败,Err:" + err.Error()

+ 4 - 2
controllers/document_manage/document_manage_controller.go

@@ -156,7 +156,8 @@ func (this *DocumentManageController) DocumentReportList() {
 	if currentIndex <= 0 {
 		currentIndex = 1
 	}
-	documentReportPage, err := document_manage_service.DocumentReportList(documentType, chartPermissionIdList, classifyIdList, keyword, orderField, orderType, currentIndex, pageSize)
+	startSize := utils.StartIndex(currentIndex, pageSize)
+	documentReportPage, err := document_manage_service.DocumentReportList(documentType, chartPermissionIdList, classifyIdList, keyword, orderField, orderType, startSize, pageSize)
 	if err != nil {
 		br.Msg = "获取报告列表失败"
 		br.ErrMsg = "获取报告列表失败,Err:" + err.Error()
@@ -211,7 +212,8 @@ func (this *DocumentManageController) RuiSiReportList() {
 	if currentIndex <= 0 {
 		currentIndex = 1
 	}
-	RuiSiReportPage, err := document_manage_service.RuiSiReportList(classifyIdFirst, classifyIdSecond, classifyIdThird, chartPermissionIdList, keyword, orderField, orderType, currentIndex, pageSize)
+	startSize := utils.StartIndex(currentIndex, pageSize)
+	RuiSiReportPage, err := document_manage_service.RuiSiReportList(classifyIdFirst, classifyIdSecond, classifyIdThird, chartPermissionIdList, keyword, orderField, orderType, startSize, pageSize)
 	if err != nil {
 		br.Msg = "获取报告列表失败"
 		br.ErrMsg = "获取报告列表失败,Err:" + err.Error()

+ 4 - 4
models/data_manage/base_from_ly_data.go

@@ -45,7 +45,7 @@ func GetLyDataCountByIndexId(indexId int) (count int, err error) {
 func GetLyDataPageByIndexId(indexId int, startSize, pageSize int) (items []*BaseFromLyData, err error) {
 	o := global.DbMap[utils.DbNameIndex]
 	sql := `SELECT * FROM base_from_ly_data WHERE base_from_ly_index_id=? ORDER BY data_time desc LIMIT ?,?`
-	err = o.Raw(sql, indexId, (startSize-1)*pageSize, pageSize).Find(&items).Error
+	err = o.Raw(sql, indexId, startSize, pageSize).Find(&items).Error
 	return
 }
 
@@ -64,9 +64,9 @@ func GetLyDataListByIndexCodes(IndexCodes string) (items []string, err error) {
 	if err != nil {
 		return
 	}
-		for i := range items {
-			items[i] = utils.GormDateStrToDateStr(items[i])
-		}
+	for i := range items {
+		items[i] = utils.GormDateStrToDateStr(items[i])
+	}
 	return
 }
 

+ 2 - 2
models/report.go

@@ -230,7 +230,7 @@ func GetReportListV1(condition string, pars []interface{}, startSize, pageSize i
 	}
 	// 排序:1:未发布;2:已发布;3-待提交;4-待审批;5-已驳回;6-已通过
 	sql += ` ORDER BY FIELD(state,3,1,4,5,6,2), modify_time DESC LIMIT ?,?`
-	pars = append(pars, (startSize-1)*pageSize, pageSize)
+	pars = append(pars, startSize, pageSize)
 	err = o.Raw(sql, pars...).Find(&items).Error
 	return
 }
@@ -245,7 +245,7 @@ a.classify_name_third,a.abstract,a.admin_id,a.admin_real_name,a.last_modify_admi
 		sql += condition
 	}
 	sql += ` LIMIT ?,?`
-	pars = append(pars, (startSize-1)*pageSize, pageSize)
+	pars = append(pars, startSize, pageSize)
 	err = o.Raw(sql, pars...).Find(&items).Error
 	return
 }

+ 1 - 1
services/document_manage_service/document_manage_service.go

@@ -178,7 +178,7 @@ func DocumentReportList(documentType int, chartPermissionIdList []string, classi
 	}
 
 	condition += ` LIMIT ?,?`
-	pars = append(pars, (startSize-1)*pageSize, pageSize)
+	pars = append(pars, startSize, pageSize)
 
 	outsideReportList, err := document_manage_model.GetOutsideReportListByCondition(condition, pars)
 	if err != nil {