From e0a433e9c31594527a3bf7766c0bfb2cbbceffdb Mon Sep 17 00:00:00 2001
From: wangpengfei <274878379@qq.com>
Date: 星期三, 26 七月 2023 10:09:04 +0800
Subject: [PATCH] fix add pageInfo, keyword to all the list

---
 api/v1/contract.go |   50 +++++++++++++++++++++++++++-----------------------
 1 files changed, 27 insertions(+), 23 deletions(-)

diff --git a/api/v1/contract.go b/api/v1/contract.go
index 0f69384..e93ece3 100644
--- a/api/v1/contract.go
+++ b/api/v1/contract.go
@@ -98,29 +98,6 @@
 	ctx.Ok()
 }
 
-// List
-//
-//	@Tags		Contract
-//	@Summary	鑾峰彇鍚堝悓鍒楄〃
-//	@Produce	application/json
-//	@Success	200	{object}	contextx.Response{data=response.ContractResponse}
-//	@Router		/api/contract/list [get]
-func (s *ContractApi) List(c *gin.Context) {
-	ctx, ok := contextx.NewContext(c, nil)
-	if !ok {
-		return
-	}
-
-	contractList, errCode := contractService.GetContractList()
-	if errCode != ecode.OK {
-		ctx.Fail(errCode)
-		return
-	}
-
-	ctx.OkWithDetailed(response.ContractResponse{
-		List: contractList,
-	})
-}
 
 func checkContractParams(contract request.Contract) (errCode int, contractModel model.Contract) {
 	//if contract.Number == "" {
@@ -142,3 +119,30 @@
 
 	return ecode.OK, contractModel
 }
+
+// List
+//
+//	@Tags		Contract
+//	@Summary	閿�鍞悎鍚屽垪琛�
+//	@Produce	application/json
+//	@Param		object	body		request.GetContractList	true	"鍙傛暟"
+//	@Success	200		{object}	contextx.Response{data=response.ContractResponse}
+//	@Router		/api/contract/list [post]
+func (con *ContractApi) List(c *gin.Context) {
+	var params request.GetContractList
+	ctx, ok := contextx.NewContext(c, &params)
+	if !ok {
+		return
+	}
+
+	contracts, errCode := contractService.GetContractList(params.Page, params.PageSize, params.Keyword)
+	if errCode != ecode.OK {
+		ctx.Fail(errCode)
+		return
+	}
+
+	ctx.OkWithDetailed(response.ContractResponse{
+		List: contracts,
+		Count: len(contracts),
+	})
+}

--
Gitblit v1.8.0