From 27be7a2c517404e4622470edf7b83b13129220ff Mon Sep 17 00:00:00 2001
From: jiangshuai <291802688@qq.com>
Date: 星期五, 08 十二月 2023 11:14:04 +0800
Subject: [PATCH] merge conflicts

---
 controllers/report_forms_controller.go |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/controllers/report_forms_controller.go b/controllers/report_forms_controller.go
index 2489b45..9575819 100644
--- a/controllers/report_forms_controller.go
+++ b/controllers/report_forms_controller.go
@@ -260,11 +260,12 @@
 		}
 		if len(ids) == 0 {
 			util.ResponseFormatList(c, code.Success, result, 0)
+			return
 		}
 	}
 
 	detailsSearch.Orm = detailsSearch.Orm.Model(&models.MoveHistory{}).
-		Select("number, updated_at as date, product_name as product_name, from_location_id," +
+		Select("number, updated_at as date, product_name as product_name, from_location_id, operation_id," +
 			"to_location_id, amount, unit, operator as contacted_name, base_operation_type, weight, product_id, from_location, to_location").Order("id desc")
 	if len(ids) > 0 {
 		detailsSearch.Orm = detailsSearch.Orm.Where("id in ?", ids)
@@ -272,6 +273,16 @@
 	if params.BaseOperationType != 0 {
 		detailsSearch.Orm = detailsSearch.Orm.Where("base_operation_type = ?", params.BaseOperationType)
 	}
+	var t int64
+	err = detailsSearch.Orm.Count(&t).Error
+	if err != nil {
+		util.ResponseFormat(c, code.RequestParamError, fmt.Errorf("鏌ヨ鎬绘潯鏁板け璐�: %v", err))
+		return
+	}
+	total = uint64(t)
+	if params.Page*params.PageSize > 0 {
+		detailsSearch.Orm = detailsSearch.Orm.Offset((params.Page - 1) * params.PageSize).Limit(params.PageSize)
+	}
 	err = detailsSearch.Orm.Find(&result).Error
 	if err != nil {
 		util.ResponseFormat(c, code.RequestParamError, fmt.Errorf("鏌ヨ鎿嶄綔鏄庣粏澶辫触: %v", err))

--
Gitblit v1.8.0