master
huanghai 5 years ago
commit af6afea195

@ -17,6 +17,7 @@ func Routers(r *gin.RouterGroup) {
rr.POST("/UpdateGlobalInfo", UpdateGlobalInfo) rr.POST("/UpdateGlobalInfo", UpdateGlobalInfo)
rr.GET("/PageGlobalInfo", PageGlobalInfo) rr.GET("/PageGlobalInfo", PageGlobalInfo)
rr.GET("/GetGlobalInfo", GetGlobalInfo) rr.GET("/GetGlobalInfo", GetGlobalInfo)
rr.GET("/GetGlobalValueByCodes", GetGlobalValueByCodes)
return return
} }
@ -37,7 +38,7 @@ func Routers(r *gin.RouterGroup) {
// @X-IntLimit ["globalTypeId","sortId"] // @X-IntLimit ["globalTypeId","sortId"]
// @X-LengthLimit [{"globalCode":"2,50"},{"globalValue":"1,255"},{"globalRemarks":"1,500"}] // @X-LengthLimit [{"globalCode":"2,50"},{"globalValue":"1,255"},{"globalRemarks":"1,500"}]
// @X-RoleLimit ["1"] // @X-RoleLimit ["1"]
// @X-Sort [3] // @X-Sort [4]
func AddGlobalInfo(c *gin.Context) { func AddGlobalInfo(c *gin.Context) {
globalTypeId := CommonUtil.ConvertStringToInt(c.PostForm("globalTypeId")) globalTypeId := CommonUtil.ConvertStringToInt(c.PostForm("globalTypeId"))
globalCode := c.PostForm("globalCode") globalCode := c.PostForm("globalCode")
@ -81,7 +82,7 @@ func AddGlobalInfo(c *gin.Context) {
// @X-EmptyLimit ["globalIds"] // @X-EmptyLimit ["globalIds"]
// @X-LengthLimit [{"globalIds":"36,1800"}] // @X-LengthLimit [{"globalIds":"36,1800"}]
// @X-RoleLimit ["1"] // @X-RoleLimit ["1"]
// @X-Sort [4] // @X-Sort [5]
func DeleteGlobalInfo(c *gin.Context) { func DeleteGlobalInfo(c *gin.Context) {
globalId := c.PostForm("globalId") globalId := c.PostForm("globalId")
//操作人 //操作人
@ -126,7 +127,7 @@ func DeleteGlobalInfo(c *gin.Context) {
// @X-IntLimit ["globalId","globalTypeId","sortId"] // @X-IntLimit ["globalId","globalTypeId","sortId"]
// @X-LengthLimit [{"globalId":"36,36"},{"globalCode":"2,50"},{"globalValue":"1,255"},{"globalRemarks":"1,500"}] // @X-LengthLimit [{"globalId":"36,36"},{"globalCode":"2,50"},{"globalValue":"1,255"},{"globalRemarks":"1,500"}]
// @X-RoleLimit ["1"] // @X-RoleLimit ["1"]
// @X-Sort [5] // @X-Sort [6]
func UpdateGlobalInfo(c *gin.Context) { func UpdateGlobalInfo(c *gin.Context) {
globalId := c.PostForm("globalId") globalId := c.PostForm("globalId")
globalTypeId := CommonUtil.ConvertStringToInt32(c.PostForm("globalTypeId")) globalTypeId := CommonUtil.ConvertStringToInt32(c.PostForm("globalTypeId"))
@ -248,3 +249,38 @@ func GetGlobalInfo(c *gin.Context) {
Count: r.Count, Count: r.Count,
}) })
} }
// @Summary 根据多个全局变量Code获取全局变量值
// @Description 根据多个全局变量Code获取全局变量值
// @Tags 全局变量
// @Accept application/x-www-form-urlencoded
// @Produce json
// @Param codes query string true "全局变量Code多个用逗号分隔"
// @Success 200 {object} Model.Res
// @Router /base/global/GetGlobalValueByCodes [get]
// @X-EmptyLimit ["codes"]
// @X-LengthLimit [{"codes":"1,500"}]
// @X-RoleLimit ["1","2","3","4","5","6","7"]
// @X-InterfaceName ["GetBaseGlobal"]
// @X-TableName ["t_base_global"]
// @X-Sort [3]
func GetGlobalValueByCodes(c *gin.Context) {
//全局变量Code多个用逗号分隔
codes := c.Query("codes")
r, err := BaseGlobalService.GetGlobalValueByCodes(codes)
if err != nil {
c.JSON(http.StatusOK, Model.Res{
Success: false,
Message: "调用RPC服务失败",
})
return
}
c.JSON(http.StatusOK, Model.Res{
Success: r.Success,
Message: r.Message,
List: CommonUtil.ConvertJsonStringToMapArray(r.List),
Count: r.Count,
})
}

@ -30,3 +30,9 @@ func GetGlobalInfo(globalId string,actionPersonId string,actionIpAddress string)
Reply, err := GetBaseGlobal(BaseGlobalProto.ModelArg{GlobalId: globalId, ActionPersonId: actionPersonId, ActionIpAddress: actionIpAddress}) Reply, err := GetBaseGlobal(BaseGlobalProto.ModelArg{GlobalId: globalId, ActionPersonId: actionPersonId, ActionIpAddress: actionIpAddress})
return Reply, err return Reply, err
} }
func GetGlobalValueByCodes(codes string) (*BaseGlobalProto.Reply, error) {
idsArr := strings.Split(codes, ",")
Reply, err := GetBaseGlobalByCodes(BaseGlobalProto.GlobalCodesArg{GlobalCodes: idsArr})
return Reply, err
}

@ -115,3 +115,23 @@ func GetBaseGlobal(modelArg BaseGlobalProto.ModelArg) (*BaseGlobalProto.Reply, e
} }
return Reply, err return Reply, err
} }
/**
Code
*/
func GetBaseGlobalByCodes(globalCodesArg BaseGlobalProto.GlobalCodesArg) (*BaseGlobalProto.Reply, error) {
//1、准备动作连接服务器
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
conn := GRpcUtil.GetConnection()
if conn == nil {
return nil, errors.New("RPC服务未启动")
}
//2、业务传参
c := BaseGlobalProto.NewBaseGlobalManageClient(conn)
Reply, err := c.GetBaseGlobalByCodes(ctx, &globalCodesArg)
if err != nil {
LogUtil.Error("获取全局变量信息错误: ", err.Error())
}
return Reply, err
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -329,6 +329,53 @@ definitions:
example: "true" example: "true"
type: boolean type: boolean
type: object type: object
base.global.GetGlobalValueByCodes:
properties:
count:
description: 一共有多少条
example: "1"
type: integer
list:
items:
properties:
b_use:
description: 是否启用 0未启用 1启用
example: 1
type: integer
global_code:
description: 全局变量代码
example: passwordType
type: string
global_id:
description: 全局变量ID
example: 954839E9-D743-4FC2-A8EA-EE32327A2895
type: string
global_remarks:
description: 全局变量备注
example: 1:等保要求的密码强度 2非等保要求的密码强度
type: string
global_type_id:
description: 全局变量分类
example: 1
type: integer
global_value:
description: 全局变量值
example: "2"
type: string
sort_id:
description: 排序号
example: 1
type: integer
type: array
message:
description: 返回的消息
example: 操作成功
type: string
success:
description: 是否成功
example: "true"
type: boolean
type: object
base.global.PageGlobalInfo: base.global.PageGlobalInfo:
properties: properties:
count: count:
@ -2578,7 +2625,7 @@ paths:
x-rolelimit: x-rolelimit:
- "1" - "1"
x-sort: x-sort:
- 3 - 4
/base/global/DeleteGlobalInfo: /base/global/DeleteGlobalInfo:
post: post:
consumes: consumes:
@ -2607,7 +2654,7 @@ paths:
x-rolelimit: x-rolelimit:
- "1" - "1"
x-sort: x-sort:
- 4 - 5
/base/global/GetGlobalInfo: /base/global/GetGlobalInfo:
get: get:
consumes: consumes:
@ -2641,6 +2688,45 @@ paths:
- 2 - 2
x-tablename: x-tablename:
- t_base_global - t_base_global
/base/global/GetGlobalValueByCodes:
get:
consumes:
- application/x-www-form-urlencoded
description: 根据多个全局变量Code获取全局变量值
parameters:
- description: 全局变量Code多个用逗号分隔
in: query
name: codes
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/base.global.GetGlobalValueByCodes'
summary: 根据多个全局变量Code获取全局变量值
tags:
- 全局变量
x-emptylimit:
- codes
x-interfacename:
- GetBaseGlobal
x-lengthlimit:
- codes: 1,500
x-rolelimit:
- "1"
- "2"
- "3"
- "4"
- "5"
- "6"
- "7"
x-sort:
- 3
x-tablename:
- t_base_global
/base/global/PageGlobalInfo: /base/global/PageGlobalInfo:
get: get:
consumes: consumes:
@ -2749,7 +2835,7 @@ paths:
x-rolelimit: x-rolelimit:
- "1" - "1"
x-sort: x-sort:
- 5 - 6
/base/loginperson/DisableAccountInfo: /base/loginperson/DisableAccountInfo:
post: post:
consumes: consumes:

Loading…
Cancel
Save