From efdfa2d6754354c021a19b340088c296fff74ca6 Mon Sep 17 00:00:00 2001
From: wangpengfei <274878379@qq.com>
Date: 星期四, 17 八月 2023 16:33:32 +0800
Subject: [PATCH] add

---
 api/v1/quotation.go |   53 +++++++++++++++++++++++++++++------------------------
 1 files changed, 29 insertions(+), 24 deletions(-)

diff --git a/api/v1/quotation.go b/api/v1/quotation.go
index c76567f..724da4f 100644
--- a/api/v1/quotation.go
+++ b/api/v1/quotation.go
@@ -98,30 +98,6 @@
 	ctx.Ok()
 }
 
-// List
-//
-//	@Tags		Quotation
-//	@Summary	鎶ヤ环鍗曞垪琛�
-//	@Produce	application/json
-//	@Success	200	{object}	contextx.Response{data=response.QuotationResponse}
-//	@Router		/api/quotation/list [get]
-func (s *QuotationApi) List(c *gin.Context) {
-	ctx, ok := contextx.NewContext(c, nil)
-	if !ok {
-		return
-	}
-
-	list, errCode := quotationService.GetQuotationList()
-	if errCode != ecode.OK {
-		ctx.Fail(errCode)
-		return
-	}
-
-	ctx.OkWithDetailed(response.QuotationResponse{
-		List: list,
-	})
-}
-
 // checkQuotationParams
 func checkQuotationParams(quotation request.Quotation) (int, model.Quotation) {
 	var errCode int
@@ -153,6 +129,8 @@
 		return errCode, quotationModel
 	}
 
+	// 灏嗘椂闂村瓧绗﹁浆鎹负鏃堕棿绫诲瀷
+
 	quotationModel.ValidityDate = t
 	quotationModel.ClientId = quotation.ClientId
 	quotationModel.QuotationStatusId = quotation.QuotationStatusId
@@ -166,3 +144,30 @@
 	return ecode.OK, quotationModel
 
 }
+
+// List
+//
+//	@Tags		Quotation
+//	@Summary	鎶ヤ环鍗曞垪琛�
+//	@Produce	application/json
+//	@Param		object	body		request.GetQuotationList	true	"鍙傛暟"
+//	@Success	200		{object}	contextx.Response{data=response.QuotationResponse}
+//	@Router		/api/quotation/list [post]
+func (con *QuotationApi) List(c *gin.Context) {
+	var params request.GetQuotationList
+	ctx, ok := contextx.NewContext(c, &params)
+	if !ok {
+		return
+	}
+
+	quotations, total, errCode := quotationService.GetQuotationList(params.Page, params.PageSize, params.SearchMap)
+	if errCode != ecode.OK {
+		ctx.Fail(errCode)
+		return
+	}
+
+	ctx.OkWithDetailed(response.QuotationResponse{
+		List:  quotations,
+		Count: int(total),
+	})
+}

--
Gitblit v1.8.0