From f04def67f695e69591ccdd73bb339c6f402b477c Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期六, 05 八月 2023 13:36:57 +0800 Subject: [PATCH] update --- model/severity.go | 21 - router/serviceType.go | 8 service/faultType.go | 2 service/serviceOrder.go | 2 service/priorityLevel.go | 2 service/serviceType.go | 2 docs/swagger.yaml | 129 +++++---- model/request/serviceOrder.go | 51 ++-- model/serviceType.go | 26 - api/v1/timeSpent.go | 4 api/v1/serviceType.go | 20 + model/timeSpent.go | 23 - docs/docs.go | 140 ++++++----- model/priorityLevel.go | 21 - docs/swagger.json | 140 ++++++----- service/severity.go | 2 model/serviceOrder.go | 46 ++- api/v1/priorityLevel.go | 4 model/faultType.go | 30 + api/v1/faq.go | 4 api/v1/faultType.go | 4 service/timeSpent.go | 2 api/v1/severity.go | 4 model/faq.go | 30 + service/faq.go | 2 25 files changed, 403 insertions(+), 316 deletions(-) diff --git a/api/v1/faq.go b/api/v1/faq.go index 9995d36..44dc341 100644 --- a/api/v1/faq.go +++ b/api/v1/faq.go @@ -71,6 +71,10 @@ if !ok { return } + if params.Id == 0 { + ctx.Fail(ecode.ParamsErr) + } + params.Faq.Id = params.Id errCode := service.NewFaqService().UpdateFaq(¶ms.Faq) if errCode != ecode.OK { diff --git a/api/v1/faultType.go b/api/v1/faultType.go index 2b2beb5..233652f 100644 --- a/api/v1/faultType.go +++ b/api/v1/faultType.go @@ -71,6 +71,10 @@ if !ok { return } + if params.Id == 0 { + ctx.Fail(ecode.ParamsErr) + } + params.FaultType.Id = params.Id errCode := service.NewFaultTypeService().UpdateFaultType(¶ms.FaultType) if errCode != ecode.OK { diff --git a/api/v1/priorityLevel.go b/api/v1/priorityLevel.go index 18ddfd4..8017e32 100644 --- a/api/v1/priorityLevel.go +++ b/api/v1/priorityLevel.go @@ -71,6 +71,10 @@ if !ok { return } + if params.Id == 0 { + ctx.Fail(ecode.ParamsErr) + } + params.PriorityLevel.Id = params.Id errCode := service.NewPriorityLevelService().UpdatePriorityLevel(¶ms.PriorityLevel) if errCode != ecode.OK { diff --git a/api/v1/serviceType.go b/api/v1/serviceType.go index ed5843b..5888c23 100644 --- a/api/v1/serviceType.go +++ b/api/v1/serviceType.go @@ -13,8 +13,8 @@ type ServiceTypeApi struct{} // Add -// @Tags 鏈嶅姟绫诲瀷绠$悊 -// @Summary 娣诲姞鏈嶅姟绫诲瀷 +// @Tags 鏈嶅姟鏂瑰紡绠$悊 +// @Summary 娣诲姞鏈嶅姟鏂瑰紡 // @Produce application/json // @Param object body request.AddServiceType true "鏌ヨ鍙傛暟" // @Success 200 {object} contextx.Response{} @@ -36,8 +36,8 @@ } // Delete -// @Tags 鏈嶅姟绫诲瀷绠$悊 -// @Summary 鍒犻櫎鏈嶅姟绫诲瀷 +// @Tags 鏈嶅姟鏂瑰紡绠$悊 +// @Summary 鍒犻櫎鏈嶅姟鏂瑰紡 // @Produce application/json // @Param id path int true "鏌ヨ鍙傛暟" // @Success 200 {object} contextx.Response{} @@ -59,8 +59,8 @@ } // Update -// @Tags 鏈嶅姟绫诲瀷绠$悊 -// @Summary 鏇存柊鏈嶅姟绫诲瀷 +// @Tags 鏈嶅姟鏂瑰紡绠$悊 +// @Summary 鏇存柊鏈嶅姟鏂瑰紡 // @Produce application/json // @Param object body request.UpdateServiceType true "鏌ヨ鍙傛暟" // @Success 200 {object} contextx.Response{} @@ -71,6 +71,10 @@ if !ok { return } + if params.Id == 0 { + ctx.Fail(ecode.ParamsErr) + } + params.ServiceType.Id = params.Id errCode := service.NewServiceTypeService().UpdateServiceType(¶ms.ServiceType) if errCode != ecode.OK { @@ -82,8 +86,8 @@ } // List -// @Tags 鏈嶅姟绫诲瀷绠$悊 -// @Summary 鑾峰彇鏈嶅姟绫诲瀷鍒楄〃 +// @Tags 鏈嶅姟鏂瑰紡绠$悊 +// @Summary 鑾峰彇鏈嶅姟鏂瑰紡鍒楄〃 // @Produce application/json // @Success 200 {object} response.ListResponse{data=[]model.ServiceType} // @Router /api/serviceType/list [get] diff --git a/api/v1/severity.go b/api/v1/severity.go index fe4100d..a6bff7b 100644 --- a/api/v1/severity.go +++ b/api/v1/severity.go @@ -71,6 +71,10 @@ if !ok { return } + if params.Id == 0 { + ctx.Fail(ecode.ParamsErr) + } + params.Severity.Id = params.Id errCode := service.NewSeverityService().UpdateSeverity(¶ms.Severity) if errCode != ecode.OK { diff --git a/api/v1/timeSpent.go b/api/v1/timeSpent.go index 0960310..c22f776 100644 --- a/api/v1/timeSpent.go +++ b/api/v1/timeSpent.go @@ -71,6 +71,10 @@ if !ok { return } + if params.Id == 0 { + ctx.Fail(ecode.ParamsErr) + } + params.TimeSpent.Id = params.Id errCode := service.NewTimeSpentService().UpdateTimeSpent(¶ms.TimeSpent) if errCode != ecode.OK { diff --git a/docs/docs.go b/docs/docs.go index 20e3b51..181b30a 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -6780,9 +6780,9 @@ "application/json" ], "tags": [ - "鏈嶅姟绫诲瀷绠$悊" + "鏈嶅姟鏂瑰紡绠$悊" ], - "summary": "娣诲姞鏈嶅姟绫诲瀷", + "summary": "娣诲姞鏈嶅姟鏂瑰紡", "parameters": [ { "description": "鏌ヨ鍙傛暟", @@ -6810,9 +6810,9 @@ "application/json" ], "tags": [ - "鏈嶅姟绫诲瀷绠$悊" + "鏈嶅姟鏂瑰紡绠$悊" ], - "summary": "鍒犻櫎鏈嶅姟绫诲瀷", + "summary": "鍒犻櫎鏈嶅姟鏂瑰紡", "parameters": [ { "type": "integer", @@ -6838,9 +6838,9 @@ "application/json" ], "tags": [ - "鏈嶅姟绫诲瀷绠$悊" + "鏈嶅姟鏂瑰紡绠$悊" ], - "summary": "鑾峰彇鏈嶅姟绫诲瀷鍒楄〃", + "summary": "鑾峰彇鏈嶅姟鏂瑰紡鍒楄〃", "responses": { "200": { "description": "OK", @@ -6872,9 +6872,9 @@ "application/json" ], "tags": [ - "鏈嶅姟绫诲瀷绠$悊" + "鏈嶅姟鏂瑰紡绠$悊" ], - "summary": "鏇存柊鏈嶅姟绫诲瀷", + "summary": "鏇存柊鏈嶅姟鏂瑰紡", "parameters": [ { "description": "鏌ヨ鍙傛暟", @@ -9559,15 +9559,15 @@ "description": "涓婇棬鍦板潃", "type": "string" }, - "appointment_time": { + "appointmentTime": { "description": "棰勭害涓婇棬鏃堕棿", "type": "string" }, - "car_fare": { + "carFare": { "description": "浜ら�氳垂", "type": "number" }, - "charge_amount": { + "chargeAmount": { "description": "鏀惰垂閲戦", "type": "number" }, @@ -9581,7 +9581,7 @@ "contact": { "$ref": "#/definitions/model.Contact" }, - "contact_id": { + "contactId": { "description": "鑱旂郴浜篿d", "type": "integer" }, @@ -9592,37 +9592,44 @@ "description": "鍚堝悓id", "type": "integer" }, - "expect_time": { + "expectTime": { "description": "甯屾湜澶勭悊鏃堕棿", "type": "string" }, "faq": { "$ref": "#/definitions/model.Faq" }, - "id": { + "faqId": { + "description": "甯歌闂id", "type": "integer" }, - "order": { - "$ref": "#/definitions/model.OrderManage" + "faultType": { + "$ref": "#/definitions/model.FaultType" + }, + "faultTypeId": { + "description": "鏁呴殰绫诲埆id", + "type": "integer" + }, + "id": { + "type": "integer" }, "orderId": { "description": "閿�鍞鍗昳d", "type": "integer" }, + "orderManage": { + "$ref": "#/definitions/model.OrderManage" + }, "priorityLevel": { "$ref": "#/definitions/model.PriorityLevel" }, - "priority_level_id": { - "description": "浼樺厛绾у埆", + "priorityLevelId": { + "description": "浼樺厛绾у埆id", "type": "integer" }, - "problem_desc": { + "problemDesc": { "description": "闂鎻忚堪", "type": "string" - }, - "problem_id": { - "description": "甯歌闂id", - "type": "integer" }, "product": { "$ref": "#/definitions/model.Product" @@ -9631,7 +9638,7 @@ "description": "浜у搧id", "type": "integer" }, - "real_time": { + "realTime": { "description": "瀹為檯澶勭悊鏃堕棿", "type": "string" }, @@ -9658,7 +9665,7 @@ "$ref": "#/definitions/model.ServiceType" }, "serviceTypeId": { - "description": "鏈嶅姟鏂瑰紡", + "description": "鏈嶅姟鏂瑰紡id", "type": "integer" }, "severity": { @@ -9668,7 +9675,7 @@ "description": "瑙e喅鏂规硶", "type": "string" }, - "solution_remark": { + "solutionRemark": { "description": "鍐呴儴澶囨敞", "type": "string" }, @@ -9680,7 +9687,10 @@ "description": "涓婚", "type": "string" }, - "time_spent_id": { + "timeSpent": { + "$ref": "#/definitions/model.TimeSpent" + }, + "timeSpentId": { "description": "鑺辫垂鏃堕棿", "type": "integer" } @@ -10902,15 +10912,15 @@ "description": "涓婇棬鍦板潃", "type": "string" }, - "appointment_time": { + "appointmentTime": { "description": "棰勭害涓婇棬鏃堕棿", "type": "string" }, - "car_fare": { + "carFare": { "description": "浜ら�氳垂", "type": "number" }, - "charge_amount": { + "chargeAmount": { "description": "鏀惰垂閲戦", "type": "number" }, @@ -10918,7 +10928,7 @@ "description": "瀹㈡埛id", "type": "integer" }, - "contact_id": { + "contactId": { "description": "鑱旂郴浜篿d", "type": "integer" }, @@ -10926,31 +10936,35 @@ "description": "鍚堝悓id", "type": "integer" }, - "expect_time": { + "expectTime": { "description": "甯屾湜澶勭悊鏃堕棿", "type": "string" + }, + "faqId": { + "description": "甯歌闂id", + "type": "integer" + }, + "faultTypeId": { + "description": "鏁呴殰绫诲埆id", + "type": "integer" }, "orderId": { "description": "閿�鍞鍗昳d", "type": "integer" }, - "priority_level_id": { - "description": "浼樺厛绾у埆", + "priorityLevelId": { + "description": "浼樺厛绾у埆id", "type": "integer" }, - "problem_desc": { + "problemDesc": { "description": "闂鎻忚堪", "type": "string" - }, - "problem_id": { - "description": "甯歌闂id", - "type": "integer" }, "productId": { "description": "浜у搧id", "type": "integer" }, - "real_time": { + "realTime": { "description": "瀹為檯澶勭悊鏃堕棿", "type": "string" }, @@ -10971,18 +10985,18 @@ "type": "string" }, "serviceTypeId": { - "description": "鏈嶅姟鏂瑰紡", + "description": "鏈嶅姟鏂瑰紡id", "type": "integer" }, "severity": { - "description": "涓ラ噸绋嬪害", + "description": "涓ラ噸绋嬪害id", "type": "integer" }, "solution": { "description": "瑙e喅鏂规硶", "type": "string" }, - "solution_remark": { + "solutionRemark": { "description": "鍐呴儴澶囨敞", "type": "string" }, @@ -10994,7 +11008,7 @@ "description": "涓婚", "type": "string" }, - "time_spent_id": { + "timeSpentId": { "description": "鑺辫垂鏃堕棿", "type": "integer" } @@ -13556,15 +13570,15 @@ "description": "涓婇棬鍦板潃", "type": "string" }, - "appointment_time": { + "appointmentTime": { "description": "棰勭害涓婇棬鏃堕棿", "type": "string" }, - "car_fare": { + "carFare": { "description": "浜ら�氳垂", "type": "number" }, - "charge_amount": { + "chargeAmount": { "description": "鏀惰垂閲戦", "type": "number" }, @@ -13572,7 +13586,7 @@ "description": "瀹㈡埛id", "type": "integer" }, - "contact_id": { + "contactId": { "description": "鑱旂郴浜篿d", "type": "integer" }, @@ -13580,9 +13594,17 @@ "description": "鍚堝悓id", "type": "integer" }, - "expect_time": { + "expectTime": { "description": "甯屾湜澶勭悊鏃堕棿", "type": "string" + }, + "faqId": { + "description": "甯歌闂id", + "type": "integer" + }, + "faultTypeId": { + "description": "鏁呴殰绫诲埆id", + "type": "integer" }, "id": { "type": "integer" @@ -13591,23 +13613,19 @@ "description": "閿�鍞鍗昳d", "type": "integer" }, - "priority_level_id": { - "description": "浼樺厛绾у埆", + "priorityLevelId": { + "description": "浼樺厛绾у埆id", "type": "integer" }, - "problem_desc": { + "problemDesc": { "description": "闂鎻忚堪", "type": "string" - }, - "problem_id": { - "description": "甯歌闂id", - "type": "integer" }, "productId": { "description": "浜у搧id", "type": "integer" }, - "real_time": { + "realTime": { "description": "瀹為檯澶勭悊鏃堕棿", "type": "string" }, @@ -13628,18 +13646,18 @@ "type": "string" }, "serviceTypeId": { - "description": "鏈嶅姟鏂瑰紡", + "description": "鏈嶅姟鏂瑰紡id", "type": "integer" }, "severity": { - "description": "涓ラ噸绋嬪害", + "description": "涓ラ噸绋嬪害id", "type": "integer" }, "solution": { "description": "瑙e喅鏂规硶", "type": "string" }, - "solution_remark": { + "solutionRemark": { "description": "鍐呴儴澶囨敞", "type": "string" }, @@ -13651,7 +13669,7 @@ "description": "涓婚", "type": "string" }, - "time_spent_id": { + "timeSpentId": { "description": "鑺辫垂鏃堕棿", "type": "integer" } diff --git a/docs/swagger.json b/docs/swagger.json index 5375918..5513bae 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -6768,9 +6768,9 @@ "application/json" ], "tags": [ - "鏈嶅姟绫诲瀷绠$悊" + "鏈嶅姟鏂瑰紡绠$悊" ], - "summary": "娣诲姞鏈嶅姟绫诲瀷", + "summary": "娣诲姞鏈嶅姟鏂瑰紡", "parameters": [ { "description": "鏌ヨ鍙傛暟", @@ -6798,9 +6798,9 @@ "application/json" ], "tags": [ - "鏈嶅姟绫诲瀷绠$悊" + "鏈嶅姟鏂瑰紡绠$悊" ], - "summary": "鍒犻櫎鏈嶅姟绫诲瀷", + "summary": "鍒犻櫎鏈嶅姟鏂瑰紡", "parameters": [ { "type": "integer", @@ -6826,9 +6826,9 @@ "application/json" ], "tags": [ - "鏈嶅姟绫诲瀷绠$悊" + "鏈嶅姟鏂瑰紡绠$悊" ], - "summary": "鑾峰彇鏈嶅姟绫诲瀷鍒楄〃", + "summary": "鑾峰彇鏈嶅姟鏂瑰紡鍒楄〃", "responses": { "200": { "description": "OK", @@ -6860,9 +6860,9 @@ "application/json" ], "tags": [ - "鏈嶅姟绫诲瀷绠$悊" + "鏈嶅姟鏂瑰紡绠$悊" ], - "summary": "鏇存柊鏈嶅姟绫诲瀷", + "summary": "鏇存柊鏈嶅姟鏂瑰紡", "parameters": [ { "description": "鏌ヨ鍙傛暟", @@ -9547,15 +9547,15 @@ "description": "涓婇棬鍦板潃", "type": "string" }, - "appointment_time": { + "appointmentTime": { "description": "棰勭害涓婇棬鏃堕棿", "type": "string" }, - "car_fare": { + "carFare": { "description": "浜ら�氳垂", "type": "number" }, - "charge_amount": { + "chargeAmount": { "description": "鏀惰垂閲戦", "type": "number" }, @@ -9569,7 +9569,7 @@ "contact": { "$ref": "#/definitions/model.Contact" }, - "contact_id": { + "contactId": { "description": "鑱旂郴浜篿d", "type": "integer" }, @@ -9580,37 +9580,44 @@ "description": "鍚堝悓id", "type": "integer" }, - "expect_time": { + "expectTime": { "description": "甯屾湜澶勭悊鏃堕棿", "type": "string" }, "faq": { "$ref": "#/definitions/model.Faq" }, - "id": { + "faqId": { + "description": "甯歌闂id", "type": "integer" }, - "order": { - "$ref": "#/definitions/model.OrderManage" + "faultType": { + "$ref": "#/definitions/model.FaultType" + }, + "faultTypeId": { + "description": "鏁呴殰绫诲埆id", + "type": "integer" + }, + "id": { + "type": "integer" }, "orderId": { "description": "閿�鍞鍗昳d", "type": "integer" }, + "orderManage": { + "$ref": "#/definitions/model.OrderManage" + }, "priorityLevel": { "$ref": "#/definitions/model.PriorityLevel" }, - "priority_level_id": { - "description": "浼樺厛绾у埆", + "priorityLevelId": { + "description": "浼樺厛绾у埆id", "type": "integer" }, - "problem_desc": { + "problemDesc": { "description": "闂鎻忚堪", "type": "string" - }, - "problem_id": { - "description": "甯歌闂id", - "type": "integer" }, "product": { "$ref": "#/definitions/model.Product" @@ -9619,7 +9626,7 @@ "description": "浜у搧id", "type": "integer" }, - "real_time": { + "realTime": { "description": "瀹為檯澶勭悊鏃堕棿", "type": "string" }, @@ -9646,7 +9653,7 @@ "$ref": "#/definitions/model.ServiceType" }, "serviceTypeId": { - "description": "鏈嶅姟鏂瑰紡", + "description": "鏈嶅姟鏂瑰紡id", "type": "integer" }, "severity": { @@ -9656,7 +9663,7 @@ "description": "瑙e喅鏂规硶", "type": "string" }, - "solution_remark": { + "solutionRemark": { "description": "鍐呴儴澶囨敞", "type": "string" }, @@ -9668,7 +9675,10 @@ "description": "涓婚", "type": "string" }, - "time_spent_id": { + "timeSpent": { + "$ref": "#/definitions/model.TimeSpent" + }, + "timeSpentId": { "description": "鑺辫垂鏃堕棿", "type": "integer" } @@ -10890,15 +10900,15 @@ "description": "涓婇棬鍦板潃", "type": "string" }, - "appointment_time": { + "appointmentTime": { "description": "棰勭害涓婇棬鏃堕棿", "type": "string" }, - "car_fare": { + "carFare": { "description": "浜ら�氳垂", "type": "number" }, - "charge_amount": { + "chargeAmount": { "description": "鏀惰垂閲戦", "type": "number" }, @@ -10906,7 +10916,7 @@ "description": "瀹㈡埛id", "type": "integer" }, - "contact_id": { + "contactId": { "description": "鑱旂郴浜篿d", "type": "integer" }, @@ -10914,31 +10924,35 @@ "description": "鍚堝悓id", "type": "integer" }, - "expect_time": { + "expectTime": { "description": "甯屾湜澶勭悊鏃堕棿", "type": "string" + }, + "faqId": { + "description": "甯歌闂id", + "type": "integer" + }, + "faultTypeId": { + "description": "鏁呴殰绫诲埆id", + "type": "integer" }, "orderId": { "description": "閿�鍞鍗昳d", "type": "integer" }, - "priority_level_id": { - "description": "浼樺厛绾у埆", + "priorityLevelId": { + "description": "浼樺厛绾у埆id", "type": "integer" }, - "problem_desc": { + "problemDesc": { "description": "闂鎻忚堪", "type": "string" - }, - "problem_id": { - "description": "甯歌闂id", - "type": "integer" }, "productId": { "description": "浜у搧id", "type": "integer" }, - "real_time": { + "realTime": { "description": "瀹為檯澶勭悊鏃堕棿", "type": "string" }, @@ -10959,18 +10973,18 @@ "type": "string" }, "serviceTypeId": { - "description": "鏈嶅姟鏂瑰紡", + "description": "鏈嶅姟鏂瑰紡id", "type": "integer" }, "severity": { - "description": "涓ラ噸绋嬪害", + "description": "涓ラ噸绋嬪害id", "type": "integer" }, "solution": { "description": "瑙e喅鏂规硶", "type": "string" }, - "solution_remark": { + "solutionRemark": { "description": "鍐呴儴澶囨敞", "type": "string" }, @@ -10982,7 +10996,7 @@ "description": "涓婚", "type": "string" }, - "time_spent_id": { + "timeSpentId": { "description": "鑺辫垂鏃堕棿", "type": "integer" } @@ -13544,15 +13558,15 @@ "description": "涓婇棬鍦板潃", "type": "string" }, - "appointment_time": { + "appointmentTime": { "description": "棰勭害涓婇棬鏃堕棿", "type": "string" }, - "car_fare": { + "carFare": { "description": "浜ら�氳垂", "type": "number" }, - "charge_amount": { + "chargeAmount": { "description": "鏀惰垂閲戦", "type": "number" }, @@ -13560,7 +13574,7 @@ "description": "瀹㈡埛id", "type": "integer" }, - "contact_id": { + "contactId": { "description": "鑱旂郴浜篿d", "type": "integer" }, @@ -13568,9 +13582,17 @@ "description": "鍚堝悓id", "type": "integer" }, - "expect_time": { + "expectTime": { "description": "甯屾湜澶勭悊鏃堕棿", "type": "string" + }, + "faqId": { + "description": "甯歌闂id", + "type": "integer" + }, + "faultTypeId": { + "description": "鏁呴殰绫诲埆id", + "type": "integer" }, "id": { "type": "integer" @@ -13579,23 +13601,19 @@ "description": "閿�鍞鍗昳d", "type": "integer" }, - "priority_level_id": { - "description": "浼樺厛绾у埆", + "priorityLevelId": { + "description": "浼樺厛绾у埆id", "type": "integer" }, - "problem_desc": { + "problemDesc": { "description": "闂鎻忚堪", "type": "string" - }, - "problem_id": { - "description": "甯歌闂id", - "type": "integer" }, "productId": { "description": "浜у搧id", "type": "integer" }, - "real_time": { + "realTime": { "description": "瀹為檯澶勭悊鏃堕棿", "type": "string" }, @@ -13616,18 +13634,18 @@ "type": "string" }, "serviceTypeId": { - "description": "鏈嶅姟鏂瑰紡", + "description": "鏈嶅姟鏂瑰紡id", "type": "integer" }, "severity": { - "description": "涓ラ噸绋嬪害", + "description": "涓ラ噸绋嬪害id", "type": "integer" }, "solution": { "description": "瑙e喅鏂规硶", "type": "string" }, - "solution_remark": { + "solutionRemark": { "description": "鍐呴儴澶囨敞", "type": "string" }, @@ -13639,7 +13657,7 @@ "description": "涓婚", "type": "string" }, - "time_spent_id": { + "timeSpentId": { "description": "鑺辫垂鏃堕棿", "type": "integer" } diff --git a/docs/swagger.yaml b/docs/swagger.yaml index a09d957..3b5e678 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -1095,13 +1095,13 @@ address: description: 涓婇棬鍦板潃 type: string - appointment_time: + appointmentTime: description: 棰勭害涓婇棬鏃堕棿 type: string - car_fare: + carFare: description: 浜ら�氳垂 type: number - charge_amount: + chargeAmount: description: 鏀惰垂閲戦 type: number client: @@ -1111,7 +1111,7 @@ type: integer contact: $ref: '#/definitions/model.Contact' - contact_id: + contactId: description: 鑱旂郴浜篿d type: integer contract: @@ -1119,35 +1119,40 @@ contractId: description: 鍚堝悓id type: integer - expect_time: + expectTime: description: 甯屾湜澶勭悊鏃堕棿 type: string faq: $ref: '#/definitions/model.Faq' + faqId: + description: 甯歌闂id + type: integer + faultType: + $ref: '#/definitions/model.FaultType' + faultTypeId: + description: 鏁呴殰绫诲埆id + type: integer id: type: integer - order: - $ref: '#/definitions/model.OrderManage' orderId: description: 閿�鍞鍗昳d type: integer - priority_level_id: - description: 浼樺厛绾у埆 - type: integer + orderManage: + $ref: '#/definitions/model.OrderManage' priorityLevel: $ref: '#/definitions/model.PriorityLevel' - problem_desc: + priorityLevelId: + description: 浼樺厛绾у埆id + type: integer + problemDesc: description: 闂鎻忚堪 type: string - problem_id: - description: 甯歌闂id - type: integer product: $ref: '#/definitions/model.Product' productId: description: 浜у搧id type: integer - real_time: + realTime: description: 瀹為檯澶勭悊鏃堕棿 type: string remark: @@ -1167,14 +1172,14 @@ serviceType: $ref: '#/definitions/model.ServiceType' serviceTypeId: - description: 鏈嶅姟鏂瑰紡 + description: 鏈嶅姟鏂瑰紡id type: integer severity: $ref: '#/definitions/model.Severity' solution: description: 瑙e喅鏂规硶 type: string - solution_remark: + solutionRemark: description: 鍐呴儴澶囨敞 type: string status: @@ -1183,7 +1188,9 @@ subject: description: 涓婚 type: string - time_spent_id: + timeSpent: + $ref: '#/definitions/model.TimeSpent' + timeSpentId: description: 鑺辫垂鏃堕棿 type: integer type: object @@ -2001,43 +2008,46 @@ address: description: 涓婇棬鍦板潃 type: string - appointment_time: + appointmentTime: description: 棰勭害涓婇棬鏃堕棿 type: string - car_fare: + carFare: description: 浜ら�氳垂 type: number - charge_amount: + chargeAmount: description: 鏀惰垂閲戦 type: number clientId: description: 瀹㈡埛id type: integer - contact_id: + contactId: description: 鑱旂郴浜篿d type: integer contractId: description: 鍚堝悓id type: integer - expect_time: + expectTime: description: 甯屾湜澶勭悊鏃堕棿 type: string + faqId: + description: 甯歌闂id + type: integer + faultTypeId: + description: 鏁呴殰绫诲埆id + type: integer orderId: description: 閿�鍞鍗昳d type: integer - priority_level_id: - description: 浼樺厛绾у埆 + priorityLevelId: + description: 浼樺厛绾у埆id type: integer - problem_desc: + problemDesc: description: 闂鎻忚堪 type: string - problem_id: - description: 甯歌闂id - type: integer productId: description: 浜у搧id type: integer - real_time: + realTime: description: 瀹為檯澶勭悊鏃堕棿 type: string remark: @@ -2053,15 +2063,15 @@ description: 鏈嶅姟鍗曠紪鍙� type: string serviceTypeId: - description: 鏈嶅姟鏂瑰紡 + description: 鏈嶅姟鏂瑰紡id type: integer severity: - description: 涓ラ噸绋嬪害 + description: 涓ラ噸绋嬪害id type: integer solution: description: 瑙e喅鏂规硶 type: string - solution_remark: + solutionRemark: description: 鍐呴儴澶囨敞 type: string status: @@ -2070,7 +2080,7 @@ subject: description: 涓婚 type: string - time_spent_id: + timeSpentId: description: 鑺辫垂鏃堕棿 type: integer type: object @@ -3796,45 +3806,48 @@ address: description: 涓婇棬鍦板潃 type: string - appointment_time: + appointmentTime: description: 棰勭害涓婇棬鏃堕棿 type: string - car_fare: + carFare: description: 浜ら�氳垂 type: number - charge_amount: + chargeAmount: description: 鏀惰垂閲戦 type: number clientId: description: 瀹㈡埛id type: integer - contact_id: + contactId: description: 鑱旂郴浜篿d type: integer contractId: description: 鍚堝悓id type: integer - expect_time: + expectTime: description: 甯屾湜澶勭悊鏃堕棿 type: string + faqId: + description: 甯歌闂id + type: integer + faultTypeId: + description: 鏁呴殰绫诲埆id + type: integer id: type: integer orderId: description: 閿�鍞鍗昳d type: integer - priority_level_id: - description: 浼樺厛绾у埆 + priorityLevelId: + description: 浼樺厛绾у埆id type: integer - problem_desc: + problemDesc: description: 闂鎻忚堪 type: string - problem_id: - description: 甯歌闂id - type: integer productId: description: 浜у搧id type: integer - real_time: + realTime: description: 瀹為檯澶勭悊鏃堕棿 type: string remark: @@ -3850,15 +3863,15 @@ description: 鏈嶅姟鍗曠紪鍙� type: string serviceTypeId: - description: 鏈嶅姟鏂瑰紡 + description: 鏈嶅姟鏂瑰紡id type: integer severity: - description: 涓ラ噸绋嬪害 + description: 涓ラ噸绋嬪害id type: integer solution: description: 瑙e喅鏂规硶 type: string - solution_remark: + solutionRemark: description: 鍐呴儴澶囨敞 type: string status: @@ -3867,7 +3880,7 @@ subject: description: 涓婚 type: string - time_spent_id: + timeSpentId: description: 鑺辫垂鏃堕棿 type: integer type: object @@ -8738,9 +8751,9 @@ description: OK schema: $ref: '#/definitions/contextx.Response' - summary: 娣诲姞鏈嶅姟绫诲瀷 + summary: 娣诲姞鏈嶅姟鏂瑰紡 tags: - - 鏈嶅姟绫诲瀷绠$悊 + - 鏈嶅姟鏂瑰紡绠$悊 /api/serviceType/delete/{id}: delete: parameters: @@ -8756,9 +8769,9 @@ description: OK schema: $ref: '#/definitions/contextx.Response' - summary: 鍒犻櫎鏈嶅姟绫诲瀷 + summary: 鍒犻櫎鏈嶅姟鏂瑰紡 tags: - - 鏈嶅姟绫诲瀷绠$悊 + - 鏈嶅姟鏂瑰紡绠$悊 /api/serviceType/list: get: produces: @@ -8775,9 +8788,9 @@ $ref: '#/definitions/model.ServiceType' type: array type: object - summary: 鑾峰彇鏈嶅姟绫诲瀷鍒楄〃 + summary: 鑾峰彇鏈嶅姟鏂瑰紡鍒楄〃 tags: - - 鏈嶅姟绫诲瀷绠$悊 + - 鏈嶅姟鏂瑰紡绠$悊 /api/serviceType/update: put: parameters: @@ -8794,9 +8807,9 @@ description: OK schema: $ref: '#/definitions/contextx.Response' - summary: 鏇存柊鏈嶅姟绫诲瀷 + summary: 鏇存柊鏈嶅姟鏂瑰紡 tags: - - 鏈嶅姟绫诲瀷绠$悊 + - 鏈嶅姟鏂瑰紡绠$悊 /api/severity/add: post: parameters: diff --git a/model/faq.go b/model/faq.go index 874b5bc..115e1d6 100644 --- a/model/faq.go +++ b/model/faq.go @@ -12,18 +12,18 @@ // Faq 甯歌闂 Faq struct { Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` - Name string `json:"name" gorm:"column:name"` + Name string `json:"name" gorm:"column:name"` } // FaqSearch 甯歌闂鎼滅储鏉′欢 FaqSearch struct { Faq - Orm *gorm.DB - QueryClass constvar.FaqQueryClass - KeywordType constvar.FaqKeywordType - Keyword string - PageNum int - PageSize int + Orm *gorm.DB + QueryClass constvar.FaqQueryClass + KeywordType constvar.FaqKeywordType + Keyword string + PageNum int + PageSize int } ) @@ -117,3 +117,19 @@ err := db.Find(&records).Error return records, total, err } + +// InitDefaultData 鍒濆鍖栨暟鎹� +func (slf *FaqSearch) InitDefaultData() error { + var ( + db = slf.Orm.Table(slf.TableName()) + total int64 = 0 + ) + if err := db.Count(&total).Error; err != nil { + return err + } + if total != 0 { + return nil + } + records := []*Faq{} + return slf.CreateBatch(records) +} diff --git a/model/faultType.go b/model/faultType.go index 68306bc..260cc2f 100644 --- a/model/faultType.go +++ b/model/faultType.go @@ -12,18 +12,18 @@ // FaultType 鏁呴殰绫诲埆 FaultType struct { Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` - Name string `json:"name" gorm:"column:name"` + Name string `json:"name" gorm:"column:name"` } // FaultTypeSearch 鏁呴殰绫诲埆鎼滅储鏉′欢 FaultTypeSearch struct { FaultType - Orm *gorm.DB - QueryClass constvar.FaultTypeQueryClass - KeywordType constvar.FaultTypeKeywordType - Keyword string - PageNum int - PageSize int + Orm *gorm.DB + QueryClass constvar.FaultTypeQueryClass + KeywordType constvar.FaultTypeKeywordType + Keyword string + PageNum int + PageSize int } ) @@ -117,3 +117,19 @@ err := db.Find(&records).Error return records, total, err } + +// InitDefaultData 鍒濆鍖栨暟鎹� +func (slf *FaultTypeSearch) InitDefaultData() error { + var ( + db = slf.Orm.Table(slf.TableName()) + total int64 = 0 + ) + if err := db.Count(&total).Error; err != nil { + return err + } + if total != 0 { + return nil + } + records := []*FaultType{} + return slf.CreateBatch(records) +} diff --git a/model/priorityLevel.go b/model/priorityLevel.go index b2240f8..fad265d 100644 --- a/model/priorityLevel.go +++ b/model/priorityLevel.go @@ -12,18 +12,18 @@ // PriorityLevel 浼樺厛绾у埆 PriorityLevel struct { Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` - Name string `json:"name" gorm:"column:name"` + Name string `json:"name" gorm:"column:name"` } // PriorityLevelSearch 浼樺厛绾у埆鎼滅储鏉′欢 PriorityLevelSearch struct { PriorityLevel - Orm *gorm.DB - QueryClass constvar.PriorityLevelQueryClass - KeywordType constvar.PriorityLevelKeywordType - Keyword string - PageNum int - PageSize int + Orm *gorm.DB + QueryClass constvar.PriorityLevelQueryClass + KeywordType constvar.PriorityLevelKeywordType + Keyword string + PageNum int + PageSize int } ) @@ -130,11 +130,6 @@ if total != 0 { return nil } - records := []*PriorityLevel{ - {Name: "浣�"}, - {Name: "涓�鑸�"}, - {Name: "楂�"}, - {Name: "绱ф��"}, - } + records := []*PriorityLevel{} return slf.CreateBatch(records) } diff --git a/model/request/serviceOrder.go b/model/request/serviceOrder.go index 8e1c83b..869fd9a 100644 --- a/model/request/serviceOrder.go +++ b/model/request/serviceOrder.go @@ -5,31 +5,32 @@ ) type AddServiceOrder struct { - ServiceNumber string `gorm:"service_number" json:"serviceNumber"` // 鏈嶅姟鍗曠紪鍙� - ClientId int `gorm:"client_id" json:"clientId"` // 瀹㈡埛id - ContractId int `gorm:"contract_id" json:"contractId"` // 鍚堝悓id - OrderId int `gorm:"order_id" json:"orderId"` // 閿�鍞鍗昳d - Subject string `gorm:"subject" json:"subject"` // 涓婚 - ProductId int `gorm:"product_id" json:"productId"` // 浜у搧id - ServiceTypeId int `gorm:"service_type_id" json:"serviceTypeId"` // 鏈嶅姟鏂瑰紡 - ServiceManId int `gorm:"service_man_id" json:"serviceManId"` // 鏈嶅姟浜哄憳 - ContactId int `gorm:"linkman_id" json:"contact_id"` // 鑱旂郴浜篿d - Address string `gorm:"address" json:"address"` // 涓婇棬鍦板潃 - PriorityLevelId int `gorm:"priority_level_id" json:"priority_level_id"` // 浼樺厛绾у埆 - AppointmentTime string `gorm:"appointment_time" json:"appointment_time"` // 棰勭害涓婇棬鏃堕棿 - SaleChanceId int `gorm:"sale_leads" json:"saleChanceId"` // 閿�鍞満浼歩d - SeverityId int `gorm:"severity_id" json:"severity"` // 涓ラ噸绋嬪害 - Status int `gorm:"status" json:"status"` // 澶勭悊鐘舵�� - ExpectTime string `gorm:"expect_time" json:"expect_time"` // 甯屾湜澶勭悊鏃堕棿 - RealTime string `gorm:"real_time" json:"real_time"` // 瀹為檯澶勭悊鏃堕棿 - CarFare float64 `gorm:"car_fare" json:"car_fare"` // 浜ら�氳垂 - ChargeAmount float64 `gorm:"charge_amount" json:"charge_amount"` // 鏀惰垂閲戦 - TimeSpentId int `gorm:"time_spent_id" json:"time_spent_id"` // 鑺辫垂鏃堕棿 - FaqId int `gorm:"problem_id" json:"problem_id"` // 甯歌闂id - ProblemDesc string `gorm:"problem_desc" json:"problem_desc"` // 闂鎻忚堪 - Solution string `gorm:"solution" json:"solution"` // 瑙e喅鏂规硶 - SolutionRemark string `gorm:"solution_remark" json:"solution_remark"` // 鍐呴儴澶囨敞 - Remark string `gorm:"remark" json:"remark"` // 澶囨敞 + ServiceNumber string `gorm:"service_number" json:"serviceNumber"` // 鏈嶅姟鍗曠紪鍙� + ClientId int `gorm:"client_id" json:"clientId"` // 瀹㈡埛id + ContractId int `gorm:"contract_id" json:"contractId"` // 鍚堝悓id + OrderId int `gorm:"order_id" json:"orderId"` // 閿�鍞鍗昳d + Subject string `gorm:"subject" json:"subject"` // 涓婚 + ProductId int `gorm:"product_id" json:"productId"` // 浜у搧id + ServiceTypeId int `gorm:"service_type_id" json:"serviceTypeId"` // 鏈嶅姟鏂瑰紡id + ServiceManId int `gorm:"service_man_id" json:"serviceManId"` // 鏈嶅姟浜哄憳 + ContactId int `gorm:"linkman_id" json:"contactId"` // 鑱旂郴浜篿d + Address string `gorm:"address" json:"address"` // 涓婇棬鍦板潃 + PriorityLevelId int `gorm:"priority_level_id" json:"priorityLevelId"` // 浼樺厛绾у埆id + AppointmentTime string `gorm:"appointment_time" json:"appointmentTime"` // 棰勭害涓婇棬鏃堕棿 + SaleChanceId int `gorm:"sale_leads" json:"saleChanceId"` // 閿�鍞満浼歩d + FaultTypeId int `gorm:"severity_id" json:"faultTypeId"` // 鏁呴殰绫诲埆id + SeverityId int `gorm:"severity_id" json:"severity"` // 涓ラ噸绋嬪害id + Status int `gorm:"status" json:"status"` // 澶勭悊鐘舵�� + ExpectTime string `gorm:"expect_time" json:"expectTime"` // 甯屾湜澶勭悊鏃堕棿 + RealTime string `gorm:"real_time" json:"realTime"` // 瀹為檯澶勭悊鏃堕棿 + CarFare float64 `gorm:"car_fare" json:"carFare"` // 浜ら�氳垂 + ChargeAmount float64 `gorm:"charge_amount" json:"chargeAmount"` // 鏀惰垂閲戦 + TimeSpentId int `gorm:"time_spent_id" json:"timeSpentId"` // 鑺辫垂鏃堕棿 + FaqId int `gorm:"problem_id" json:"faqId"` // 甯歌闂id + ProblemDesc string `gorm:"problem_desc" json:"problemDesc"` // 闂鎻忚堪 + Solution string `gorm:"solution" json:"solution"` // 瑙e喅鏂规硶 + SolutionRemark string `gorm:"solution_remark" json:"solutionRemark"` // 鍐呴儴澶囨敞 + Remark string `gorm:"remark" json:"remark"` // 澶囨敞 } type UpdateServiceOrder struct { diff --git a/model/serviceOrder.go b/model/serviceOrder.go index fc6307c..4e30c5a 100644 --- a/model/serviceOrder.go +++ b/model/serviceOrder.go @@ -22,31 +22,35 @@ Subject string `gorm:"subject" json:"subject"` // 涓婚 ProductId int `gorm:"product_id" json:"productId"` // 浜у搧id Product Product `gorm:"foreignKey:ProductId"` - ServiceTypeId int `gorm:"service_type_id" json:"serviceTypeId"` // 鏈嶅姟鏂瑰紡 + ServiceTypeId int `gorm:"service_type_id" json:"serviceTypeId"` // 鏈嶅姟鏂瑰紡id ServiceType ServiceType `gorm:"foreignKey:ServiceTypeId"` ServiceManId int `gorm:"service_man_id" json:"serviceManId"` // 鏈嶅姟浜哄憳 - ContactId int `gorm:"linkman_id" json:"contact_id"` // 鑱旂郴浜篿d + ContactId int `gorm:"linkman_id" json:"contactId"` // 鑱旂郴浜篿d Contact Contact `gorm:"foreignKey:ContactId"` - Address string `gorm:"address" json:"address"` // 涓婇棬鍦板潃 - PriorityLevelId int `gorm:"priority_level_id" json:"priority_level_id"` // 浼樺厛绾у埆 + Address string `gorm:"address" json:"address"` // 涓婇棬鍦板潃 + PriorityLevelId int `gorm:"priority_level_id" json:"priorityLevelId"` // 浼樺厛绾у埆id PriorityLevel PriorityLevel `gorm:"foreignKey:PriorityLevelId"` - AppointmentTime string `gorm:"appointment_time" json:"appointment_time"` // 棰勭害涓婇棬鏃堕棿 - SaleChanceId int `gorm:"sale_leads" json:"saleChanceId"` // 閿�鍞満浼歩d - SaleChance SaleChance `gorm:"foreignKey:SaleChanceId"` - SeverityId int `gorm:"severity_id" json:"severity"` // 涓ラ噸绋嬪害 - Severity Severity `gorm:"foreignKey:SeverityId"` - Status int `gorm:"status" json:"status"` // 澶勭悊鐘舵�� - ExpectTime string `gorm:"expect_time" json:"expect_time"` // 甯屾湜澶勭悊鏃堕棿 - RealTime string `gorm:"real_time" json:"real_time"` // 瀹為檯澶勭悊鏃堕棿 - CarFare float64 `gorm:"car_fare" json:"car_fare"` // 浜ら�氳垂 - ChargeAmount float64 `gorm:"charge_amount" json:"charge_amount"` // 鏀惰垂閲戦 - TimeSpentId int `gorm:"time_spent_id" json:"time_spent_id"` // 鑺辫垂鏃堕棿 - FaqId int `gorm:"problem_id" json:"problem_id"` // 甯歌闂id - Faq Faq `gorm:"foreignKey:FaqId"` - ProblemDesc string `gorm:"problem_desc" json:"problem_desc"` // 闂鎻忚堪 - Solution string `gorm:"solution" json:"solution"` // 瑙e喅鏂规硶 - SolutionRemark string `gorm:"solution_remark" json:"solution_remark"` // 鍐呴儴澶囨敞 - Remark string `gorm:"remark" json:"remark"` // 澶囨敞 + AppointmentTime string `gorm:"appointment_time" json:"appointmentTime"` // 棰勭害涓婇棬鏃堕棿 + SaleChanceId int `gorm:"sale_leads" json:"saleChanceId"` // 閿�鍞満浼歩d + + SaleChance SaleChance `gorm:"foreignKey:SaleChanceId"` + FaultTypeId int `gorm:"severity_id" json:"faultTypeId"` // 鏁呴殰绫诲埆id + FaultType FaultType `gorm:"foreignKey:FaultTypeId"` + SeverityId int `gorm:"severity_id" json:"severity"` // 涓ラ噸绋嬪害id + Severity Severity `gorm:"foreignKey:SeverityId"` + Status int `gorm:"status" json:"status"` // 澶勭悊鐘舵�� + ExpectTime string `gorm:"expect_time" json:"expectTime"` // 甯屾湜澶勭悊鏃堕棿 + RealTime string `gorm:"real_time" json:"realTime"` // 瀹為檯澶勭悊鏃堕棿 + CarFare float64 `gorm:"car_fare" json:"carFare"` // 浜ら�氳垂 + ChargeAmount float64 `gorm:"charge_amount" json:"chargeAmount"` // 鏀惰垂閲戦 + TimeSpentId int `gorm:"time_spent_id" json:"timeSpentId"` // 鑺辫垂鏃堕棿 + TimeSpent TimeSpent `gorm:"foreignKey:TimeSpentId"` + FaqId int `gorm:"problem_id" json:"faqId"` // 甯歌闂id + Faq Faq `gorm:"foreignKey:FaqId"` + ProblemDesc string `gorm:"problem_desc" json:"problemDesc"` // 闂鎻忚堪 + Solution string `gorm:"solution" json:"solution"` // 瑙e喅鏂规硶 + SolutionRemark string `gorm:"solution_remark" json:"solutionRemark"` // 鍐呴儴澶囨敞 + Remark string `gorm:"remark" json:"remark"` // 澶囨敞 } // ServiceOrderSearch 鏈嶅姟鍗曟悳绱㈡潯浠� diff --git a/model/serviceType.go b/model/serviceType.go index 402a9a5..e5f7214 100644 --- a/model/serviceType.go +++ b/model/serviceType.go @@ -9,21 +9,21 @@ ) type ( - // ServiceType 鏈嶅姟绫诲瀷 + // ServiceType 鏈嶅姟鏂瑰紡 ServiceType struct { Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` - Name string `json:"name" gorm:"column:name"` + Name string `json:"name" gorm:"column:name"` } - // ServiceTypeSearch 鏈嶅姟绫诲瀷鎼滅储鏉′欢 + // ServiceTypeSearch 鏈嶅姟鏂瑰紡鎼滅储鏉′欢 ServiceTypeSearch struct { ServiceType - Orm *gorm.DB - QueryClass constvar.ServiceTypeQueryClass - KeywordType constvar.ServiceTypeKeywordType - Keyword string - PageNum int - PageSize int + Orm *gorm.DB + QueryClass constvar.ServiceTypeQueryClass + KeywordType constvar.ServiceTypeKeywordType + Keyword string + PageNum int + PageSize int } ) @@ -130,12 +130,6 @@ if total != 0 { return nil } - records := []*ServiceType{ - {Name: "鐢佃瘽"}, - {Name: "杩滅▼"}, - {Name: "閫佷慨"}, - {Name: "涓婇棬"}, - {Name: "鍏朵粬"}, - } + records := []*ServiceType{} return slf.CreateBatch(records) } diff --git a/model/severity.go b/model/severity.go index 681c4f7..291daa3 100644 --- a/model/severity.go +++ b/model/severity.go @@ -12,18 +12,18 @@ // Severity 涓ラ噸绋嬪害 Severity struct { Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` - Name string `json:"name" gorm:"column:name"` + Name string `json:"name" gorm:"column:name"` } // SeveritySearch 涓ラ噸绋嬪害鎼滅储鏉′欢 SeveritySearch struct { Severity - Orm *gorm.DB - QueryClass constvar.SeverityQueryClass - KeywordType constvar.SeverityKeywordType - Keyword string - PageNum int - PageSize int + Orm *gorm.DB + QueryClass constvar.SeverityQueryClass + KeywordType constvar.SeverityKeywordType + Keyword string + PageNum int + PageSize int } ) @@ -130,11 +130,6 @@ if total != 0 { return nil } - records := []*Severity{ - {Name: "杞�"}, - {Name: "涓ラ噸"}, - {Name: "杈冧弗閲�"}, - {Name: "鐗逛弗閲�"}, - } + records := []*Severity{} return slf.CreateBatch(records) } diff --git a/model/timeSpent.go b/model/timeSpent.go index 1a4a5b0..de29623 100644 --- a/model/timeSpent.go +++ b/model/timeSpent.go @@ -12,18 +12,18 @@ // TimeSpent 鑺辫垂鏃堕棿 TimeSpent struct { Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` - Name string `json:"name" gorm:"column:name"` + Name string `json:"name" gorm:"column:name"` } // TimeSpentSearch 鑺辫垂鏃堕棿鎼滅储鏉′欢 TimeSpentSearch struct { TimeSpent - Orm *gorm.DB - QueryClass constvar.TimeSpentQueryClass - KeywordType constvar.TimeSpentKeywordType - Keyword string - PageNum int - PageSize int + Orm *gorm.DB + QueryClass constvar.TimeSpentQueryClass + KeywordType constvar.TimeSpentKeywordType + Keyword string + PageNum int + PageSize int } ) @@ -130,13 +130,6 @@ if total != 0 { return nil } - records := []*TimeSpent{ - {Name: "1灏忔椂"}, - {Name: "2灏忔椂"}, - {Name: "0.5涓伐浣滄棩"}, - {Name: "1涓伐浣滄棩"}, - {Name: "2涓伐浣滄棩"}, - {Name: "2涓伐浣滄棩浠ヤ笂"}, - } + records := []*TimeSpent{} return slf.CreateBatch(records) } diff --git a/router/serviceType.go b/router/serviceType.go index e373530..c396bcf 100644 --- a/router/serviceType.go +++ b/router/serviceType.go @@ -9,9 +9,9 @@ ServiceTypeRouter := router.Group("serviceType") ServiceTypeApi := v1.ServiceTypeApi{} { - ServiceTypeRouter.POST("add", ServiceTypeApi.Add) // 娣诲姞鏈嶅姟绫诲瀷 - ServiceTypeRouter.DELETE("delete/:id", ServiceTypeApi.Delete) // 鍒犻櫎鏈嶅姟绫诲瀷 - ServiceTypeRouter.PUT("update", ServiceTypeApi.Update) // 鏇存柊鏈嶅姟绫诲瀷 - ServiceTypeRouter.GET("list", ServiceTypeApi.List) // 鑾峰彇鏈嶅姟绫诲瀷鍒楄〃 + ServiceTypeRouter.POST("add", ServiceTypeApi.Add) // 娣诲姞鏈嶅姟鏂瑰紡 + ServiceTypeRouter.DELETE("delete/:id", ServiceTypeApi.Delete) // 鍒犻櫎鏈嶅姟鏂瑰紡 + ServiceTypeRouter.PUT("update", ServiceTypeApi.Update) // 鏇存柊鏈嶅姟鏂瑰紡 + ServiceTypeRouter.GET("list", ServiceTypeApi.List) // 鑾峰彇鏈嶅姟鏂瑰紡鍒楄〃 } } diff --git a/service/faq.go b/service/faq.go index 5374143..fc9e7ea 100644 --- a/service/faq.go +++ b/service/faq.go @@ -58,7 +58,7 @@ } func (FaqService) UpdateFaq(faq *model.Faq) int { - err := model.NewFaqSearch().Save(faq) + err := model.NewFaqSearch().SetId(faq.Id).Save(faq) if err != nil { return ecode.DBErr } diff --git a/service/faultType.go b/service/faultType.go index efa655e..141ac23 100644 --- a/service/faultType.go +++ b/service/faultType.go @@ -58,7 +58,7 @@ } func (FaultTypeService) UpdateFaultType(faultType *model.FaultType) int { - err := model.NewFaultTypeSearch().Save(faultType) + err := model.NewFaultTypeSearch().SetId(faultType.Id).Save(faultType) if err != nil { return ecode.DBErr } diff --git a/service/priorityLevel.go b/service/priorityLevel.go index ad487a2..9b2b3d3 100644 --- a/service/priorityLevel.go +++ b/service/priorityLevel.go @@ -58,7 +58,7 @@ } func (PriorityLevelService) UpdatePriorityLevel(priorityLevel *model.PriorityLevel) int { - err := model.NewPriorityLevelSearch().Save(priorityLevel) + err := model.NewPriorityLevelSearch().SetId(priorityLevel.Id).Save(priorityLevel) if err != nil { return ecode.DBErr } diff --git a/service/serviceOrder.go b/service/serviceOrder.go index 60a6d5f..c33f292 100644 --- a/service/serviceOrder.go +++ b/service/serviceOrder.go @@ -56,7 +56,7 @@ } func (ServiceOrderService) UpdateServiceOrder(serviceOrder *model.ServiceOrder) int { - err := model.NewServiceOrderSearch().Save(serviceOrder) + err := model.NewServiceOrderSearch().SetId(serviceOrder.Id).Save(serviceOrder) if err != nil { return ecode.DBErr } diff --git a/service/serviceType.go b/service/serviceType.go index e20b1f4..59989e4 100644 --- a/service/serviceType.go +++ b/service/serviceType.go @@ -58,7 +58,7 @@ } func (ServiceTypeService) UpdateServiceType(serviceType *model.ServiceType) int { - err := model.NewServiceTypeSearch().Save(serviceType) + err := model.NewServiceTypeSearch().SetId(serviceType.Id).Save(serviceType) if err != nil { return ecode.DBErr } diff --git a/service/severity.go b/service/severity.go index d2562ec..73176f4 100644 --- a/service/severity.go +++ b/service/severity.go @@ -58,7 +58,7 @@ } func (SeverityService) UpdateSeverity(severity *model.Severity) int { - err := model.NewSeveritySearch().Save(severity) + err := model.NewSeveritySearch().SetId(severity.Id).Save(severity) if err != nil { return ecode.DBErr } diff --git a/service/timeSpent.go b/service/timeSpent.go index 4c245ef..24450da 100644 --- a/service/timeSpent.go +++ b/service/timeSpent.go @@ -58,7 +58,7 @@ } func (TimeSpentService) UpdateTimeSpent(timeSpent *model.TimeSpent) int { - err := model.NewTimeSpentSearch().Save(timeSpent) + err := model.NewTimeSpentSearch().SetId(timeSpent.Id).Save(timeSpent) if err != nil { return ecode.DBErr } -- Gitblit v1.8.0