소스 검색

Merge branch 'feature/eta2.5.9_api_stat' into debug

xyxie 16 시간 전
부모
커밋
1fec1e3d81
2개의 변경된 파일6개의 추가작업 그리고 3개의 파일을 삭제
  1. 3 1
      controllers/data_manage/edb_inspection.go
  2. 3 2
      models/data_manage/edb_inspection/edb_inspection_record.go

+ 3 - 1
controllers/data_manage/edb_inspection.go

@@ -295,6 +295,8 @@ func (c *EdbInspectionController) GetInspectionRecordDetail() {
 	if currentIndex <= 0 {
 		currentIndex = 1
 	}
+	startSize := utils.StartIndex(currentIndex, pageSize)
+
 	condition := ``
 	var pars []interface{}
 
@@ -330,7 +332,7 @@ func (c *EdbInspectionController) GetInspectionRecordDetail() {
 		pars = append(pars, endTime)
 	}
 
-	list, err := edb_inspection.GetInspectionRecordListByCondition(condition, pars, currentIndex, pageSize)
+	list, err := edb_inspection.GetInspectionRecordListByCondition(condition, pars, startSize, pageSize)
 	if err != nil {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取失败,Err:" + err.Error()

+ 3 - 2
models/data_manage/edb_inspection/edb_inspection_record.go

@@ -90,10 +90,11 @@ func (m *InspectionRecordList) AfterFind(scope *gorm.DB) (err error) {
 	return
 }
 
-func GetInspectionRecordListByCondition(condition string, pars []interface{}, pageIndex int, pageSize int) (list []*InspectionRecordList, err error) {
+func GetInspectionRecordListByCondition(condition string, pars []interface{}, startSize int, pageSize int) (list []*InspectionRecordList, err error) {
 	sql := `SELECT r.*, t.name as terminal_name, s.source_name FROM edb_inspection_record r left join edb_terminal t on r.terminal_code = t.terminal_code 
 	left join edb_source s on r.source = s.edb_source_id
-	WHERE 1=1 ` + condition + ` ORDER BY inspection_time DESC`
+	WHERE 1=1 ` + condition + ` ORDER BY inspection_time DESC LIMIT ?,?`
+	pars = append(pars, startSize, pageSize)
 	err = global.DbMap[utils.DbNameIndex].Raw(sql, pars...).Find(&list).Error
 	return
 }