fix
wangpengfei
2023-08-28 301003bb605007c3e035442de4bced9dd02164bb
fix

add download functionality to contract
8个文件已修改
837 ■■■■■ 已修改文件
api/v1/test/contract.go 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/docs.go 284 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/swagger.json 284 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/swagger.yaml 194 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
global/model.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/test/contract.go 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
router/test/contract.go 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/test/supplier.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
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 "用id查询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)
    }
}
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": "用id查询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": "用id查询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": "用id查询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": "用id查询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": "用id查询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": "用id查询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"
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": "用id查询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": "用id查询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": "用id查询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": "用id查询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": "用id查询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": "用id查询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"
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
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:"-"` // 删除时间
}
model/test/contract.go
@@ -11,6 +11,7 @@
    SupplierID  *int   `json:"supplierID" form:"supplierID" gorm:"column:supplier_id;comment:供应商id;"`
    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 表名
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
    }
}
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
}