From b90ad3946fdf84ccf9ad4d5d2e493e0e6c00b96a Mon Sep 17 00:00:00 2001 From: wangpengfei <274878379@qq.com> Date: 星期四, 03 八月 2023 11:47:16 +0800 Subject: [PATCH] fix --- api/v1/serviceFeeManage.go | 16 - model/request/serviceFeeManage.go | 4 docs/swagger.yaml | 64 ++++++-- service/serviceFollowup.go | 22 +- docs/docs.go | 92 +++++++++-- docs/swagger.json | 92 +++++++++-- service/serviceFeeManage.go | 22 +- model/orderManage.go | 6 model/serviceFollowup.go | 6 router/serviceContract.go | 2 model/serviceContract.go | 6 service/orderManage.go | 22 +- router/serviceFollowup.go | 10 model/serviceFeeManage.go | 6 model/request/orderManage.go | 4 router/serviceFeeManage.go | 2 api/v1/serviceContract.go | 13 model/request/serviceFollowup.go | 4 model/request/serviceContract.go | 4 api/v1/orderManage.go | 16 - service/serviceContract.go | 22 +- api/v1/serviceFollowup.go | 16 - 22 files changed, 298 insertions(+), 153 deletions(-) diff --git a/api/v1/orderManage.go b/api/v1/orderManage.go index 0a5d9c4..204c61d 100644 --- a/api/v1/orderManage.go +++ b/api/v1/orderManage.go @@ -7,7 +7,6 @@ "aps_crm/pkg/contextx" "aps_crm/pkg/ecode" "github.com/gin-gonic/gin" - "strconv" ) type OrderManageApi struct{} @@ -47,17 +46,17 @@ // @Tags OrderManage // @Summary 鍒犻櫎宸ュ崟 // @Produce application/json -// @Param id path int true "鏌ヨ鍙傛暟" +// @Param object body request.DeleteOrderManage true "鏌ヨ鍙傛暟" // @Success 200 {object} contextx.Response{} -// @Router /api/orderManage/delete/{id} [delete] +// @Router /api/orderManage/delete [delete] func (o *OrderManageApi) Delete(c *gin.Context) { - ctx, ok := contextx.NewContext(c, nil) + var params request.DeleteOrderManage + ctx, ok := contextx.NewContext(c, ¶ms) if !ok { return } - id, _ := strconv.Atoi(c.Param("id")) - errCode := orderManageService.DeleteOrderManage(id) + errCode := orderManageService.DeleteOrderManage(params.Ids) if errCode != ecode.OK { ctx.Fail(errCode) return @@ -97,7 +96,6 @@ ctx.Ok() } - // checkOrderManageParams func checkOrderManageParams(orderManage request.OrderManage) (int, model.OrderManage) { @@ -153,7 +151,7 @@ } ctx.OkWithDetailed(response.OrderManageResponse{ - List: orderManages, + List: orderManages, Count: int(total), }) -} \ No newline at end of file +} diff --git a/api/v1/serviceContract.go b/api/v1/serviceContract.go index 8cb3e92..aa3175e 100644 --- a/api/v1/serviceContract.go +++ b/api/v1/serviceContract.go @@ -7,7 +7,6 @@ "aps_crm/pkg/contextx" "aps_crm/pkg/ecode" "github.com/gin-gonic/gin" - "strconv" ) type ServiceContractApi struct{} @@ -47,17 +46,17 @@ // @Tags ServiceContract // @Summary 鍒犻櫎鏈嶅姟鍚堝悓 // @Produce application/json -// @Param id path int true "鏌ヨ鍙傛暟" +// @Param object body request.DeleteserviceContract true "鏌ヨ鍙傛暟" // @Success 200 {object} contextx.Response{} -// @Router /api/serviceContract/delete/{id} [delete] +// @Router /api/serviceContract/delete [delete] func (s *ServiceContractApi) Delete(c *gin.Context) { - ctx, ok := contextx.NewContext(c, nil) + var params request.DeleteserviceContract + ctx, ok := contextx.NewContext(c, ¶ms) if !ok { return } - id, _ := strconv.Atoi(c.Param("id")) - errCode := serviceContractService.DeleteServiceContract(id) + errCode := serviceContractService.DeleteServiceContract(params.Ids) if errCode != ecode.OK { ctx.Fail(errCode) return @@ -174,4 +173,4 @@ List: serviceContracts, Count: int(total), }) -} \ No newline at end of file +} diff --git a/api/v1/serviceFeeManage.go b/api/v1/serviceFeeManage.go index c7b71d5..f44d102 100644 --- a/api/v1/serviceFeeManage.go +++ b/api/v1/serviceFeeManage.go @@ -7,7 +7,6 @@ "aps_crm/pkg/contextx" "aps_crm/pkg/ecode" "github.com/gin-gonic/gin" - "strconv" ) type ServiceFeeManageApi struct{} @@ -55,17 +54,17 @@ // @Tags ServiceFeeManage // @Summary 鍒犻櫎鏈嶅姟璐圭鐞� // @Produce application/json -// @Param id path int true "鏌ヨ鍙傛暟" +// @Param object body request.DeleteServiceFeeManage true "鏌ヨ鍙傛暟" // @Success 200 {object} contextx.Response{} -// @Router /api/serviceFeeManage/delete/{id} [delete] +// @Router /api/serviceFeeManage/delete [delete] func (s *ServiceFeeManageApi) Delete(c *gin.Context) { - ctx, ok := contextx.NewContext(c, nil) + var params request.DeleteServiceFeeManage + ctx, ok := contextx.NewContext(c, ¶ms) if !ok { return } - id, _ := strconv.Atoi(c.Param("id")) - errCode := serviceFeeManageService.DeleteServiceFeeManage(id) + errCode := serviceFeeManageService.DeleteServiceFeeManage(params.Ids) if errCode != ecode.OK { ctx.Fail(errCode) return @@ -112,7 +111,6 @@ ctx.Ok() } - // checkServiceFeeManageParams func checkServiceFeeManageParams(serviceFeeManage request.ServiceFeeManage) (errCode int, result model.ServiceFeeManage) { @@ -161,7 +159,7 @@ } ctx.OkWithDetailed(response.ServiceFeeManageResponse{ - List: serviceFeeManages, + List: serviceFeeManages, Count: int(total), }) -} \ No newline at end of file +} diff --git a/api/v1/serviceFollowup.go b/api/v1/serviceFollowup.go index dd6009b..34b4f0b 100644 --- a/api/v1/serviceFollowup.go +++ b/api/v1/serviceFollowup.go @@ -7,7 +7,6 @@ "aps_crm/pkg/contextx" "aps_crm/pkg/ecode" "github.com/gin-gonic/gin" - "strconv" ) type ServiceFollowupApi struct{} @@ -47,17 +46,17 @@ // @Tags ServiceFollowup // @Summary 鍒犻櫎鏈嶅姟璺熻繘 // @Produce application/json -// @Param id path int true "鏌ヨ鍙傛暟" +// @Param object body request.DeleteServiceFollowup true "鏌ヨ鍙傛暟" // @Success 200 {object} contextx.Response{} -// @Router /api/serviceFollowup/delete/{id} [delete] +// @Router /api/serviceFollowup/delete [delete] func (s *ServiceFollowupApi) Delete(c *gin.Context) { - ctx, ok := contextx.NewContext(c, nil) + var params request.DeleteServiceFollowup + ctx, ok := contextx.NewContext(c, ¶ms) if !ok { return } - id, _ := strconv.Atoi(c.Param("id")) - errCode := serviceFollowupService.DeleteServiceFollowup(id) + errCode := serviceFollowupService.DeleteServiceFollowup(params.Ids) if errCode != ecode.OK { ctx.Fail(errCode) return @@ -97,7 +96,6 @@ ctx.Ok() } - // checkServiceFollowupParams func checkServiceFollowupParams(serviceFollowup request.ServiceFollowup) (errCode int, serviceFollowupModel model.ServiceFollowup) { @@ -150,7 +148,7 @@ } ctx.OkWithDetailed(response.ServiceFollowupResponse{ - List: serviceFollowups, + List: serviceFollowups, Count: int(total), }) -} \ No newline at end of file +} diff --git a/docs/docs.go b/docs/docs.go index c98b043..ebc38d8 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -2801,7 +2801,7 @@ } } }, - "/api/orderManage/delete/{id}": { + "/api/orderManage/delete": { "delete": { "produces": [ "application/json" @@ -2812,11 +2812,13 @@ "summary": "鍒犻櫎宸ュ崟", "parameters": [ { - "type": "integer", "description": "鏌ヨ鍙傛暟", - "name": "id", - "in": "path", - "required": true + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.DeleteOrderManage" + } } ], "responses": { @@ -5694,7 +5696,7 @@ } } }, - "/api/serviceContract/delete/{id}": { + "/api/serviceContract/delete": { "delete": { "produces": [ "application/json" @@ -5705,11 +5707,13 @@ "summary": "鍒犻櫎鏈嶅姟鍚堝悓", "parameters": [ { - "type": "integer", "description": "鏌ヨ鍙傛暟", - "name": "id", - "in": "path", - "required": true + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.DeleteserviceContract" + } } ], "responses": { @@ -6062,7 +6066,7 @@ } } }, - "/api/serviceFeeManage/delete/{id}": { + "/api/serviceFeeManage/delete": { "delete": { "produces": [ "application/json" @@ -6073,11 +6077,13 @@ "summary": "鍒犻櫎鏈嶅姟璐圭鐞�", "parameters": [ { - "type": "integer", "description": "鏌ヨ鍙傛暟", - "name": "id", - "in": "path", - "required": true + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.DeleteServiceFeeManage" + } } ], "responses": { @@ -6192,7 +6198,7 @@ } } }, - "/api/serviceFollowup/delete/{id}": { + "/api/serviceFollowup/delete": { "delete": { "produces": [ "application/json" @@ -6203,11 +6209,13 @@ "summary": "鍒犻櫎鏈嶅姟璺熻繘", "parameters": [ { - "type": "integer", "description": "鏌ヨ鍙傛暟", - "name": "id", - "in": "path", - "required": true + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.DeleteServiceFollowup" + } } ], "responses": { @@ -9969,7 +9977,40 @@ } } }, + "request.DeleteOrderManage": { + "type": "object", + "properties": { + "ids": { + "type": "array", + "items": { + "type": "integer" + } + } + } + }, "request.DeleteSalesLeads": { + "type": "object", + "properties": { + "ids": { + "type": "array", + "items": { + "type": "integer" + } + } + } + }, + "request.DeleteServiceFeeManage": { + "type": "object", + "properties": { + "ids": { + "type": "array", + "items": { + "type": "integer" + } + } + } + }, + "request.DeleteServiceFollowup": { "type": "object", "properties": { "ids": { @@ -9989,6 +10030,17 @@ } } }, + "request.DeleteserviceContract": { + "type": "object", + "properties": { + "ids": { + "type": "array", + "items": { + "type": "integer" + } + } + } + }, "request.FollowRecord": { "type": "object", "properties": { diff --git a/docs/swagger.json b/docs/swagger.json index f8580fa..b4b9380 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -2789,7 +2789,7 @@ } } }, - "/api/orderManage/delete/{id}": { + "/api/orderManage/delete": { "delete": { "produces": [ "application/json" @@ -2800,11 +2800,13 @@ "summary": "鍒犻櫎宸ュ崟", "parameters": [ { - "type": "integer", "description": "鏌ヨ鍙傛暟", - "name": "id", - "in": "path", - "required": true + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.DeleteOrderManage" + } } ], "responses": { @@ -5682,7 +5684,7 @@ } } }, - "/api/serviceContract/delete/{id}": { + "/api/serviceContract/delete": { "delete": { "produces": [ "application/json" @@ -5693,11 +5695,13 @@ "summary": "鍒犻櫎鏈嶅姟鍚堝悓", "parameters": [ { - "type": "integer", "description": "鏌ヨ鍙傛暟", - "name": "id", - "in": "path", - "required": true + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.DeleteserviceContract" + } } ], "responses": { @@ -6050,7 +6054,7 @@ } } }, - "/api/serviceFeeManage/delete/{id}": { + "/api/serviceFeeManage/delete": { "delete": { "produces": [ "application/json" @@ -6061,11 +6065,13 @@ "summary": "鍒犻櫎鏈嶅姟璐圭鐞�", "parameters": [ { - "type": "integer", "description": "鏌ヨ鍙傛暟", - "name": "id", - "in": "path", - "required": true + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.DeleteServiceFeeManage" + } } ], "responses": { @@ -6180,7 +6186,7 @@ } } }, - "/api/serviceFollowup/delete/{id}": { + "/api/serviceFollowup/delete": { "delete": { "produces": [ "application/json" @@ -6191,11 +6197,13 @@ "summary": "鍒犻櫎鏈嶅姟璺熻繘", "parameters": [ { - "type": "integer", "description": "鏌ヨ鍙傛暟", - "name": "id", - "in": "path", - "required": true + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.DeleteServiceFollowup" + } } ], "responses": { @@ -9957,7 +9965,40 @@ } } }, + "request.DeleteOrderManage": { + "type": "object", + "properties": { + "ids": { + "type": "array", + "items": { + "type": "integer" + } + } + } + }, "request.DeleteSalesLeads": { + "type": "object", + "properties": { + "ids": { + "type": "array", + "items": { + "type": "integer" + } + } + } + }, + "request.DeleteServiceFeeManage": { + "type": "object", + "properties": { + "ids": { + "type": "array", + "items": { + "type": "integer" + } + } + } + }, + "request.DeleteServiceFollowup": { "type": "object", "properties": { "ids": { @@ -9977,6 +10018,17 @@ } } }, + "request.DeleteserviceContract": { + "type": "object", + "properties": { + "ids": { + "type": "array", + "items": { + "type": "integer" + } + } + } + }, "request.FollowRecord": { "type": "object", "properties": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index f791646..4ce232a 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -1925,7 +1925,28 @@ type: integer type: array type: object + request.DeleteOrderManage: + properties: + ids: + items: + type: integer + type: array + type: object request.DeleteSalesLeads: + properties: + ids: + items: + type: integer + type: array + type: object + request.DeleteServiceFeeManage: + properties: + ids: + items: + type: integer + type: array + type: object + request.DeleteServiceFollowup: properties: ids: items: @@ -1937,6 +1958,13 @@ userId: description: 鐢ㄦ埛ID type: string + type: object + request.DeleteserviceContract: + properties: + ids: + items: + type: integer + type: array type: object request.FollowRecord: properties: @@ -5808,14 +5836,15 @@ summary: 娣诲姞宸ュ崟 tags: - OrderManage - /api/orderManage/delete/{id}: + /api/orderManage/delete: delete: parameters: - description: 鏌ヨ鍙傛暟 - in: path - name: id + in: body + name: object required: true - type: integer + schema: + $ref: '#/definitions/request.DeleteOrderManage' produces: - application/json responses: @@ -7589,14 +7618,15 @@ summary: 娣诲姞鏈嶅姟鍚堝悓 tags: - ServiceContract - /api/serviceContract/delete/{id}: + /api/serviceContract/delete: delete: parameters: - description: 鏌ヨ鍙傛暟 - in: path - name: id + in: body + name: object required: true - type: integer + schema: + $ref: '#/definitions/request.DeleteserviceContract' produces: - application/json responses: @@ -7815,14 +7845,15 @@ summary: 娣诲姞鏈嶅姟璐圭鐞� tags: - ServiceFeeManage - /api/serviceFeeManage/delete/{id}: + /api/serviceFeeManage/delete: delete: parameters: - description: 鏌ヨ鍙傛暟 - in: path - name: id + in: body + name: object required: true - type: integer + schema: + $ref: '#/definitions/request.DeleteServiceFeeManage' produces: - application/json responses: @@ -7895,14 +7926,15 @@ summary: 娣诲姞鏈嶅姟璺熻繘 tags: - ServiceFollowup - /api/serviceFollowup/delete/{id}: + /api/serviceFollowup/delete: delete: parameters: - description: 鏌ヨ鍙傛暟 - in: path - name: id + in: body + name: object required: true - type: integer + schema: + $ref: '#/definitions/request.DeleteServiceFollowup' produces: - application/json responses: diff --git a/model/orderManage.go b/model/orderManage.go index 2712759..88bdbe9 100644 --- a/model/orderManage.go +++ b/model/orderManage.go @@ -109,4 +109,8 @@ func (slf *OrderManageSearch) SetOrder(order string) *OrderManageSearch { slf.OrderBy = order return slf -} \ No newline at end of file +} +func (slf *OrderManageSearch) SetIds(ids []int) *OrderManageSearch { + slf.Orm = slf.Orm.Where("id in (?)", ids) + return slf +} diff --git a/model/request/orderManage.go b/model/request/orderManage.go index 614db86..937a368 100644 --- a/model/request/orderManage.go +++ b/model/request/orderManage.go @@ -25,3 +25,7 @@ PageInfo Keyword string `json:"keyword"` } + +type DeleteOrderManage struct { + Ids []int `json:"ids"` +} diff --git a/model/request/serviceContract.go b/model/request/serviceContract.go index 40b6049..b927a21 100644 --- a/model/request/serviceContract.go +++ b/model/request/serviceContract.go @@ -36,3 +36,7 @@ PageInfo Keyword string `json:"keyword"` } + +type DeleteserviceContract struct { + Ids []int `json:"ids"` +} diff --git a/model/request/serviceFeeManage.go b/model/request/serviceFeeManage.go index d5713b5..74a9f38 100644 --- a/model/request/serviceFeeManage.go +++ b/model/request/serviceFeeManage.go @@ -22,3 +22,7 @@ PageInfo Keyword string `json:"keyword"` } + +type DeleteServiceFeeManage struct { + Ids []int `json:"ids"` +} diff --git a/model/request/serviceFollowup.go b/model/request/serviceFollowup.go index a13fa6c..7ba75c8 100644 --- a/model/request/serviceFollowup.go +++ b/model/request/serviceFollowup.go @@ -29,3 +29,7 @@ PageInfo Keyword string `json:"keyword"` } + +type DeleteServiceFollowup struct { + Ids []int `json:"ids"` +} diff --git a/model/serviceContract.go b/model/serviceContract.go index fd9dbb0..0fcf0f7 100644 --- a/model/serviceContract.go +++ b/model/serviceContract.go @@ -123,4 +123,8 @@ func (slf *ServiceContractSearch) SetOrder(order string) *ServiceContractSearch { slf.OrderBy = order return slf -} \ No newline at end of file +} +func (slf *ServiceContractSearch) SetIds(ids []int) *ServiceContractSearch { + slf.Orm = slf.Orm.Where("id in (?)", ids) + return slf +} diff --git a/model/serviceFeeManage.go b/model/serviceFeeManage.go index 16b6ab4..b4f4731 100644 --- a/model/serviceFeeManage.go +++ b/model/serviceFeeManage.go @@ -118,4 +118,8 @@ func (slf *ServiceFeeManageSearch) SetOrder(order string) *ServiceFeeManageSearch { slf.OrderBy = order return slf -} \ No newline at end of file +} +func (slf *ServiceFeeManageSearch) SetIds(ids []int) *ServiceFeeManageSearch { + slf.Orm = slf.Orm.Where("id in (?)", ids) + return slf +} diff --git a/model/serviceFollowup.go b/model/serviceFollowup.go index c6baa40..de9174d 100644 --- a/model/serviceFollowup.go +++ b/model/serviceFollowup.go @@ -121,4 +121,8 @@ func (slf *ServiceFollowupSearch) SetOrder(order string) *ServiceFollowupSearch { slf.OrderBy = order return slf -} \ No newline at end of file +} +func (slf *ServiceFollowupSearch) SetIds(ids []int) *ServiceFollowupSearch { + slf.Orm = slf.Orm.Where("id in (?)", ids) + return slf +} diff --git a/router/serviceContract.go b/router/serviceContract.go index 0c2d756..348375d 100644 --- a/router/serviceContract.go +++ b/router/serviceContract.go @@ -12,7 +12,7 @@ serviceContractApi := v1.ApiGroup.ServiceContractApi { serviceContractRouter.POST("add", serviceContractApi.Add) // 娣诲姞鏈嶅姟鍚堝悓 - serviceContractRouter.DELETE("delete/:id", serviceContractApi.Delete) // 鍒犻櫎鏈嶅姟鍚堝悓 + serviceContractRouter.DELETE("delete", serviceContractApi.Delete) // 鍒犻櫎鏈嶅姟鍚堝悓 serviceContractRouter.PUT("update", serviceContractApi.Update) // 鏇存柊鏈嶅姟鍚堝悓 serviceContractRouter.POST("list", serviceContractApi.List) // 鑾峰彇鏈嶅姟鍚堝悓鍒楄〃 } diff --git a/router/serviceFeeManage.go b/router/serviceFeeManage.go index 78de68d..68d08f9 100644 --- a/router/serviceFeeManage.go +++ b/router/serviceFeeManage.go @@ -12,7 +12,7 @@ serviceFeeManageApi := v1.ApiGroup.ServiceFeeManageApi { serviceFeeManageRouter.POST("add", serviceFeeManageApi.Add) // 娣诲姞鏈嶅姟璐圭鐞� - serviceFeeManageRouter.DELETE("delete/:id", serviceFeeManageApi.Delete) // 鍒犻櫎鏈嶅姟璐圭鐞� + serviceFeeManageRouter.DELETE("delete", serviceFeeManageApi.Delete) // 鍒犻櫎鏈嶅姟璐圭鐞� serviceFeeManageRouter.PUT("update", serviceFeeManageApi.Update) // 鏇存柊鏈嶅姟璐圭鐞� serviceFeeManageRouter.POST("list", serviceFeeManageApi.List) // 鑾峰彇鏈嶅姟璐圭鐞嗗垪琛� } diff --git a/router/serviceFollowup.go b/router/serviceFollowup.go index 0e018ca..1c1b5f5 100644 --- a/router/serviceFollowup.go +++ b/router/serviceFollowup.go @@ -11,9 +11,9 @@ serviceFollowupRouter := router.Group("serviceFollowup") serviceFollowupApi := v1.ApiGroup.ServiceFollowupApi { - serviceFollowupRouter.POST("add", serviceFollowupApi.Add) // 娣诲姞鏈嶅姟璺熻繘 - serviceFollowupRouter.DELETE("delete/:id", serviceFollowupApi.Delete) // 鍒犻櫎鏈嶅姟璺熻繘 - serviceFollowupRouter.PUT("update", serviceFollowupApi.Update) // 鏇存柊鏈嶅姟璺熻繘 - serviceFollowupRouter.POST("list", serviceFollowupApi.List) // 鑾峰彇鍥炶鍗曠鐞嗗垪琛� + serviceFollowupRouter.POST("add", serviceFollowupApi.Add) // 娣诲姞鏈嶅姟璺熻繘 + serviceFollowupRouter.DELETE("delete", serviceFollowupApi.Delete) // 鍒犻櫎鏈嶅姟璺熻繘 + serviceFollowupRouter.PUT("update", serviceFollowupApi.Update) // 鏇存柊鏈嶅姟璺熻繘 + serviceFollowupRouter.POST("list", serviceFollowupApi.List) // 鑾峰彇鍥炶鍗曠鐞嗗垪琛� } -} \ No newline at end of file +} diff --git a/service/orderManage.go b/service/orderManage.go index c66b8b1..f33f3b9 100644 --- a/service/orderManage.go +++ b/service/orderManage.go @@ -16,19 +16,6 @@ return ecode.OK } -func (OrderManageService) DeleteOrderManage(id int) int { - _, err := model.NewOrderManageSearch().SetId(id).Find() - if err != nil { - return ecode.OrderManageNotExist - } - - err = model.NewOrderManageSearch().SetId(id).Delete() - if err != nil { - return ecode.OrderManageNotExist - } - return ecode.OK -} - func (OrderManageService) UpdateOrderManage(orderManage *model.OrderManage) int { // check orderManage exist _, err := model.NewOrderManageSearch().SetId(orderManage.Id).Find() @@ -52,3 +39,12 @@ } return contacts, total, ecode.OK } + +func (OrderManageService) DeleteOrderManage(ids []int) int { + // delete client + err := model.NewOrderManageSearch().SetIds(ids).Delete() + if err != nil { + return ecode.OrderManageDeleteErr + } + return ecode.OK +} diff --git a/service/serviceContract.go b/service/serviceContract.go index a24b5ad..a77e154 100644 --- a/service/serviceContract.go +++ b/service/serviceContract.go @@ -16,19 +16,6 @@ return ecode.OK } -func (SContractService) DeleteServiceContract(id int) int { - _, err := model.NewServiceContractSearch().SetId(id).Find() - if err != nil { - return ecode.SContractNotExist - } - - err = model.NewServiceContractSearch().SetId(id).Delete() - if err != nil { - return ecode.SContractNotExist - } - return ecode.OK -} - func (SContractService) UpdateServiceContract(serviceContract *model.ServiceContract) int { // check serviceContract exist _, err := model.NewServiceContractSearch().SetId(serviceContract.Id).Find() @@ -61,3 +48,12 @@ } return contacts, total, ecode.OK } + +func (SContractService) DeleteServiceContract(ids []int) int { + // delete client + err := model.NewServiceContractSearch().SetIds(ids).Delete() + if err != nil { + return ecode.SContractDeleteErr + } + return ecode.OK +} diff --git a/service/serviceFeeManage.go b/service/serviceFeeManage.go index 5afaf9a..a1ab67b 100644 --- a/service/serviceFeeManage.go +++ b/service/serviceFeeManage.go @@ -30,19 +30,6 @@ return ecode.OK } -func (FeeManageService) DeleteServiceFeeManage(id int) int { - _, err := model.NewServiceFeeManageSearch(nil).SetId(id).Find() - if err != nil { - return ecode.ServiceFeeManageNotExist - } - - err = model.NewServiceFeeManageSearch(nil).SetId(id).Delete() - if err != nil { - return ecode.ServiceFeeManageNotExist - } - return ecode.OK -} - func (FeeManageService) UpdateServiceFeeManage(serviceFeeManage *model.ServiceFeeManage) int { // check serviceFeeManage exist _, err := model.NewServiceFeeManageSearch(nil).SetId(serviceFeeManage.Id).Find() @@ -78,3 +65,12 @@ } return contacts, total, ecode.OK } + +func (FeeManageService) DeleteServiceFeeManage(ids []int) int { + // delete client + err := model.NewServiceFeeManageSearch(nil).SetIds(ids).Delete() + if err != nil { + return ecode.ServiceFeeManageDeleteErr + } + return ecode.OK +} diff --git a/service/serviceFollowup.go b/service/serviceFollowup.go index 8faea0b..c05a414 100644 --- a/service/serviceFollowup.go +++ b/service/serviceFollowup.go @@ -16,19 +16,6 @@ return ecode.OK } -func (FollowupService) DeleteServiceFollowup(id int) int { - _, err := model.NewServiceFollowupSearch().SetId(id).Find() - if err != nil { - return ecode.ServiceFollowupNotExist - } - - err = model.NewServiceFollowupSearch().SetId(id).Delete() - if err != nil { - return ecode.ServiceFollowupNotExist - } - return ecode.OK -} - func (FollowupService) UpdateServiceFollowup(serviceFollowup *model.ServiceFollowup) int { // check serviceFollowup exist _, err := model.NewServiceFollowupSearch().SetId(serviceFollowup.Id).Find() @@ -52,3 +39,12 @@ } return contacts, total, ecode.OK } + +func (FollowupService) DeleteServiceFollowup(ids []int) int { + // delete client + err := model.NewServiceFollowupSearch().SetIds(ids).Delete() + if err != nil { + return ecode.ServiceFollowupDeleteErr + } + return ecode.OK +} -- Gitblit v1.8.0