From 6f52e069fe72b4e37b0712a7e097e3af97bbc25e Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期一, 07 八月 2023 10:22:11 +0800 Subject: [PATCH] 收款计划兼容其他模块 --- api/v1/serviceContract.go | 52 +++++++++++++++++++++++++++------------------------- 1 files changed, 27 insertions(+), 25 deletions(-) diff --git a/api/v1/serviceContract.go b/api/v1/serviceContract.go index b04b77d..cd5e4f6 100644 --- a/api/v1/serviceContract.go +++ b/api/v1/serviceContract.go @@ -26,7 +26,6 @@ if !ok { return } - errCode, serviceContract := checkServiceContractParams(params.ServiceContract) if errCode != ecode.OK { ctx.Fail(errCode) @@ -98,30 +97,6 @@ ctx.Ok() } -// List -// -// @Tags ServiceContract -// @Summary 鏈嶅姟鍚堝悓鍒楄〃 -// @Produce application/json -// @Success 200 {object} contextx.Response{data=response.ServiceContractsResponse} -// @Router /api/serviceContract/list [get] -func (s *ServiceContractApi) List(c *gin.Context) { - ctx, ok := contextx.NewContext(c, nil) - if !ok { - return - } - - serviceContracts, errCode := serviceContractService.GetServiceContractList() - if errCode != ecode.OK { - ctx.Fail(errCode) - return - } - - ctx.OkWithDetailed(response.ServiceContractsResponse{ - List: serviceContracts, - }) -} - // check params func checkServiceContractParams(serviceContract request.ServiceContract) (errCode int, result model.ServiceContract) { //if serviceContract.SignTime == "" { @@ -172,3 +147,30 @@ return ecode.OK, result } + +// List +// +// @Tags ServiceContract +// @Summary 鐢熸垚璁″垝鍒楄〃 +// @Produce application/json +// @Param object body request.GetServiceContractList true "鍙傛暟" +// @Success 200 {object} contextx.Response{data=response.ServiceContractsResponse} +// @Router /api/serviceContract/list [post] +func (con *ServiceContractApi) List(c *gin.Context) { + var params request.GetServiceContractList + ctx, ok := contextx.NewContext(c, ¶ms) + if !ok { + return + } + + serviceContracts, total, errCode := serviceContractService.GetServiceContractList(params.Page, params.PageSize, params.QueryClass, params.KeywordType, params.Keyword) + if errCode != ecode.OK { + ctx.Fail(errCode) + return + } + + ctx.OkWithDetailed(response.ServiceContractsResponse{ + List: serviceContracts, + Count: int(total), + }) +} -- Gitblit v1.8.0