Procházet zdrojové kódy

企业风管增加“获取企业风管终端权限”接口

zhou.xiaoning před 4 roky
rodič
revize
ff15670206
6 změnil soubory, kde provedl 206 přidání a 1 odebrání
  1. 41 1
      controllers/ermcp/qryUser.go
  2. 56 0
      docs/docs.go
  3. 56 0
      docs/swagger.json
  4. 36 0
      docs/swagger.yaml
  5. 13 0
      models/ermcpUser.go
  6. 4 0
      routers/router.go

+ 41 - 1
controllers/ermcp/qryUser.go

@@ -7,12 +7,13 @@
 package ermcp
 
 import (
-	"github.com/gin-gonic/gin"
 	"mtp2_if/global/app"
 	"mtp2_if/global/e"
 	"mtp2_if/logger"
 	"mtp2_if/models"
 	"net/http"
+
+	"github.com/gin-gonic/gin"
 )
 
 // 查询客户资料请求
@@ -50,3 +51,42 @@ func QueryUserInfo(c *gin.Context) {
 		appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
 	}
 }
+
+// GetErmcpRolefuncMenuReq 获取企业风管终端权限请求参数
+type GetErmcpRolefuncMenuReq struct {
+	LoginID int `form:"loginID" binding:"required"`
+}
+
+// GetErmcpRolefuncMenu 获取企业风管终端权限
+// @Summary 获取企业风管终端权限
+// @Produce json
+// @Security ApiKeyAuth
+// @Param loginID query int true "登录账号"
+// @Success 200 {object} models.Rolefuncmenu
+// @Failure 500 {object} app.Response
+// @Router /Ermcp/GetErmcpRolefuncMenu [get]
+// @Tags 企业风险管理(app)
+func GetErmcpRolefuncMenu(c *gin.Context) {
+	appG := app.Gin{C: c}
+
+	// 获取请求参数
+	var req GetErmcpRolefuncMenuReq
+	if err := appG.C.ShouldBindQuery(&req); err != nil {
+		logger.GetLogger().Errorf("GetErmcpRolefuncMenu failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
+		return
+	}
+
+	// 获取数据
+	rst, err := models.GetErmcpRolefuncMenu(req.LoginID)
+	if err != nil {
+		// 查询失败
+		logger.GetLogger().Errorf("GetErmcpRolefuncMenu failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
+		return
+	}
+
+	// 查询成功返回
+	logger.GetLogger().Debugln("GetErmcpRolefuncMenu successed: %v", rst)
+	appG.Response(http.StatusOK, e.SUCCESS, rst)
+}

+ 56 - 0
docs/docs.go

@@ -828,6 +828,45 @@ var doc = `{
                 }
             }
         },
+        "/Ermcp/GetErmcpRolefuncMenu": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "企业风险管理(app)"
+                ],
+                "summary": "获取企业风管终端权限",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "登录账号",
+                        "name": "loginID",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/models.Rolefuncmenu"
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Ermcp/QryReportDayExposure": {
             "get": {
                 "security": [
@@ -15284,6 +15323,23 @@ var doc = `{
                 }
             }
         },
+        "models.Rolefuncmenu": {
+            "type": "object",
+            "required": [
+                "resourcecode",
+                "roleid"
+            ],
+            "properties": {
+                "resourcecode": {
+                    "description": "菜单代码",
+                    "type": "string"
+                },
+                "roleid": {
+                    "description": "角色权限ID",
+                    "type": "integer"
+                }
+            }
+        },
         "models.SearchGoods": {
             "type": "object",
             "required": [

+ 56 - 0
docs/swagger.json

@@ -812,6 +812,45 @@
                 }
             }
         },
+        "/Ermcp/GetErmcpRolefuncMenu": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "企业风险管理(app)"
+                ],
+                "summary": "获取企业风管终端权限",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "登录账号",
+                        "name": "loginID",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/models.Rolefuncmenu"
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Ermcp/QryReportDayExposure": {
             "get": {
                 "security": [
@@ -15268,6 +15307,23 @@
                 }
             }
         },
+        "models.Rolefuncmenu": {
+            "type": "object",
+            "required": [
+                "resourcecode",
+                "roleid"
+            ],
+            "properties": {
+                "resourcecode": {
+                    "description": "菜单代码",
+                    "type": "string"
+                },
+                "roleid": {
+                    "description": "角色权限ID",
+                    "type": "integer"
+                }
+            }
+        },
         "models.SearchGoods": {
             "type": "object",
             "required": [

+ 36 - 0
docs/swagger.yaml

@@ -6625,6 +6625,18 @@ definitions:
         description: 商品名称
         type: string
     type: object
+  models.Rolefuncmenu:
+    properties:
+      resourcecode:
+        description: 菜单代码
+        type: string
+      roleid:
+        description: 角色权限ID
+        type: integer
+    required:
+    - resourcecode
+    - roleid
+    type: object
   models.SearchGoods:
     properties:
       goodscode:
@@ -9736,6 +9748,30 @@ paths:
       summary: 查询企业风管期货商品信息
       tags:
       - 企业风险管理(app)
+  /Ermcp/GetErmcpRolefuncMenu:
+    get:
+      parameters:
+      - description: 登录账号
+        in: query
+        name: loginID
+        required: true
+        type: integer
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            $ref: '#/definitions/models.Rolefuncmenu'
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 获取企业风管终端权限
+      tags:
+      - 企业风险管理(app)
   /Ermcp/QryReportDayExposure:
     get:
       parameters:

+ 13 - 0
models/ermcpUser.go

@@ -178,3 +178,16 @@ func (r *ErmcpUserModel) GetData(queryType int32) ([]ErmcpUserModel, error) {
 
 	return sData, nil
 }
+
+// GetErmcpRolefuncMenu 获取企业风管终端权限
+func GetErmcpRolefuncMenu(loginID int) ([]Rolefuncmenu, error) {
+	roleFuncMenus := make([]Rolefuncmenu, 0)
+	if err := db.GetEngine().Table("ROLEFUNCMENU R").
+		Join("INNER", "LOGINACCOUNT L", "L.CLIENTROLEID = R.ROLEID").
+		Where("L.LOGINID = ?", loginID).
+		Find(&roleFuncMenus); err != nil {
+		return nil, err
+	}
+
+	return roleFuncMenus, nil
+}

+ 4 - 0
routers/router.go

@@ -375,6 +375,10 @@ func InitRouter() *gin.Engine {
 		ermcpR.GET("/QueryErmcpHisOrderDetails", ermcp.QueryErmcpHisOrderDetails)
 		// 获取企业风管期货历史成交单信息
 		ermcpR.GET("/QueryErmcpHisTradeDetails", ermcp.QueryErmcpHisTradeDetails)
+
+		// 权限相关
+		// 获取企业风管终端权限
+		ermcpR.GET("/GetErmcpRolefuncMenu", ermcp.GetErmcpRolefuncMenu)
 	}
 
 	return r