From 0409a5d0235f4a87ecf08b12baa9149279a90447 Mon Sep 17 00:00:00 2001
From: wangpengfei <274878379@qq.com>
Date: 星期五, 18 八月 2023 22:25:58 +0800
Subject: [PATCH] fix
---
api/v1/salesReturn.go | 45 +++++++++++++++++++++++++++++++++++++++------
1 files changed, 39 insertions(+), 6 deletions(-)
diff --git a/api/v1/salesReturn.go b/api/v1/salesReturn.go
index e0c7990..5e84ff5 100644
--- a/api/v1/salesReturn.go
+++ b/api/v1/salesReturn.go
@@ -8,13 +8,14 @@
"aps_crm/pkg/ecode"
"github.com/gin-gonic/gin"
"strconv"
+ "strings"
)
type SalesReturnApi struct{}
// Add
//
-// @Tags SalesReturn
+// @Tags 閿�鍞��璐у崟
// @Summary 娣诲姞閿�鍞��璐�
// @Produce application/json
// @Param object body request.AddSalesReturnRequest true "鏌ヨ鍙傛暟"
@@ -44,7 +45,7 @@
// Delete
//
-// @Tags SalesReturn
+// @Tags 閿�鍞��璐у崟
// @Summary 鍒犻櫎閿�鍞��璐�
// @Produce application/json
// @Param id path int true "鏌ヨ鍙傛暟"
@@ -66,9 +67,39 @@
ctx.Ok()
}
+// BatchDelete
+// @Tags 閿�鍞��璐у崟
+// @Summary 鎵归噺鍒犻櫎閿�鍞��璐у崟
+// @Produce application/json
+// @Param object body request.CommonIds true "鍙傛暟"
+// @Success 200 {object} contextx.Response{}
+// @Router /api/salesReturn/delete [delete]
+func (s *SalesReturnApi) BatchDelete(c *gin.Context) {
+ var params request.CommonIds
+ ctx, ok := contextx.NewContext(c, ¶ms)
+ if !ok {
+ return
+ }
+ failIds, _ := salesReturnService.BatchDeleteSalesReturn(params.Ids)
+ if len(failIds) == 0 {
+ ctx.Ok()
+ return
+ }
+ salesReturns, code := salesReturnService.GetSalesReturnListByIds(failIds)
+ if code != ecode.OK {
+ ctx.Ok()
+ return
+ }
+ var numbers []string
+ for _, salesReturn := range salesReturns {
+ numbers = append(numbers, salesReturn.Number)
+ }
+ ctx.FailWithMsg(ecode.DBErr, strings.Join(numbers, ",")+"鍒犻櫎澶辫触")
+}
+
// Update
//
-// @Tags SalesReturn
+// @Tags 閿�鍞��璐у崟
// @Summary 鏇存柊閿�鍞��璐�
// @Produce application/json
// @Param object body request.UpdateSalesReturnRequest true "鏌ヨ鍙傛暟"
@@ -126,10 +157,12 @@
// List
//
-// @Tags SalesReturn
+// @Tags 閿�鍞��璐у崟
// @Summary 閿�鍞��璐у崟鍒楄〃
// @Produce application/json
-// @Param object body request.GetSalesReturnList true "鍙傛暟"
+//
+// @Param object body request.GetSalesReturnList true "鍙傛暟"
+//
// @Success 200 {object} contextx.Response{data=response.SalesReturnResponse}
// @Router /api/salesReturn/list [post]
func (con *SalesReturnApi) List(c *gin.Context) {
@@ -139,7 +172,7 @@
return
}
- salesReturns, total, errCode := salesReturnService.GetSalesReturnList(params.Page, params.PageSize, params.Keyword)
+ salesReturns, total, errCode := salesReturnService.GetSalesReturnList(params.Page, params.PageSize, params.KeywordType, params.Keyword)
if errCode != ecode.OK {
ctx.Fail(errCode)
return
--
Gitblit v1.8.0