From 08d858716ad674ebe81e9c11c62c9ec4b6ce8d87 Mon Sep 17 00:00:00 2001 From: wangpengfei <274878379@qq.com> Date: 星期四, 17 八月 2023 20:00:45 +0800 Subject: [PATCH] add --- model/request/masterOrder.go | 4 model/contract.go | 4 model/request/subOrder.go | 4 api/v1/contract.go | 11 docs/swagger.yaml | 80 ++++++-- api/v1/quotation.go | 11 model/masterOrder.go | 4 conf/aps-crm.json | 2 model/request/contract.go | 4 service/contract.go | 22 +- model/subOrder.go | 4 service/saleChance.go | 24 +- api/v1/subOrder.go | 11 api/v1/masterOrder.go | 11 model/request/saleChance.go | 4 model/saleChance.go | 4 service/masterOrder.go | 22 +- model/quotation.go | 4 docs/docs.go | 115 ++++++++++-- docs/swagger.json | 115 ++++++++++-- api/v1/saleChance.go | 11 router/saleChance.go | 10 service/quotation.go | 22 +- service/subOrder.go | 22 +- router/quotation.go | 10 model/request/quotation.go | 4 26 files changed, 361 insertions(+), 178 deletions(-) diff --git a/api/v1/contract.go b/api/v1/contract.go index 4b94771..ff42186 100644 --- a/api/v1/contract.go +++ b/api/v1/contract.go @@ -7,7 +7,6 @@ "aps_crm/pkg/contextx" "aps_crm/pkg/ecode" "github.com/gin-gonic/gin" - "strconv" ) type ContractApi struct{} @@ -47,17 +46,17 @@ // @Tags Contract // @Summary 鍒犻櫎鍚堝悓 // @Produce application/json -// @Param id path int true "鏌ヨ鍙傛暟" +// @Param object body request.DeleteContract true "鏌ヨ鍙傛暟" // @Success 200 {object} contextx.Response{} -// @Router /api/contract/delete/{id} [delete] +// @Router /api/contract/delete [delete] func (s *ContractApi) Delete(c *gin.Context) { - ctx, ok := contextx.NewContext(c, nil) + var params request.DeleteContract + ctx, ok := contextx.NewContext(c, ¶ms) if !ok { return } - id, _ := strconv.Atoi(c.Param("id")) - errCode := contractService.DeleteContract(id) + errCode := contractService.DeleteContract(params.Ids) if errCode != ecode.OK { ctx.Fail(errCode) return diff --git a/api/v1/masterOrder.go b/api/v1/masterOrder.go index eedae04..ec53bae 100644 --- a/api/v1/masterOrder.go +++ b/api/v1/masterOrder.go @@ -7,7 +7,6 @@ "aps_crm/pkg/contextx" "aps_crm/pkg/ecode" "github.com/gin-gonic/gin" - "strconv" ) type MasterOrderApi struct{} @@ -47,17 +46,17 @@ // @Tags MasterOrder // @Summary 鍒犻櫎涓昏鍗� // @Produce application/json -// @Param id path int true "鏌ヨ鍙傛暟" +// @Param object body request.DeleteMasterOrder true "鏌ヨ鍙傛暟" // @Success 200 {object} contextx.Response{} -// @Router /api/masterOrder/delete/{id} [delete] +// @Router /api/masterOrder/delete [delete] func (s *MasterOrderApi) Delete(c *gin.Context) { - ctx, ok := contextx.NewContext(c, nil) + var params request.DeleteMasterOrder + ctx, ok := contextx.NewContext(c, ¶ms) if !ok { return } - id, _ := strconv.Atoi(c.Param("id")) - errCode := masterOrderService.DeleteMasterOrder(id) + errCode := masterOrderService.DeleteMasterOrder(params.Ids) if errCode != ecode.OK { ctx.Fail(errCode) return diff --git a/api/v1/quotation.go b/api/v1/quotation.go index 724da4f..8f8a4f4 100644 --- a/api/v1/quotation.go +++ b/api/v1/quotation.go @@ -7,7 +7,6 @@ "aps_crm/pkg/contextx" "aps_crm/pkg/ecode" "github.com/gin-gonic/gin" - "strconv" ) type QuotationApi struct{} @@ -47,17 +46,17 @@ // @Tags Quotation // @Summary 鍒犻櫎鎶ヤ环鍗� // @Produce application/json -// @Param id path int true "鏌ヨ鍙傛暟" +// @Param object body request.DeleteQuotation true "鏌ヨ鍙傛暟" // @Success 200 {object} contextx.Response{} -// @Router /api/quotation/delete/{id} [delete] +// @Router /api/quotation/delete [delete] func (s *QuotationApi) Delete(c *gin.Context) { - ctx, ok := contextx.NewContext(c, nil) + var params request.DeleteQuotation + ctx, ok := contextx.NewContext(c, ¶ms) if !ok { return } - id, _ := strconv.Atoi(c.Param("id")) - errCode := quotationService.DeleteQuotation(id) + errCode := quotationService.DeleteQuotation(params.Ids) if errCode != ecode.OK { ctx.Fail(errCode) return diff --git a/api/v1/saleChance.go b/api/v1/saleChance.go index 06712c1..6c9d8dc 100644 --- a/api/v1/saleChance.go +++ b/api/v1/saleChance.go @@ -7,7 +7,6 @@ "aps_crm/pkg/contextx" "aps_crm/pkg/ecode" "github.com/gin-gonic/gin" - "strconv" ) type SaleChanceApi struct{} @@ -47,17 +46,17 @@ // @Tags SaleChance // @Summary 鍒犻櫎閿�鍞満浼� // @Produce application/json -// @Param id path int true "鏌ヨ鍙傛暟" +// @Param object body request.DeleteSaleChance true "鏌ヨ鍙傛暟" // @Success 200 {object} contextx.Response{} -// @Router /api/saleChance/delete/{id} [delete] +// @Router /api/saleChance/delete [delete] func (s *SaleChanceApi) Delete(c *gin.Context) { - ctx, ok := contextx.NewContext(c, nil) + var params request.DeleteSaleChance + ctx, ok := contextx.NewContext(c, ¶ms) if !ok { return } - id, _ := strconv.Atoi(c.Param("id")) - errCode := saleChanceService.DeleteSaleChance(id) + errCode := saleChanceService.DeleteSaleChance(params.Ids) if errCode != ecode.OK { ctx.Fail(errCode) return diff --git a/api/v1/subOrder.go b/api/v1/subOrder.go index 8d804fe..d6bdf6c 100644 --- a/api/v1/subOrder.go +++ b/api/v1/subOrder.go @@ -7,7 +7,6 @@ "aps_crm/pkg/contextx" "aps_crm/pkg/ecode" "github.com/gin-gonic/gin" - "strconv" ) type SubOrderApi struct{} @@ -47,17 +46,17 @@ // @Tags SubOrder // @Summary 鍒犻櫎瀛愯鍗� // @Produce application/json -// @Param id path int true "鏌ヨ鍙傛暟" +// @Param object body request.DeleteSubOrder true "鏌ヨ鍙傛暟" // @Success 200 {object} contextx.Response{} -// @Router /api/subOrder/delete/{id} [delete] +// @Router /api/subOrder/delete [delete] func (s *SubOrderApi) Delete(c *gin.Context) { - ctx, ok := contextx.NewContext(c, nil) + var params request.DeleteSubOrder + ctx, ok := contextx.NewContext(c, ¶ms) if !ok { return } - id, _ := strconv.Atoi(c.Param("id")) - errCode := subOrderService.DeleteSubOrder(id) + errCode := subOrderService.DeleteSubOrder(params.Ids) if errCode != ecode.OK { ctx.Fail(errCode) return diff --git a/conf/aps-crm.json b/conf/aps-crm.json index 60a7b07..d8f9bfe 100644 --- a/conf/aps-crm.json +++ b/conf/aps-crm.json @@ -49,7 +49,7 @@ }, "GrpcServiceAddr": { "Aps": "192.168.20.120:9091", - "Admin": "192.168.20.118:50051" + "Admin": "192.168.20.120:50051" } } diff --git a/docs/docs.go b/docs/docs.go index b27e16a..8e316af 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -1586,7 +1586,7 @@ } } }, - "/api/contract/delete/{id}": { + "/api/contract/delete": { "delete": { "produces": [ "application/json" @@ -1597,11 +1597,13 @@ "summary": "鍒犻櫎鍚堝悓", "parameters": [ { - "type": "integer", "description": "鏌ヨ鍙傛暟", - "name": "id", - "in": "path", - "required": true + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.DeleteContract" + } } ], "responses": { @@ -4008,7 +4010,7 @@ } } }, - "/api/masterOrder/delete/{id}": { + "/api/masterOrder/delete": { "delete": { "produces": [ "application/json" @@ -4019,11 +4021,13 @@ "summary": "鍒犻櫎涓昏鍗�", "parameters": [ { - "type": "integer", "description": "鏌ヨ鍙傛暟", - "name": "id", - "in": "path", - "required": true + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.DeleteMasterOrder" + } } ], "responses": { @@ -5226,7 +5230,7 @@ } } }, - "/api/quotation/delete/{id}": { + "/api/quotation/delete": { "delete": { "produces": [ "application/json" @@ -5237,11 +5241,13 @@ "summary": "鍒犻櫎鎶ヤ环鍗�", "parameters": [ { - "type": "integer", "description": "鏌ヨ鍙傛暟", - "name": "id", - "in": "path", - "required": true + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.DeleteQuotation" + } } ], "responses": { @@ -6379,7 +6385,7 @@ } } }, - "/api/saleChance/delete/{id}": { + "/api/saleChance/delete": { "delete": { "produces": [ "application/json" @@ -6390,11 +6396,13 @@ "summary": "鍒犻櫎閿�鍞満浼�", "parameters": [ { - "type": "integer", "description": "鏌ヨ鍙傛暟", - "name": "id", - "in": "path", - "required": true + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.DeleteSaleChance" + } } ], "responses": { @@ -9336,7 +9344,7 @@ } } }, - "/api/subOrder/delete/{id}": { + "/api/subOrder/delete": { "delete": { "produces": [ "application/json" @@ -9347,11 +9355,13 @@ "summary": "鍒犻櫎瀛愯鍗�", "parameters": [ { - "type": "integer", "description": "鏌ヨ鍙傛暟", - "name": "id", - "in": "path", - "required": true + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.DeleteSubOrder" + } } ], "responses": { @@ -14869,6 +14879,17 @@ } } }, + "request.DeleteContract": { + "type": "object", + "properties": { + "ids": { + "type": "array", + "items": { + "type": "integer" + } + } + } + }, "request.DeleteCountry": { "type": "object", "properties": { @@ -14889,7 +14910,40 @@ } } }, + "request.DeleteMasterOrder": { + "type": "object", + "properties": { + "ids": { + "type": "array", + "items": { + "type": "integer" + } + } + } + }, "request.DeleteOrderManage": { + "type": "object", + "properties": { + "ids": { + "type": "array", + "items": { + "type": "integer" + } + } + } + }, + "request.DeleteQuotation": { + "type": "object", + "properties": { + "ids": { + "type": "array", + "items": { + "type": "integer" + } + } + } + }, + "request.DeleteSaleChance": { "type": "object", "properties": { "ids": { @@ -14933,6 +14987,17 @@ } } }, + "request.DeleteSubOrder": { + "type": "object", + "properties": { + "ids": { + "type": "array", + "items": { + "type": "integer" + } + } + } + }, "request.DeleteUserReq": { "type": "object", "properties": { diff --git a/docs/swagger.json b/docs/swagger.json index 2da091d..e93cf4a 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -1574,7 +1574,7 @@ } } }, - "/api/contract/delete/{id}": { + "/api/contract/delete": { "delete": { "produces": [ "application/json" @@ -1585,11 +1585,13 @@ "summary": "鍒犻櫎鍚堝悓", "parameters": [ { - "type": "integer", "description": "鏌ヨ鍙傛暟", - "name": "id", - "in": "path", - "required": true + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.DeleteContract" + } } ], "responses": { @@ -3996,7 +3998,7 @@ } } }, - "/api/masterOrder/delete/{id}": { + "/api/masterOrder/delete": { "delete": { "produces": [ "application/json" @@ -4007,11 +4009,13 @@ "summary": "鍒犻櫎涓昏鍗�", "parameters": [ { - "type": "integer", "description": "鏌ヨ鍙傛暟", - "name": "id", - "in": "path", - "required": true + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.DeleteMasterOrder" + } } ], "responses": { @@ -5214,7 +5218,7 @@ } } }, - "/api/quotation/delete/{id}": { + "/api/quotation/delete": { "delete": { "produces": [ "application/json" @@ -5225,11 +5229,13 @@ "summary": "鍒犻櫎鎶ヤ环鍗�", "parameters": [ { - "type": "integer", "description": "鏌ヨ鍙傛暟", - "name": "id", - "in": "path", - "required": true + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.DeleteQuotation" + } } ], "responses": { @@ -6367,7 +6373,7 @@ } } }, - "/api/saleChance/delete/{id}": { + "/api/saleChance/delete": { "delete": { "produces": [ "application/json" @@ -6378,11 +6384,13 @@ "summary": "鍒犻櫎閿�鍞満浼�", "parameters": [ { - "type": "integer", "description": "鏌ヨ鍙傛暟", - "name": "id", - "in": "path", - "required": true + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.DeleteSaleChance" + } } ], "responses": { @@ -9324,7 +9332,7 @@ } } }, - "/api/subOrder/delete/{id}": { + "/api/subOrder/delete": { "delete": { "produces": [ "application/json" @@ -9335,11 +9343,13 @@ "summary": "鍒犻櫎瀛愯鍗�", "parameters": [ { - "type": "integer", "description": "鏌ヨ鍙傛暟", - "name": "id", - "in": "path", - "required": true + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.DeleteSubOrder" + } } ], "responses": { @@ -14857,6 +14867,17 @@ } } }, + "request.DeleteContract": { + "type": "object", + "properties": { + "ids": { + "type": "array", + "items": { + "type": "integer" + } + } + } + }, "request.DeleteCountry": { "type": "object", "properties": { @@ -14877,7 +14898,40 @@ } } }, + "request.DeleteMasterOrder": { + "type": "object", + "properties": { + "ids": { + "type": "array", + "items": { + "type": "integer" + } + } + } + }, "request.DeleteOrderManage": { + "type": "object", + "properties": { + "ids": { + "type": "array", + "items": { + "type": "integer" + } + } + } + }, + "request.DeleteQuotation": { + "type": "object", + "properties": { + "ids": { + "type": "array", + "items": { + "type": "integer" + } + } + } + }, + "request.DeleteSaleChance": { "type": "object", "properties": { "ids": { @@ -14921,6 +14975,17 @@ } } }, + "request.DeleteSubOrder": { + "type": "object", + "properties": { + "ids": { + "type": "array", + "items": { + "type": "integer" + } + } + } + }, "request.DeleteUserReq": { "type": "object", "properties": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index d250e2d..7ec1d54 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -3227,6 +3227,13 @@ type: integer type: array type: object + request.DeleteContract: + properties: + ids: + items: + type: integer + type: array + type: object request.DeleteCountry: properties: id: @@ -3240,7 +3247,28 @@ type: integer type: array type: object + request.DeleteMasterOrder: + properties: + ids: + items: + type: integer + type: array + type: object request.DeleteOrderManage: + properties: + ids: + items: + type: integer + type: array + type: object + request.DeleteQuotation: + properties: + ids: + items: + type: integer + type: array + type: object + request.DeleteSaleChance: properties: ids: items: @@ -3262,6 +3290,13 @@ type: array type: object request.DeleteServiceFollowup: + properties: + ids: + items: + type: integer + type: array + type: object + request.DeleteSubOrder: properties: ids: items: @@ -6928,14 +6963,15 @@ summary: 娣诲姞鍚堝悓 tags: - Contract - /api/contract/delete/{id}: + /api/contract/delete: delete: parameters: - description: 鏌ヨ鍙傛暟 - in: path - name: id + in: body + name: object required: true - type: integer + schema: + $ref: '#/definitions/request.DeleteContract' produces: - application/json responses: @@ -8421,14 +8457,15 @@ summary: 娣诲姞涓昏鍗� tags: - MasterOrder - /api/masterOrder/delete/{id}: + /api/masterOrder/delete: delete: parameters: - description: 鏌ヨ鍙傛暟 - in: path - name: id + in: body + name: object required: true - type: integer + schema: + $ref: '#/definitions/request.DeleteMasterOrder' produces: - application/json responses: @@ -9166,14 +9203,15 @@ summary: 娣诲姞鎶ヤ环鍗� tags: - Quotation - /api/quotation/delete/{id}: + /api/quotation/delete: delete: parameters: - description: 鏌ヨ鍙傛暟 - in: path - name: id + in: body + name: object required: true - type: integer + schema: + $ref: '#/definitions/request.DeleteQuotation' produces: - application/json responses: @@ -9878,14 +9916,15 @@ summary: 娣诲姞閿�鍞満浼� tags: - SaleChance - /api/saleChance/delete/{id}: + /api/saleChance/delete: delete: parameters: - description: 鏌ヨ鍙傛暟 - in: path - name: id + in: body + name: object required: true - type: integer + schema: + $ref: '#/definitions/request.DeleteSaleChance' produces: - application/json responses: @@ -11701,14 +11740,15 @@ summary: 娣诲姞瀛愯鍗� tags: - SubOrder - /api/subOrder/delete/{id}: + /api/subOrder/delete: delete: parameters: - description: 鏌ヨ鍙傛暟 - in: path - name: id + in: body + name: object required: true - type: integer + schema: + $ref: '#/definitions/request.DeleteSubOrder' produces: - application/json responses: diff --git a/model/contract.go b/model/contract.go index 1bef87d..dbf992c 100644 --- a/model/contract.go +++ b/model/contract.go @@ -135,3 +135,7 @@ slf.SearchMap = data return slf } +func (slf *ContractSearch) SetIds(ids []int) *ContractSearch { + slf.Orm = slf.Orm.Where("id in (?)", ids) + return slf +} diff --git a/model/masterOrder.go b/model/masterOrder.go index 4441cc3..f33fd6c 100644 --- a/model/masterOrder.go +++ b/model/masterOrder.go @@ -131,3 +131,7 @@ slf.SearchMap = searchMap return slf } +func (slf *MasterOrderSearch) SetIds(ids []int) *MasterOrderSearch { + slf.Orm = slf.Orm.Where("id in (?)", ids) + return slf +} diff --git a/model/quotation.go b/model/quotation.go index 99d70fe..68a0df0 100644 --- a/model/quotation.go +++ b/model/quotation.go @@ -147,3 +147,7 @@ slf.SearchMap = searchMap return slf } +func (slf *QuotationSearch) SetIds(ids []int) *QuotationSearch { + slf.Orm = slf.Orm.Where("id in (?)", ids) + return slf +} diff --git a/model/request/contract.go b/model/request/contract.go index 8480054..701f75c 100644 --- a/model/request/contract.go +++ b/model/request/contract.go @@ -22,3 +22,7 @@ PageInfo SearchMap map[string]interface{} `json:"search_map"` // 鎼滅储鏉′欢: map[string]interface{} {"member_name": "閿�鍞礋璐d汉", "number": "鍚堝悓缂栧彿", "created_at": "鍒涘缓鏃堕棿"} } + +type DeleteContract struct { + Ids []int `json:"ids"` +} diff --git a/model/request/masterOrder.go b/model/request/masterOrder.go index c5df7c0..6cecb35 100644 --- a/model/request/masterOrder.go +++ b/model/request/masterOrder.go @@ -22,3 +22,7 @@ PageInfo SearchMap map[string]interface{} `json:"search_map"` // 鎼滅储鏉′欢: map[string]interface{}{"name": "xxx"}; {"number": "閿�鍞�诲崟鍙�", "client_name": "瀹㈡埛鍚嶇О", "member_name": "閿�鍞礋璐d汉", "start_time": "寮�濮嬫椂闂�", "end_time": "缁撴潫鏃堕棿", "money": "鎬婚噾棰�", "member_name": "璐熻矗浜�"} } + +type DeleteMasterOrder struct { + Ids []int `json:"ids"` +} diff --git a/model/request/quotation.go b/model/request/quotation.go index f534363..ec532c8 100644 --- a/model/request/quotation.go +++ b/model/request/quotation.go @@ -28,3 +28,7 @@ PageInfo SearchMap map[string]interface{} `json:"search_map"` // 鎼滅储鏉′欢: map[string]interface{}{"name": "xxx"}; {"sale_chance_id": 閿�鍞嚎绱d, "client_name": "瀹㈡埛鍚嶇О", "member_name": "閿�鍞礋璐d汉", "contact_name": "鑱旂郴浜�", "validity_date": "鏈夋晥鏈�"} } + +type DeleteQuotation struct { + Ids []int `json:"ids"` +} diff --git a/model/request/saleChance.go b/model/request/saleChance.go index 83f3ee1..6b7fe11 100644 --- a/model/request/saleChance.go +++ b/model/request/saleChance.go @@ -51,3 +51,7 @@ Id int `json:"id" binding:"required"` Step int `json:"step" binding:"required"` } + +type DeleteSaleChance struct { + Ids []int `json:"ids"` +} diff --git a/model/request/subOrder.go b/model/request/subOrder.go index 235da4a..f077528 100644 --- a/model/request/subOrder.go +++ b/model/request/subOrder.go @@ -23,3 +23,7 @@ PageInfo SearchMap map[string]interface{} `json:"search_map"` // 鎼滅储鏉′欢: map[string]interface{}{"name": "xxx"}; {"number": "閿�鍞瓙鍗曞彿", "client_name": "瀹㈡埛鍚嶇О", "master_order_number": "閿�鍞�诲崟鍙�", "member_name": "閿�鍞礋璐d汉", "master_order_id": "閿�鍞�诲崟id"} } + +type DeleteSubOrder struct { + Ids []int `json:"ids"` +} diff --git a/model/saleChance.go b/model/saleChance.go index 175ac2a..ee9d86b 100644 --- a/model/saleChance.go +++ b/model/saleChance.go @@ -185,3 +185,7 @@ slf.SearchMap = searchMap return slf } +func (slf *SaleChanceSearch) SetIds(ids []int) *SaleChanceSearch { + slf.Orm = slf.Orm.Where("id in (?)", ids) + return slf +} diff --git a/model/subOrder.go b/model/subOrder.go index 16d2b82..85ad0ce 100644 --- a/model/subOrder.go +++ b/model/subOrder.go @@ -132,3 +132,7 @@ slf.SearchMap = data return slf } +func (slf *SubOrderSearch) SetIds(ids []int) *SubOrderSearch { + slf.Orm = slf.Orm.Where("id in (?)", ids) + return slf +} diff --git a/router/quotation.go b/router/quotation.go index c5672e8..83068cd 100644 --- a/router/quotation.go +++ b/router/quotation.go @@ -11,9 +11,9 @@ quotationRouter := router.Group("quotation") quotationApi := v1.ApiGroup.QuotationApi { - quotationRouter.POST("add", quotationApi.Add) // 娣诲姞鎶ヤ环鍗� - quotationRouter.DELETE("delete/:id", quotationApi.Delete) // 鍒犻櫎鎶ヤ环鍗� - quotationRouter.PUT("update", quotationApi.Update) // 鏇存柊鎶ヤ环鍗� - quotationRouter.POST("list", quotationApi.List) // 鑾峰彇鎶ヤ环鍗曞垪琛� + quotationRouter.POST("add", quotationApi.Add) // 娣诲姞鎶ヤ环鍗� + quotationRouter.DELETE("delete", quotationApi.Delete) // 鍒犻櫎鎶ヤ环鍗� + quotationRouter.PUT("update", quotationApi.Update) // 鏇存柊鎶ヤ环鍗� + quotationRouter.POST("list", quotationApi.List) // 鑾峰彇鎶ヤ环鍗曞垪琛� } -} \ No newline at end of file +} diff --git a/router/saleChance.go b/router/saleChance.go index 93cc68a..f4c968a 100644 --- a/router/saleChance.go +++ b/router/saleChance.go @@ -11,10 +11,10 @@ saleChanceRouter := router.Group("saleChance") saleChanceApi := v1.ApiGroup.SaleChanceApi { - saleChanceRouter.POST("add", saleChanceApi.Add) // 娣诲姞閿�鍞満浼� - saleChanceRouter.DELETE("delete/:id", saleChanceApi.Delete) // 鍒犻櫎閿�鍞満浼� - saleChanceRouter.PUT("update", saleChanceApi.Update) // 鏇存柊閿�鍞満浼� - saleChanceRouter.POST("list", saleChanceApi.List) // 鑾峰彇閿�鍞満浼氬垪琛� - saleChanceRouter.PUT("push", saleChanceApi.Push) // 鎺ㄨ繘閿�鍞満浼� + saleChanceRouter.POST("add", saleChanceApi.Add) // 娣诲姞閿�鍞満浼� + saleChanceRouter.DELETE("delete", saleChanceApi.Delete) // 鍒犻櫎閿�鍞満浼� + saleChanceRouter.PUT("update", saleChanceApi.Update) // 鏇存柊閿�鍞満浼� + saleChanceRouter.POST("list", saleChanceApi.List) // 鑾峰彇閿�鍞満浼氬垪琛� + saleChanceRouter.PUT("push", saleChanceApi.Push) // 鎺ㄨ繘閿�鍞満浼� } } diff --git a/service/contract.go b/service/contract.go index b966dce..2072299 100644 --- a/service/contract.go +++ b/service/contract.go @@ -16,19 +16,6 @@ return ecode.OK } -func (ContractService) DeleteContract(id int) int { - _, err := model.NewContractSearch().SetId(id).Find() - if err != nil { - return ecode.ContractNotExist - } - - err = model.NewContractSearch().SetId(id).Delete() - if err != nil { - return ecode.ContractNotExist - } - return ecode.OK -} - func (ContractService) UpdateContract(contract *model.Contract) int { // check contract exist _, err := model.NewContractSearch().SetId(contract.Id).Find() @@ -52,3 +39,12 @@ } return contacts, total, ecode.OK } + +func (ContractService) DeleteContract(ids []int) int { + // delete client + err := model.NewContractSearch().SetIds(ids).Delete() + if err != nil { + return ecode.ContractDeleteErr + } + return ecode.OK +} diff --git a/service/masterOrder.go b/service/masterOrder.go index 1c36a33..4836e3a 100644 --- a/service/masterOrder.go +++ b/service/masterOrder.go @@ -16,19 +16,6 @@ return ecode.OK } -func (MasterOrderService) DeleteMasterOrder(id int) int { - _, err := model.NewMasterOrderSearch().SetId(id).Find() - if err != nil { - return ecode.MasterOrderNotExist - } - - err = model.NewMasterOrderSearch().SetId(id).Delete() - if err != nil { - return ecode.MasterOrderNotExist - } - return ecode.OK -} - func (MasterOrderService) UpdateMasterOrder(masterOrder *model.MasterOrder) int { // check masterOrder exist _, err := model.NewMasterOrderSearch().SetId(masterOrder.Id).Find() @@ -52,3 +39,12 @@ } return contacts, total, ecode.OK } + +func (MasterOrderService) DeleteMasterOrder(ids []int) int { + // delete client + err := model.NewMasterOrderSearch().SetIds(ids).Delete() + if err != nil { + return ecode.MasterOrderDeleteErr + } + return ecode.OK +} diff --git a/service/quotation.go b/service/quotation.go index d1b3935..f0bbdbe 100644 --- a/service/quotation.go +++ b/service/quotation.go @@ -16,19 +16,6 @@ return ecode.OK } -func (QuotationService) DeleteQuotation(id int) int { - _, err := model.NewQuotationSearch().SetId(id).Find() - if err != nil { - return ecode.QuotationNotExist - } - - err = model.NewQuotationSearch().SetId(id).Delete() - if err != nil { - return ecode.QuotationNotExist - } - return ecode.OK -} - func (QuotationService) UpdateQuotation(quotation *model.Quotation) int { // check quotation exist _, err := model.NewQuotationSearch().SetId(quotation.Id).Find() @@ -52,3 +39,12 @@ } return contacts, total, ecode.OK } + +func (QuotationService) DeleteQuotation(ids []int) int { + // delete client + err := model.NewQuotationSearch().SetIds(ids).Delete() + if err != nil { + return ecode.QuotationDeleteErr + } + return ecode.OK +} diff --git a/service/saleChance.go b/service/saleChance.go index 2c62a4f..1610c07 100644 --- a/service/saleChance.go +++ b/service/saleChance.go @@ -15,21 +15,6 @@ return ecode.OK } -func (SaleChanceService) DeleteSaleChance(id int) int { - // check saleChange exist - _, err := model.NewSaleChanceSearch().SetId(id).Find() - if err != nil { - return ecode.SaleChanceNotExist - } - - // delete saleChange - err = model.NewSaleChanceSearch().SetId(id).Delete() - if err != nil { - return ecode.SaleChanceDeleteErr - } - return ecode.OK -} - func (SaleChanceService) UpdateSaleChance(saleChange *model.SaleChance) int { // update saleChange err := model.NewSaleChanceSearch().SetId(saleChange.Id).Update(saleChange) @@ -84,3 +69,12 @@ return ecode.OK } + +func (SaleChanceService) DeleteSaleChance(ids []int) int { + // delete client + err := model.NewSaleChanceSearch().SetIds(ids).Delete() + if err != nil { + return ecode.SaleChanceDeleteErr + } + return ecode.OK +} diff --git a/service/subOrder.go b/service/subOrder.go index 0f23c74..183f8e5 100644 --- a/service/subOrder.go +++ b/service/subOrder.go @@ -16,19 +16,6 @@ return ecode.OK } -func (SubOrderService) DeleteSubOrder(id int) int { - _, err := model.NewSubOrderSearch().SetId(id).Find() - if err != nil { - return ecode.SubOrderNotExist - } - - err = model.NewSubOrderSearch().SetId(id).Delete() - if err != nil { - return ecode.SubOrderNotExist - } - return ecode.OK -} - func (SubOrderService) UpdateSubOrder(subOrder *model.SubOrder) int { // check subOrder exist _, err := model.NewSubOrderSearch().SetId(subOrder.Id).Find() @@ -52,3 +39,12 @@ } return contacts, total, ecode.OK } + +func (SubOrderService) DeleteSubOrder(ids []int) int { + // delete client + err := model.NewSubOrderSearch().SetIds(ids).Delete() + if err != nil { + return ecode.SubOrderDeleteErr + } + return ecode.OK +} -- Gitblit v1.8.0