소스 검색

增加“查询交易端列表头信息”接口

Simon Zhou 5 년 전
부모
커밋
cd20c6cc06
5개의 변경된 파일322개의 추가작업 그리고 0개의 파일을 삭제
  1. 45 0
      controllers/common/table.go
  2. 102 0
      docs/docs.go
  3. 102 0
      docs/swagger.json
  4. 70 0
      docs/swagger.yaml
  5. 3 0
      routers/router.go

+ 45 - 0
controllers/common/table.go

@@ -271,3 +271,48 @@ func getOperationMenu() ([]OperationPrimaryMenu, error) {
 
 	return rst, nil
 }
+
+// QueryTableColumnConfigReq 查询交易端列表头信息请求参数
+type QueryTableColumnConfigReq struct {
+	TableKey string `json:"TableKey"` // 表key
+}
+
+// QueryTableColumnConfig 查询交易端列表头信息
+// @Summary 查询交易端列表头信息
+// @Produce json
+// @Security ApiKeyAuth
+// @Param TableKey query string false "表key"
+// @Success 200 {object} models.Tablecolumnconfig
+// @Failure 500 {object} app.Response
+// @Router /Common/QueryTableColumnConfig [get]
+// @Tags 通用
+func QueryTableColumnConfig(c *gin.Context) {
+	appG := app.Gin{C: c}
+
+	// 获取请求参数
+	var req QueryTableColumnConfigReq
+	if err := appG.C.ShouldBindQuery(&req); err != nil {
+		logger.GetLogger().Errorf("QueryTableColumnConfig failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
+		return
+	}
+
+	engine := db.GetEngine()
+	tablecolumnconfigs := make([]models.Tablecolumnconfig, 0)
+	// 这里的表名必须要大写 (Oracle的表名都是大写)
+	s := engine.Join("INNER", "TABLEDEFINE", "TABLEDEFINE.TableKey = TABLECOLUMNCONFIG.TableKey")
+	if len(req.TableKey) > 0 {
+		s = s.Where("TABLEDEFINE.TableType = 2 and TABLEDEFINE.TableKey = ?", req.TableKey)
+	} else {
+		s = s.Where("TABLEDEFINE.TableType = 2")
+	}
+	if err := s.Find(&tablecolumnconfigs); err != nil {
+		logger.GetLogger().Errorf("QueryTableColumnConfig failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
+		return
+	}
+
+	// 查询成功
+	logger.GetLogger().Infof("QueryTableColumnConfig successed: %v", tablecolumnconfigs)
+	appG.Response(http.StatusOK, e.SUCCESS, tablecolumnconfigs)
+}

+ 102 - 0
docs/docs.go

@@ -369,6 +369,44 @@ var doc = `{
                 }
             }
         },
+        "/Common/QueryTableColumnConfig": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "通用"
+                ],
+                "summary": "查询交易端列表头信息",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "表key",
+                        "name": "TableKey",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/models.Tablecolumnconfig"
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Common/QueryTraderMenu": {
             "get": {
                 "security": [
@@ -2237,6 +2275,70 @@ var doc = `{
                     "type": "integer"
                 }
             }
+        },
+        "models.Tablecolumnconfig": {
+            "type": "object",
+            "required": [
+                "autoid"
+            ],
+            "properties": {
+                "aligntype": {
+                    "description": "对齐方式 - 1:居中对齐 2:左对齐 3:右对齐",
+                    "type": "integer"
+                },
+                "autoid": {
+                    "description": "AutoID",
+                    "type": "integer"
+                },
+                "columnfield": {
+                    "description": "列字段",
+                    "type": "string"
+                },
+                "columntitle": {
+                    "description": "列Title",
+                    "type": "string"
+                },
+                "columnwidth": {
+                    "description": "列宽",
+                    "type": "string"
+                },
+                "formatterstring": {
+                    "description": "格式化字符",
+                    "type": "string"
+                },
+                "formattertype": {
+                    "description": "格式化类型",
+                    "type": "string"
+                },
+                "groupname": {
+                    "description": "表头分组名称",
+                    "type": "string"
+                },
+                "isshow": {
+                    "description": "是否显示 - 0:不显示 1:显示",
+                    "type": "integer"
+                },
+                "needsummary": {
+                    "description": "是否需要汇总 - 0:不需要 1:需要",
+                    "type": "integer"
+                },
+                "orderindex": {
+                    "description": "顺序",
+                    "type": "integer"
+                },
+                "remark": {
+                    "description": "备注",
+                    "type": "string"
+                },
+                "summarytype": {
+                    "description": "汇总类型 - 1:加总 2:最后一个",
+                    "type": "integer"
+                },
+                "tablekey": {
+                    "description": "列表Key",
+                    "type": "string"
+                }
+            }
         }
     },
     "securityDefinitions": {

+ 102 - 0
docs/swagger.json

@@ -353,6 +353,44 @@
                 }
             }
         },
+        "/Common/QueryTableColumnConfig": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "通用"
+                ],
+                "summary": "查询交易端列表头信息",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "表key",
+                        "name": "TableKey",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/models.Tablecolumnconfig"
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Common/QueryTraderMenu": {
             "get": {
                 "security": [
@@ -2221,6 +2259,70 @@
                     "type": "integer"
                 }
             }
+        },
+        "models.Tablecolumnconfig": {
+            "type": "object",
+            "required": [
+                "autoid"
+            ],
+            "properties": {
+                "aligntype": {
+                    "description": "对齐方式 - 1:居中对齐 2:左对齐 3:右对齐",
+                    "type": "integer"
+                },
+                "autoid": {
+                    "description": "AutoID",
+                    "type": "integer"
+                },
+                "columnfield": {
+                    "description": "列字段",
+                    "type": "string"
+                },
+                "columntitle": {
+                    "description": "列Title",
+                    "type": "string"
+                },
+                "columnwidth": {
+                    "description": "列宽",
+                    "type": "string"
+                },
+                "formatterstring": {
+                    "description": "格式化字符",
+                    "type": "string"
+                },
+                "formattertype": {
+                    "description": "格式化类型",
+                    "type": "string"
+                },
+                "groupname": {
+                    "description": "表头分组名称",
+                    "type": "string"
+                },
+                "isshow": {
+                    "description": "是否显示 - 0:不显示 1:显示",
+                    "type": "integer"
+                },
+                "needsummary": {
+                    "description": "是否需要汇总 - 0:不需要 1:需要",
+                    "type": "integer"
+                },
+                "orderindex": {
+                    "description": "顺序",
+                    "type": "integer"
+                },
+                "remark": {
+                    "description": "备注",
+                    "type": "string"
+                },
+                "summarytype": {
+                    "description": "汇总类型 - 1:加总 2:最后一个",
+                    "type": "integer"
+                },
+                "tablekey": {
+                    "description": "列表Key",
+                    "type": "string"
+                }
+            }
         }
     },
     "securityDefinitions": {

+ 70 - 0
docs/swagger.yaml

@@ -1179,6 +1179,53 @@ definitions:
     required:
     - spotcontractid
     type: object
+  models.Tablecolumnconfig:
+    properties:
+      aligntype:
+        description: 对齐方式 - 1:居中对齐 2:左对齐 3:右对齐
+        type: integer
+      autoid:
+        description: AutoID
+        type: integer
+      columnfield:
+        description: 列字段
+        type: string
+      columntitle:
+        description: 列Title
+        type: string
+      columnwidth:
+        description: 列宽
+        type: string
+      formatterstring:
+        description: 格式化字符
+        type: string
+      formattertype:
+        description: 格式化类型
+        type: string
+      groupname:
+        description: 表头分组名称
+        type: string
+      isshow:
+        description: 是否显示 - 0:不显示 1:显示
+        type: integer
+      needsummary:
+        description: 是否需要汇总 - 0:不需要 1:需要
+        type: integer
+      orderindex:
+        description: 顺序
+        type: integer
+      remark:
+        description: 备注
+        type: string
+      summarytype:
+        description: 汇总类型 - 1:加总 2:最后一个
+        type: integer
+      tablekey:
+        description: 列表Key
+        type: string
+    required:
+    - autoid
+    type: object
 info:
   contact: {}
   description: 新的查询服务,替代原通用查询服务。
@@ -1401,6 +1448,29 @@ paths:
       summary: 查询远期订单信息
       tags:
       - 产能预售
+  /Common/QueryTableColumnConfig:
+    get:
+      parameters:
+      - description: 表key
+        in: query
+        name: TableKey
+        type: string
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            $ref: '#/definitions/models.Tablecolumnconfig'
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 查询交易端列表头信息
+      tags:
+      - 通用
   /Common/QueryTraderMenu:
     get:
       parameters:

+ 3 - 0
routers/router.go

@@ -49,7 +49,10 @@ func InitRouter() *gin.Engine {
 	commonR := apiR.Group("Common")
 	commonR.Use(token.Auth())
 	{
+		// 查询交易端菜单
 		commonR.GET("/QueryTraderMenu", common.QueryTraderMenu)
+		// 查询交易端列表头信息
+		commonR.GET("/QueryTableColumnConfig", common.QueryTableColumnConfig)
 	}
 	// ************************ 仓单贸易 ************************
 	wrTradeR := apiR.Group("WRTrade")