From 301003bb605007c3e035442de4bced9dd02164bb Mon Sep 17 00:00:00 2001 From: wangpengfei <274878379@qq.com> Date: 星期一, 28 八月 2023 17:46:18 +0800 Subject: [PATCH] fix --- service/test/supplier.go | 2 router/test/contract.go | 7 docs/swagger.yaml | 194 +++++++++++++ api/v1/test/contract.go | 63 ++++ docs/docs.go | 284 ++++++++++++++++++++ docs/swagger.json | 284 ++++++++++++++++++++ global/model.go | 2 model/test/contract.go | 1 8 files changed, 831 insertions(+), 6 deletions(-) diff --git a/api/v1/test/contract.go b/api/v1/test/contract.go index 02b469c..a3411c5 100644 --- a/api/v1/test/contract.go +++ b/api/v1/test/contract.go @@ -1,8 +1,11 @@ package test import ( + "bytes" + "fmt" "github.com/gin-gonic/gin" "go.uber.org/zap" + "net/http" "srm/global" "srm/model/common/request" "srm/model/common/response" @@ -10,6 +13,7 @@ testReq "srm/model/test/request" "srm/service" "strconv" + "time" ) type ContractApi struct { @@ -220,6 +224,63 @@ //c.Writer.Header().Set("Content-Type", "application/octect-stream") //c.Writer.Header().Set("Content-Disposition", "attachment;filename="+contract.FileName) //c.Writer.Write(contract.FileContent) - c.Data(200, "application/octect-stream", contract.FileContent) + //c.Data(200, "application/octect-stream", contract.FileContent) + //reader := bytes.NewReader(contract.FileContent) + //c.DataFromReader(http.StatusOK, int64(len(contract.FileContent)), "application/pdf", reader, map[string]string{"Content-Disposition": fmt.Sprintf("attachment; filename=%s", contract.FileName)}) + reader := bytes.NewReader(contract.FileContent) + c.Writer.Header().Set("Content-Type", "application/pdf") + c.Writer.Header().Set("Content-Disposition", "inline; filename="+contract.FileName) + http.ServeContent(c.Writer, c.Request, contract.FileName, time.Now(), reader) + } +} + +// DownloadContract 涓嬭浇Contract +// @Tags Contract +// @Summary 涓嬭浇Contract +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data query test.Contract true "鐢╥d鏌ヨContract" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"涓嬭浇鎴愬姛"}" +// @Router /con/downloadContract [get] +func (conApi *ContractApi) DownloadContract(c *gin.Context) { + var con test.Contract + err := c.ShouldBindQuery(&con) + if err != nil { + response.FailWithMessage(err.Error(), c) + return + } + + id := c.Query("id") + if id == "" { + response.FailWithMessage("id涓嶈兘涓虹┖", c) + return + } + + val64, err := strconv.ParseUint(id, 10, 64) + if err != nil { + response.FailWithMessage("id鏍煎紡閿欒", c) + return + } + + // Convert uint64 to uint + conId := uint(val64) + + contract, err := conService.GetContract(conId) + if err != nil { + global.GVA_LOG.Error("鑾峰彇澶辫触!", zap.Error(err)) + response.FailWithMessage("鑾峰彇澶辫触", c) + return + } else { + reader := bytes.NewReader(contract.FileContent) + // 璁剧疆蹇呰鐨勫ご淇℃伅 + c.Header("Content-Description", "File Transfer") + c.Header("Content-Transfer-Encoding", "binary") + c.Header("Content-Disposition", fmt.Sprintf("attachment; filename=%s", contract.FileName)) + c.Header("Content-Type", "application/pdf") + + // 灏嗘枃浠朵綔涓哄搷搴斾綋鍙戦�� + http.ServeContent(c.Writer, c.Request, contract.FileName, time.Now(), reader) + c.File(contract.FileName) } } diff --git a/docs/docs.go b/docs/docs.go index 5052c01..1ab4138 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -1899,6 +1899,66 @@ } } }, + "/con/downloadContract": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Contract" + ], + "summary": "涓嬭浇Contract", + "parameters": [ + { + "type": "string", + "description": "鍒涘缓鏃堕棿", + "name": "created_at", + "in": "query" + }, + { + "type": "array", + "items": { + "type": "integer" + }, + "collectionFormat": "csv", + "name": "fileContent", + "in": "query" + }, + { + "type": "string", + "name": "fileName", + "in": "query" + }, + { + "type": "integer", + "description": "涓婚敭ID", + "name": "id", + "in": "query" + }, + { + "type": "integer", + "name": "supplierID", + "in": "query" + } + ], + "responses": { + "200": { + "description": "{\"success\":true,\"data\":{},\"msg\":\"涓嬭浇鎴愬姛\"}", + "schema": { + "type": "string" + } + } + } + } + }, "/con/findContract": { "get": { "security": [ @@ -1917,6 +1977,12 @@ ], "summary": "鐢╥d鏌ヨContract", "parameters": [ + { + "type": "string", + "description": "鍒涘缓鏃堕棿", + "name": "created_at", + "in": "query" + }, { "type": "array", "items": { @@ -1971,6 +2037,12 @@ ], "summary": "鍒嗛〉鑾峰彇Contract鍒楄〃", "parameters": [ + { + "type": "string", + "description": "鍒涘缓鏃堕棿", + "name": "created_at", + "in": "query" + }, { "type": "string", "name": "endCreatedAt", @@ -2053,6 +2125,12 @@ ], "summary": "棰勮Contract", "parameters": [ + { + "type": "string", + "description": "鍒涘缓鏃堕棿", + "name": "created_at", + "in": "query" + }, { "type": "array", "items": { @@ -2145,6 +2223,12 @@ ], "summary": "鑾峰彇鍗曚竴瀹㈡埛淇℃伅", "parameters": [ + { + "type": "string", + "description": "鍒涘缓鏃堕棿", + "name": "created_at", + "in": "query" + }, { "type": "string", "description": "瀹㈡埛鍚�", @@ -2897,6 +2981,12 @@ "summary": "鐢╥d鏌ヨIndustry", "parameters": [ { + "type": "string", + "description": "鍒涘缓鏃堕棿", + "name": "created_at", + "in": "query" + }, + { "type": "integer", "description": "涓婚敭ID", "name": "id", @@ -2936,6 +3026,12 @@ ], "summary": "鍒嗛〉鑾峰彇Industry鍒楄〃", "parameters": [ + { + "type": "string", + "description": "鍒涘缓鏃堕棿", + "name": "created_at", + "in": "query" + }, { "type": "string", "name": "endCreatedAt", @@ -3273,6 +3369,12 @@ "summary": "鐢╥d鏌ヨMember", "parameters": [ { + "type": "string", + "description": "鍒涘缓鏃堕棿", + "name": "created_at", + "in": "query" + }, + { "type": "integer", "description": "涓婚敭ID", "name": "id", @@ -3322,6 +3424,12 @@ ], "summary": "鍒嗛〉鑾峰彇Member鍒楄〃", "parameters": [ + { + "type": "string", + "description": "鍒涘缓鏃堕棿", + "name": "created_at", + "in": "query" + }, { "type": "string", "name": "endCreatedAt", @@ -3400,6 +3508,12 @@ ], "summary": "鍒嗛〉鑾峰彇Member鍒楄〃", "parameters": [ + { + "type": "string", + "description": "鍒涘缓鏃堕棿", + "name": "created_at", + "in": "query" + }, { "type": "string", "name": "endCreatedAt", @@ -4091,6 +4205,12 @@ "summary": "鐢╥d鏌ヨProduct", "parameters": [ { + "type": "string", + "description": "鍒涘缓鏃堕棿", + "name": "created_at", + "in": "query" + }, + { "type": "integer", "name": "deliveryTime", "in": "query" @@ -4190,6 +4310,12 @@ ], "summary": "鍒嗛〉鑾峰彇Product鍒楄〃", "parameters": [ + { + "type": "string", + "description": "鍒涘缓鏃堕棿", + "name": "created_at", + "in": "query" + }, { "type": "integer", "name": "deliveryTime", @@ -4318,6 +4444,12 @@ ], "summary": "鍒嗛〉鑾峰彇Product鍒楄〃", "parameters": [ + { + "type": "string", + "description": "鍒涘缓鏃堕棿", + "name": "created_at", + "in": "query" + }, { "type": "integer", "name": "deliveryTime", @@ -4963,6 +5095,12 @@ }, { "type": "string", + "description": "鍒涘缓鏃堕棿", + "name": "created_at", + "in": "query" + }, + { + "type": "string", "name": "detailAddress", "in": "query" }, @@ -5069,6 +5207,12 @@ { "type": "string", "name": "contact", + "in": "query" + }, + { + "type": "string", + "description": "鍒涘缓鏃堕棿", + "name": "created_at", "in": "query" }, { @@ -5342,6 +5486,12 @@ "summary": "鐢╥d鏌ヨSupplierType", "parameters": [ { + "type": "string", + "description": "鍒涘缓鏃堕棿", + "name": "created_at", + "in": "query" + }, + { "type": "integer", "description": "涓婚敭ID", "name": "id", @@ -5381,6 +5531,12 @@ ], "summary": "鍒嗛〉鑾峰彇SupplierType鍒楄〃", "parameters": [ + { + "type": "string", + "description": "鍒涘缓鏃堕棿", + "name": "created_at", + "in": "query" + }, { "type": "string", "name": "endCreatedAt", @@ -5589,6 +5745,12 @@ "parameters": [ { "type": "string", + "description": "鍒涘缓鏃堕棿", + "name": "created_at", + "in": "query" + }, + { + "type": "string", "description": "鎻忚堪", "name": "desc", "in": "query" @@ -5662,6 +5824,12 @@ ], "summary": "鍒嗛〉鑾峰彇SysDictionary鍒楄〃", "parameters": [ + { + "type": "string", + "description": "鍒涘缓鏃堕棿", + "name": "created_at", + "in": "query" + }, { "type": "string", "description": "鎻忚堪", @@ -5905,6 +6073,12 @@ "summary": "鐢╥d鏌ヨSysDictionaryDetail", "parameters": [ { + "type": "string", + "description": "鍒涘缓鏃堕棿", + "name": "created_at", + "in": "query" + }, + { "type": "integer", "description": "涓婚敭ID", "name": "id", @@ -5985,6 +6159,12 @@ ], "summary": "鍒嗛〉鑾峰彇SysDictionaryDetail鍒楄〃", "parameters": [ + { + "type": "string", + "description": "鍒涘缓鏃堕棿", + "name": "created_at", + "in": "query" + }, { "type": "integer", "description": "涓婚敭ID", @@ -6297,6 +6477,12 @@ }, { "type": "string", + "description": "鍒涘缓鏃堕棿", + "name": "created_at", + "in": "query" + }, + { + "type": "string", "description": "閿欒淇℃伅", "name": "error_message", "in": "query" @@ -6404,6 +6590,12 @@ "type": "string", "description": "璇锋眰Body", "name": "body", + "in": "query" + }, + { + "type": "string", + "description": "鍒涘缓鏃堕棿", + "name": "created_at", "in": "query" }, { @@ -8020,6 +8212,10 @@ "example.ExaCustomer": { "type": "object", "properties": { + "created_at": { + "description": "鍒涘缓鏃堕棿", + "type": "string" + }, "customerName": { "description": "瀹㈡埛鍚�", "type": "string" @@ -8056,6 +8252,10 @@ "chunkTotal": { "type": "integer" }, + "created_at": { + "description": "鍒涘缓鏃堕棿", + "type": "string" + }, "exaFileChunk": { "type": "array", "items": { @@ -8083,6 +8283,10 @@ "example.ExaFileChunk": { "type": "object", "properties": { + "created_at": { + "description": "鍒涘缓鏃堕棿", + "type": "string" + }, "exaFileID": { "type": "integer" }, @@ -8101,6 +8305,10 @@ "example.ExaFileUploadAndDownload": { "type": "object", "properties": { + "created_at": { + "description": "鍒涘缓鏃堕棿", + "type": "string" + }, "id": { "description": "涓婚敭ID", "type": "integer" @@ -8128,6 +8336,10 @@ "properties": { "contact": { "description": "鑱旂郴浜�", + "type": "string" + }, + "created_at": { + "description": "鍒涘缓鏃堕棿", "type": "string" }, "deliveryDate": { @@ -8170,6 +8382,10 @@ "amount": { "description": "閲囪喘鏁伴噺", "type": "number" + }, + "created_at": { + "description": "鍒涘缓鏃堕棿", + "type": "string" }, "id": { "description": "涓婚敭ID", @@ -8454,6 +8670,10 @@ "properties": { "apiGroup": { "description": "api缁�", + "type": "string" + }, + "created_at": { + "description": "鍒涘缓鏃堕棿", "type": "string" }, "desc": { @@ -8984,6 +9204,10 @@ "description": "api缁�", "type": "string" }, + "created_at": { + "description": "鍒涘缓鏃堕棿", + "type": "string" + }, "description": { "description": "api涓枃鎻忚堪", "type": "string" @@ -9055,6 +9279,10 @@ "system.SysAutoCode": { "type": "object", "properties": { + "created_at": { + "description": "鍒涘缓鏃堕棿", + "type": "string" + }, "desc": { "type": "string" }, @@ -9087,6 +9315,10 @@ }, "component": { "description": "瀵瑰簲鍓嶇鏂囦欢璺緞", + "type": "string" + }, + "created_at": { + "description": "鍒涘缓鏃堕棿", "type": "string" }, "hidden": { @@ -9138,6 +9370,10 @@ "system.SysBaseMenuBtn": { "type": "object", "properties": { + "created_at": { + "description": "鍒涘缓鏃堕棿", + "type": "string" + }, "desc": { "type": "string" }, @@ -9156,6 +9392,10 @@ "system.SysBaseMenuParameter": { "type": "object", "properties": { + "created_at": { + "description": "鍒涘缓鏃堕棿", + "type": "string" + }, "id": { "description": "涓婚敭ID", "type": "integer" @@ -9180,6 +9420,10 @@ "system.SysDictionary": { "type": "object", "properties": { + "created_at": { + "description": "鍒涘缓鏃堕棿", + "type": "string" + }, "desc": { "description": "鎻忚堪", "type": "string" @@ -9211,6 +9455,10 @@ "system.SysDictionaryDetail": { "type": "object", "properties": { + "created_at": { + "description": "鍒涘缓鏃堕棿", + "type": "string" + }, "id": { "description": "涓婚敭ID", "type": "integer" @@ -9260,6 +9508,10 @@ }, "component": { "description": "瀵瑰簲鍓嶇鏂囦欢璺緞", + "type": "string" + }, + "created_at": { + "description": "鍒涘缓鏃堕棿", "type": "string" }, "hidden": { @@ -9320,6 +9572,10 @@ }, "body": { "description": "璇锋眰Body", + "type": "string" + }, + "created_at": { + "description": "鍒涘缓鏃堕棿", "type": "string" }, "error_message": { @@ -9387,6 +9643,10 @@ "description": "鍩虹棰滆壊", "type": "string" }, + "created_at": { + "description": "鍒涘缓鏃堕棿", + "type": "string" + }, "email": { "description": "鐢ㄦ埛閭", "type": "string" @@ -9436,6 +9696,10 @@ "test.Contract": { "type": "object", "properties": { + "created_at": { + "description": "鍒涘缓鏃堕棿", + "type": "string" + }, "fileContent": { "type": "array", "items": { @@ -9457,6 +9721,10 @@ "test.Industry": { "type": "object", "properties": { + "created_at": { + "description": "鍒涘缓鏃堕棿", + "type": "string" + }, "id": { "description": "涓婚敭ID", "type": "integer" @@ -9469,6 +9737,10 @@ "test.Member": { "type": "object", "properties": { + "created_at": { + "description": "鍒涘缓鏃堕棿", + "type": "string" + }, "id": { "description": "涓婚敭ID", "type": "integer" @@ -9487,6 +9759,10 @@ "test.Product": { "type": "object", "properties": { + "created_at": { + "description": "鍒涘缓鏃堕棿", + "type": "string" + }, "deliveryTime": { "type": "integer" }, @@ -9550,6 +9826,10 @@ "contact": { "type": "string" }, + "created_at": { + "description": "鍒涘缓鏃堕棿", + "type": "string" + }, "detailAddress": { "type": "string" }, @@ -9592,6 +9872,10 @@ "test.SupplierType": { "type": "object", "properties": { + "created_at": { + "description": "鍒涘缓鏃堕棿", + "type": "string" + }, "id": { "description": "涓婚敭ID", "type": "integer" diff --git a/docs/swagger.json b/docs/swagger.json index 96f9360..4f3c6ad 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -1890,6 +1890,66 @@ } } }, + "/con/downloadContract": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Contract" + ], + "summary": "涓嬭浇Contract", + "parameters": [ + { + "type": "string", + "description": "鍒涘缓鏃堕棿", + "name": "created_at", + "in": "query" + }, + { + "type": "array", + "items": { + "type": "integer" + }, + "collectionFormat": "csv", + "name": "fileContent", + "in": "query" + }, + { + "type": "string", + "name": "fileName", + "in": "query" + }, + { + "type": "integer", + "description": "涓婚敭ID", + "name": "id", + "in": "query" + }, + { + "type": "integer", + "name": "supplierID", + "in": "query" + } + ], + "responses": { + "200": { + "description": "{\"success\":true,\"data\":{},\"msg\":\"涓嬭浇鎴愬姛\"}", + "schema": { + "type": "string" + } + } + } + } + }, "/con/findContract": { "get": { "security": [ @@ -1908,6 +1968,12 @@ ], "summary": "鐢╥d鏌ヨContract", "parameters": [ + { + "type": "string", + "description": "鍒涘缓鏃堕棿", + "name": "created_at", + "in": "query" + }, { "type": "array", "items": { @@ -1962,6 +2028,12 @@ ], "summary": "鍒嗛〉鑾峰彇Contract鍒楄〃", "parameters": [ + { + "type": "string", + "description": "鍒涘缓鏃堕棿", + "name": "created_at", + "in": "query" + }, { "type": "string", "name": "endCreatedAt", @@ -2044,6 +2116,12 @@ ], "summary": "棰勮Contract", "parameters": [ + { + "type": "string", + "description": "鍒涘缓鏃堕棿", + "name": "created_at", + "in": "query" + }, { "type": "array", "items": { @@ -2136,6 +2214,12 @@ ], "summary": "鑾峰彇鍗曚竴瀹㈡埛淇℃伅", "parameters": [ + { + "type": "string", + "description": "鍒涘缓鏃堕棿", + "name": "created_at", + "in": "query" + }, { "type": "string", "description": "瀹㈡埛鍚�", @@ -2888,6 +2972,12 @@ "summary": "鐢╥d鏌ヨIndustry", "parameters": [ { + "type": "string", + "description": "鍒涘缓鏃堕棿", + "name": "created_at", + "in": "query" + }, + { "type": "integer", "description": "涓婚敭ID", "name": "id", @@ -2927,6 +3017,12 @@ ], "summary": "鍒嗛〉鑾峰彇Industry鍒楄〃", "parameters": [ + { + "type": "string", + "description": "鍒涘缓鏃堕棿", + "name": "created_at", + "in": "query" + }, { "type": "string", "name": "endCreatedAt", @@ -3264,6 +3360,12 @@ "summary": "鐢╥d鏌ヨMember", "parameters": [ { + "type": "string", + "description": "鍒涘缓鏃堕棿", + "name": "created_at", + "in": "query" + }, + { "type": "integer", "description": "涓婚敭ID", "name": "id", @@ -3313,6 +3415,12 @@ ], "summary": "鍒嗛〉鑾峰彇Member鍒楄〃", "parameters": [ + { + "type": "string", + "description": "鍒涘缓鏃堕棿", + "name": "created_at", + "in": "query" + }, { "type": "string", "name": "endCreatedAt", @@ -3391,6 +3499,12 @@ ], "summary": "鍒嗛〉鑾峰彇Member鍒楄〃", "parameters": [ + { + "type": "string", + "description": "鍒涘缓鏃堕棿", + "name": "created_at", + "in": "query" + }, { "type": "string", "name": "endCreatedAt", @@ -4082,6 +4196,12 @@ "summary": "鐢╥d鏌ヨProduct", "parameters": [ { + "type": "string", + "description": "鍒涘缓鏃堕棿", + "name": "created_at", + "in": "query" + }, + { "type": "integer", "name": "deliveryTime", "in": "query" @@ -4181,6 +4301,12 @@ ], "summary": "鍒嗛〉鑾峰彇Product鍒楄〃", "parameters": [ + { + "type": "string", + "description": "鍒涘缓鏃堕棿", + "name": "created_at", + "in": "query" + }, { "type": "integer", "name": "deliveryTime", @@ -4309,6 +4435,12 @@ ], "summary": "鍒嗛〉鑾峰彇Product鍒楄〃", "parameters": [ + { + "type": "string", + "description": "鍒涘缓鏃堕棿", + "name": "created_at", + "in": "query" + }, { "type": "integer", "name": "deliveryTime", @@ -4954,6 +5086,12 @@ }, { "type": "string", + "description": "鍒涘缓鏃堕棿", + "name": "created_at", + "in": "query" + }, + { + "type": "string", "name": "detailAddress", "in": "query" }, @@ -5060,6 +5198,12 @@ { "type": "string", "name": "contact", + "in": "query" + }, + { + "type": "string", + "description": "鍒涘缓鏃堕棿", + "name": "created_at", "in": "query" }, { @@ -5333,6 +5477,12 @@ "summary": "鐢╥d鏌ヨSupplierType", "parameters": [ { + "type": "string", + "description": "鍒涘缓鏃堕棿", + "name": "created_at", + "in": "query" + }, + { "type": "integer", "description": "涓婚敭ID", "name": "id", @@ -5372,6 +5522,12 @@ ], "summary": "鍒嗛〉鑾峰彇SupplierType鍒楄〃", "parameters": [ + { + "type": "string", + "description": "鍒涘缓鏃堕棿", + "name": "created_at", + "in": "query" + }, { "type": "string", "name": "endCreatedAt", @@ -5580,6 +5736,12 @@ "parameters": [ { "type": "string", + "description": "鍒涘缓鏃堕棿", + "name": "created_at", + "in": "query" + }, + { + "type": "string", "description": "鎻忚堪", "name": "desc", "in": "query" @@ -5653,6 +5815,12 @@ ], "summary": "鍒嗛〉鑾峰彇SysDictionary鍒楄〃", "parameters": [ + { + "type": "string", + "description": "鍒涘缓鏃堕棿", + "name": "created_at", + "in": "query" + }, { "type": "string", "description": "鎻忚堪", @@ -5896,6 +6064,12 @@ "summary": "鐢╥d鏌ヨSysDictionaryDetail", "parameters": [ { + "type": "string", + "description": "鍒涘缓鏃堕棿", + "name": "created_at", + "in": "query" + }, + { "type": "integer", "description": "涓婚敭ID", "name": "id", @@ -5976,6 +6150,12 @@ ], "summary": "鍒嗛〉鑾峰彇SysDictionaryDetail鍒楄〃", "parameters": [ + { + "type": "string", + "description": "鍒涘缓鏃堕棿", + "name": "created_at", + "in": "query" + }, { "type": "integer", "description": "涓婚敭ID", @@ -6288,6 +6468,12 @@ }, { "type": "string", + "description": "鍒涘缓鏃堕棿", + "name": "created_at", + "in": "query" + }, + { + "type": "string", "description": "閿欒淇℃伅", "name": "error_message", "in": "query" @@ -6395,6 +6581,12 @@ "type": "string", "description": "璇锋眰Body", "name": "body", + "in": "query" + }, + { + "type": "string", + "description": "鍒涘缓鏃堕棿", + "name": "created_at", "in": "query" }, { @@ -8011,6 +8203,10 @@ "example.ExaCustomer": { "type": "object", "properties": { + "created_at": { + "description": "鍒涘缓鏃堕棿", + "type": "string" + }, "customerName": { "description": "瀹㈡埛鍚�", "type": "string" @@ -8047,6 +8243,10 @@ "chunkTotal": { "type": "integer" }, + "created_at": { + "description": "鍒涘缓鏃堕棿", + "type": "string" + }, "exaFileChunk": { "type": "array", "items": { @@ -8074,6 +8274,10 @@ "example.ExaFileChunk": { "type": "object", "properties": { + "created_at": { + "description": "鍒涘缓鏃堕棿", + "type": "string" + }, "exaFileID": { "type": "integer" }, @@ -8092,6 +8296,10 @@ "example.ExaFileUploadAndDownload": { "type": "object", "properties": { + "created_at": { + "description": "鍒涘缓鏃堕棿", + "type": "string" + }, "id": { "description": "涓婚敭ID", "type": "integer" @@ -8119,6 +8327,10 @@ "properties": { "contact": { "description": "鑱旂郴浜�", + "type": "string" + }, + "created_at": { + "description": "鍒涘缓鏃堕棿", "type": "string" }, "deliveryDate": { @@ -8161,6 +8373,10 @@ "amount": { "description": "閲囪喘鏁伴噺", "type": "number" + }, + "created_at": { + "description": "鍒涘缓鏃堕棿", + "type": "string" }, "id": { "description": "涓婚敭ID", @@ -8445,6 +8661,10 @@ "properties": { "apiGroup": { "description": "api缁�", + "type": "string" + }, + "created_at": { + "description": "鍒涘缓鏃堕棿", "type": "string" }, "desc": { @@ -8975,6 +9195,10 @@ "description": "api缁�", "type": "string" }, + "created_at": { + "description": "鍒涘缓鏃堕棿", + "type": "string" + }, "description": { "description": "api涓枃鎻忚堪", "type": "string" @@ -9046,6 +9270,10 @@ "system.SysAutoCode": { "type": "object", "properties": { + "created_at": { + "description": "鍒涘缓鏃堕棿", + "type": "string" + }, "desc": { "type": "string" }, @@ -9078,6 +9306,10 @@ }, "component": { "description": "瀵瑰簲鍓嶇鏂囦欢璺緞", + "type": "string" + }, + "created_at": { + "description": "鍒涘缓鏃堕棿", "type": "string" }, "hidden": { @@ -9129,6 +9361,10 @@ "system.SysBaseMenuBtn": { "type": "object", "properties": { + "created_at": { + "description": "鍒涘缓鏃堕棿", + "type": "string" + }, "desc": { "type": "string" }, @@ -9147,6 +9383,10 @@ "system.SysBaseMenuParameter": { "type": "object", "properties": { + "created_at": { + "description": "鍒涘缓鏃堕棿", + "type": "string" + }, "id": { "description": "涓婚敭ID", "type": "integer" @@ -9171,6 +9411,10 @@ "system.SysDictionary": { "type": "object", "properties": { + "created_at": { + "description": "鍒涘缓鏃堕棿", + "type": "string" + }, "desc": { "description": "鎻忚堪", "type": "string" @@ -9202,6 +9446,10 @@ "system.SysDictionaryDetail": { "type": "object", "properties": { + "created_at": { + "description": "鍒涘缓鏃堕棿", + "type": "string" + }, "id": { "description": "涓婚敭ID", "type": "integer" @@ -9251,6 +9499,10 @@ }, "component": { "description": "瀵瑰簲鍓嶇鏂囦欢璺緞", + "type": "string" + }, + "created_at": { + "description": "鍒涘缓鏃堕棿", "type": "string" }, "hidden": { @@ -9311,6 +9563,10 @@ }, "body": { "description": "璇锋眰Body", + "type": "string" + }, + "created_at": { + "description": "鍒涘缓鏃堕棿", "type": "string" }, "error_message": { @@ -9378,6 +9634,10 @@ "description": "鍩虹棰滆壊", "type": "string" }, + "created_at": { + "description": "鍒涘缓鏃堕棿", + "type": "string" + }, "email": { "description": "鐢ㄦ埛閭", "type": "string" @@ -9427,6 +9687,10 @@ "test.Contract": { "type": "object", "properties": { + "created_at": { + "description": "鍒涘缓鏃堕棿", + "type": "string" + }, "fileContent": { "type": "array", "items": { @@ -9448,6 +9712,10 @@ "test.Industry": { "type": "object", "properties": { + "created_at": { + "description": "鍒涘缓鏃堕棿", + "type": "string" + }, "id": { "description": "涓婚敭ID", "type": "integer" @@ -9460,6 +9728,10 @@ "test.Member": { "type": "object", "properties": { + "created_at": { + "description": "鍒涘缓鏃堕棿", + "type": "string" + }, "id": { "description": "涓婚敭ID", "type": "integer" @@ -9478,6 +9750,10 @@ "test.Product": { "type": "object", "properties": { + "created_at": { + "description": "鍒涘缓鏃堕棿", + "type": "string" + }, "deliveryTime": { "type": "integer" }, @@ -9541,6 +9817,10 @@ "contact": { "type": "string" }, + "created_at": { + "description": "鍒涘缓鏃堕棿", + "type": "string" + }, "detailAddress": { "type": "string" }, @@ -9583,6 +9863,10 @@ "test.SupplierType": { "type": "object", "properties": { + "created_at": { + "description": "鍒涘缓鏃堕棿", + "type": "string" + }, "id": { "description": "涓婚敭ID", "type": "integer" diff --git a/docs/swagger.yaml b/docs/swagger.yaml index a58da37..667af04 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -595,6 +595,9 @@ type: object example.ExaCustomer: properties: + created_at: + description: 鍒涘缓鏃堕棿 + type: string customerName: description: 瀹㈡埛鍚� type: string @@ -619,6 +622,9 @@ properties: chunkTotal: type: integer + created_at: + description: 鍒涘缓鏃堕棿 + type: string exaFileChunk: items: $ref: '#/definitions/example.ExaFileChunk' @@ -637,6 +643,9 @@ type: object example.ExaFileChunk: properties: + created_at: + description: 鍒涘缓鏃堕棿 + type: string exaFileID: type: integer fileChunkNumber: @@ -649,6 +658,9 @@ type: object example.ExaFileUploadAndDownload: properties: + created_at: + description: 鍒涘缓鏃堕棿 + type: string id: description: 涓婚敭ID type: integer @@ -669,6 +681,9 @@ properties: contact: description: 鑱旂郴浜� + type: string + created_at: + description: 鍒涘缓鏃堕棿 type: string deliveryDate: description: 浜や粯鏃ユ湡 @@ -700,6 +715,9 @@ amount: description: 閲囪喘鏁伴噺 type: number + created_at: + description: 鍒涘缓鏃堕棿 + type: string id: description: 涓婚敭ID type: integer @@ -897,6 +915,9 @@ properties: apiGroup: description: api缁� + type: string + created_at: + description: 鍒涘缓鏃堕棿 type: string desc: description: 鎺掑簭鏂瑰紡:鍗囧簭false(榛樿)|闄嶅簭true @@ -1258,6 +1279,9 @@ apiGroup: description: api缁� type: string + created_at: + description: 鍒涘缓鏃堕棿 + type: string description: description: api涓枃鎻忚堪 type: string @@ -1308,6 +1332,9 @@ type: object system.SysAutoCode: properties: + created_at: + description: 鍒涘缓鏃堕棿 + type: string desc: type: string id: @@ -1330,6 +1357,9 @@ type: array component: description: 瀵瑰簲鍓嶇鏂囦欢璺緞 + type: string + created_at: + description: 鍒涘缓鏃堕棿 type: string hidden: description: 鏄惁鍦ㄥ垪琛ㄩ殣钘� @@ -1364,6 +1394,9 @@ type: object system.SysBaseMenuBtn: properties: + created_at: + description: 鍒涘缓鏃堕棿 + type: string desc: type: string id: @@ -1376,6 +1409,9 @@ type: object system.SysBaseMenuParameter: properties: + created_at: + description: 鍒涘缓鏃堕棿 + type: string id: description: 涓婚敭ID type: integer @@ -1393,6 +1429,9 @@ type: object system.SysDictionary: properties: + created_at: + description: 鍒涘缓鏃堕棿 + type: string desc: description: 鎻忚堪 type: string @@ -1415,6 +1454,9 @@ type: object system.SysDictionaryDetail: properties: + created_at: + description: 鍒涘缓鏃堕棿 + type: string id: description: 涓婚敭ID type: integer @@ -1450,6 +1492,9 @@ type: array component: description: 瀵瑰簲鍓嶇鏂囦欢璺緞 + type: string + created_at: + description: 鍒涘缓鏃堕棿 type: string hidden: description: 鏄惁鍦ㄥ垪琛ㄩ殣钘� @@ -1491,6 +1536,9 @@ type: string body: description: 璇锋眰Body + type: string + created_at: + description: 鍒涘缓鏃堕棿 type: string error_message: description: 閿欒淇℃伅 @@ -1539,6 +1587,9 @@ baseColor: description: 鍩虹棰滆壊 type: string + created_at: + description: 鍒涘缓鏃堕棿 + type: string email: description: 鐢ㄦ埛閭 type: string @@ -1574,6 +1625,9 @@ type: object test.Contract: properties: + created_at: + description: 鍒涘缓鏃堕棿 + type: string fileContent: items: type: integer @@ -1588,6 +1642,9 @@ type: object test.Industry: properties: + created_at: + description: 鍒涘缓鏃堕棿 + type: string id: description: 涓婚敭ID type: integer @@ -1596,6 +1653,9 @@ type: object test.Member: properties: + created_at: + description: 鍒涘缓鏃堕棿 + type: string id: description: 涓婚敭ID type: integer @@ -1608,6 +1668,9 @@ type: object test.Product: properties: + created_at: + description: 鍒涘缓鏃堕棿 + type: string deliveryTime: type: integer id: @@ -1650,6 +1713,9 @@ type: string contact: type: string + created_at: + description: 鍒涘缓鏃堕棿 + type: string detailAddress: type: string email: @@ -1678,6 +1744,9 @@ type: object test.SupplierType: properties: + created_at: + description: 鍒涘缓鏃堕棿 + type: string id: description: 涓婚敭ID type: integer @@ -2759,11 +2828,52 @@ summary: 鎵归噺鍒犻櫎Contract tags: - Contract + /con/downloadContract: + get: + consumes: + - application/json + parameters: + - description: 鍒涘缓鏃堕棿 + in: query + name: created_at + type: string + - collectionFormat: csv + in: query + items: + type: integer + name: fileContent + type: array + - in: query + name: fileName + type: string + - description: 涓婚敭ID + in: query + name: id + type: integer + - in: query + name: supplierID + type: integer + produces: + - application/json + responses: + "200": + description: '{"success":true,"data":{},"msg":"涓嬭浇鎴愬姛"}' + schema: + type: string + security: + - ApiKeyAuth: [] + summary: 涓嬭浇Contract + tags: + - Contract /con/findContract: get: consumes: - application/json parameters: + - description: 鍒涘缓鏃堕棿 + in: query + name: created_at + type: string - collectionFormat: csv in: query items: @@ -2797,6 +2907,10 @@ consumes: - application/json parameters: + - description: 鍒涘缓鏃堕棿 + in: query + name: created_at + type: string - in: query name: endCreatedAt type: string @@ -2848,6 +2962,10 @@ consumes: - application/json parameters: + - description: 鍒涘缓鏃堕棿 + in: query + name: created_at + type: string - collectionFormat: csv in: query items: @@ -2931,6 +3049,10 @@ consumes: - application/json parameters: + - description: 鍒涘缓鏃堕棿 + in: query + name: created_at + type: string - description: 瀹㈡埛鍚� in: query name: customerName @@ -3337,6 +3459,10 @@ consumes: - application/json parameters: + - description: 鍒涘缓鏃堕棿 + in: query + name: created_at + type: string - description: 涓婚敭ID in: query name: id @@ -3361,6 +3487,10 @@ consumes: - application/json parameters: + - description: 鍒涘缓鏃堕棿 + in: query + name: created_at + type: string - in: query name: endCreatedAt type: string @@ -3560,6 +3690,10 @@ consumes: - application/json parameters: + - description: 鍒涘缓鏃堕棿 + in: query + name: created_at + type: string - description: 涓婚敭ID in: query name: id @@ -3590,6 +3724,10 @@ consumes: - application/json parameters: + - description: 鍒涘缓鏃堕棿 + in: query + name: created_at + type: string - in: query name: endCreatedAt type: string @@ -3638,6 +3776,10 @@ consumes: - application/json parameters: + - description: 鍒涘缓鏃堕棿 + in: query + name: created_at + type: string - in: query name: endCreatedAt type: string @@ -4037,6 +4179,10 @@ consumes: - application/json parameters: + - description: 鍒涘缓鏃堕棿 + in: query + name: created_at + type: string - in: query name: deliveryTime type: integer @@ -4097,6 +4243,10 @@ consumes: - application/json parameters: + - description: 鍒涘缓鏃堕棿 + in: query + name: created_at + type: string - in: query name: deliveryTime type: integer @@ -4175,6 +4325,10 @@ consumes: - application/json parameters: + - description: 鍒涘缓鏃堕棿 + in: query + name: created_at + type: string - in: query name: deliveryTime type: integer @@ -4553,6 +4707,10 @@ - in: query name: contact type: string + - description: 鍒涘缓鏃堕棿 + in: query + name: created_at + type: string - in: query name: detailAddress type: string @@ -4618,6 +4776,10 @@ type: string - in: query name: contact + type: string + - description: 鍒涘缓鏃堕棿 + in: query + name: created_at type: string - in: query name: detailAddress @@ -4783,6 +4945,10 @@ consumes: - application/json parameters: + - description: 鍒涘缓鏃堕棿 + in: query + name: created_at + type: string - description: 涓婚敭ID in: query name: id @@ -4807,6 +4973,10 @@ consumes: - application/json parameters: + - description: 鍒涘缓鏃堕棿 + in: query + name: created_at + type: string - in: query name: endCreatedAt type: string @@ -4928,6 +5098,10 @@ consumes: - application/json parameters: + - description: 鍒涘缓鏃堕棿 + in: query + name: created_at + type: string - description: 鎻忚堪 in: query name: desc @@ -4973,6 +5147,10 @@ consumes: - application/json parameters: + - description: 鍒涘缓鏃堕棿 + in: query + name: created_at + type: string - description: 鎻忚堪 in: query name: desc @@ -5113,6 +5291,10 @@ consumes: - application/json parameters: + - description: 鍒涘缓鏃堕棿 + in: query + name: created_at + type: string - description: 涓婚敭ID in: query name: id @@ -5162,6 +5344,10 @@ consumes: - application/json parameters: + - description: 鍒涘缓鏃堕棿 + in: query + name: created_at + type: string - description: 涓婚敭ID in: query name: id @@ -5342,6 +5528,10 @@ in: query name: body type: string + - description: 鍒涘缓鏃堕棿 + in: query + name: created_at + type: string - description: 閿欒淇℃伅 in: query name: error_message @@ -5411,6 +5601,10 @@ in: query name: body type: string + - description: 鍒涘缓鏃堕棿 + in: query + name: created_at + type: string - description: 閿欒淇℃伅 in: query name: error_message diff --git a/global/model.go b/global/model.go index 9acbd55..aef7b54 100644 --- a/global/model.go +++ b/global/model.go @@ -8,7 +8,7 @@ type GVA_MODEL struct { ID uint `gorm:"primarykey"` // 涓婚敭ID - CreatedAt *time.Time `json:"-"` // 鍒涘缓鏃堕棿 + CreatedAt *time.Time `json:"created_at"` // 鍒涘缓鏃堕棿 UpdatedAt *time.Time `json:"-"` // 鏇存柊鏃堕棿 DeletedAt gorm.DeletedAt `gorm:"index" json:"-"` // 鍒犻櫎鏃堕棿 } diff --git a/model/test/contract.go b/model/test/contract.go index 5187a20..80f22a7 100644 --- a/model/test/contract.go +++ b/model/test/contract.go @@ -11,6 +11,7 @@ SupplierID *int `json:"supplierID" form:"supplierID" gorm:"column:supplier_id;comment:渚涘簲鍟唅d;"` FileName string `json:"fileName" form:"fileName" gorm:"column:file_name;comment:鏂囦欢鍚嶇О;size:255;"` FileContent []byte `json:"fileContent" form:"fileContent" gorm:"type:mediumblob;column:file_content;comment:鏂囦欢鍐呭;"` + FileType string `json:"fileType" form:"fileType" gorm:"column:file_type;comment:鏂囦欢绫诲瀷;size:255;"` } // TableName Contract 琛ㄥ悕 diff --git a/router/test/contract.go b/router/test/contract.go index 3cca412..8cffb21 100644 --- a/router/test/contract.go +++ b/router/test/contract.go @@ -20,8 +20,9 @@ conRouter.PUT("updateContract", conApi.UpdateContract) // 鏇存柊Contract } { - conRouterWithoutRecord.GET("findContract", conApi.FindContract) // 鏍规嵁ID鑾峰彇Contract - conRouterWithoutRecord.GET("getContractList", conApi.GetContractList) // 鑾峰彇Contract鍒楄〃 - conRouterWithoutRecord.GET("previewContract", conApi.PreviewContract) // 棰勮Contract + conRouterWithoutRecord.GET("findContract", conApi.FindContract) // 鏍规嵁ID鑾峰彇Contract + conRouterWithoutRecord.GET("getContractList", conApi.GetContractList) // 鑾峰彇Contract鍒楄〃 + conRouterWithoutRecord.GET("previewContract", conApi.PreviewContract) // 棰勮Contract + conRouterWithoutRecord.GET("downloadContract", conApi.DownloadContract) // 涓嬭浇Contract } } diff --git a/service/test/supplier.go b/service/test/supplier.go index 8a75662..8ac496d 100644 --- a/service/test/supplier.go +++ b/service/test/supplier.go @@ -34,7 +34,7 @@ // UpdateSupplier 鏇存柊Supplier璁板綍 // Author [piexlmax](https://github.com/piexlmax) func (sService *SupplierService) UpdateSupplier(s test.Supplier) (err error) { - err = global.GVA_DB.Save(&s).Error + err = global.GVA_DB.Updates(&s).Error return err } -- Gitblit v1.8.0