From b0c07ddee23e2d54d03636f08af19f0934857cf4 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期五, 25 八月 2023 10:32:56 +0800
Subject: [PATCH] Merge branch 'hotfix'
---
api/v1/salesReturn.go | 39 +++++++++++++++++++++++++++++++++++----
1 files changed, 35 insertions(+), 4 deletions(-)
diff --git a/api/v1/salesReturn.go b/api/v1/salesReturn.go
index 2a55b45..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,7 +157,7 @@
// List
//
-// @Tags SalesReturn
+// @Tags 閿�鍞��璐у崟
// @Summary 閿�鍞��璐у崟鍒楄〃
// @Produce application/json
//
--
Gitblit v1.8.0