master
huanghai 5 years ago
commit af6afea195

@ -17,6 +17,7 @@ func Routers(r *gin.RouterGroup) {
rr.POST("/UpdateGlobalInfo", UpdateGlobalInfo)
rr.GET("/PageGlobalInfo", PageGlobalInfo)
rr.GET("/GetGlobalInfo", GetGlobalInfo)
rr.GET("/GetGlobalValueByCodes", GetGlobalValueByCodes)
return
}
@ -37,7 +38,7 @@ func Routers(r *gin.RouterGroup) {
// @X-IntLimit ["globalTypeId","sortId"]
// @X-LengthLimit [{"globalCode":"2,50"},{"globalValue":"1,255"},{"globalRemarks":"1,500"}]
// @X-RoleLimit ["1"]
// @X-Sort [3]
// @X-Sort [4]
func AddGlobalInfo(c *gin.Context) {
globalTypeId := CommonUtil.ConvertStringToInt(c.PostForm("globalTypeId"))
globalCode := c.PostForm("globalCode")
@ -81,7 +82,7 @@ func AddGlobalInfo(c *gin.Context) {
// @X-EmptyLimit ["globalIds"]
// @X-LengthLimit [{"globalIds":"36,1800"}]
// @X-RoleLimit ["1"]
// @X-Sort [4]
// @X-Sort [5]
func DeleteGlobalInfo(c *gin.Context) {
globalId := c.PostForm("globalId")
//操作人
@ -126,7 +127,7 @@ func DeleteGlobalInfo(c *gin.Context) {
// @X-IntLimit ["globalId","globalTypeId","sortId"]
// @X-LengthLimit [{"globalId":"36,36"},{"globalCode":"2,50"},{"globalValue":"1,255"},{"globalRemarks":"1,500"}]
// @X-RoleLimit ["1"]
// @X-Sort [5]
// @X-Sort [6]
func UpdateGlobalInfo(c *gin.Context) {
globalId := c.PostForm("globalId")
globalTypeId := CommonUtil.ConvertStringToInt32(c.PostForm("globalTypeId"))
@ -248,3 +249,38 @@ func GetGlobalInfo(c *gin.Context) {
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,
})
}

@ -5,28 +5,34 @@ import (
"strings"
)
func AddGlobalInfo(globalTypeId int, globalCode string, globalValue string, globalRemarks string, sortId int32,actionPersonId string,actionIpAddress string) (*BaseGlobalProto.Reply, error) {
func AddGlobalInfo(globalTypeId int, globalCode string, globalValue string, globalRemarks string, sortId int32, actionPersonId string, actionIpAddress string) (*BaseGlobalProto.Reply, error) {
Reply, err := AddBaseGlobal(BaseGlobalProto.ModelArg{GlobalTypeId: int32(globalTypeId), GlobalCode: globalCode, GlobalValue: globalValue, GlobalRemarks: globalRemarks, SortId: sortId, BUse: 1, ActionPersonId: actionPersonId, ActionIpAddress: actionIpAddress})
return Reply, err
}
func DeleteGlobalInfo(ids string,actionPersonId string,actionIpAddress string) (*BaseGlobalProto.Reply, error) {
func DeleteGlobalInfo(ids string, actionPersonId string, actionIpAddress string) (*BaseGlobalProto.Reply, error) {
idsArr := strings.Split(ids, ",")
Reply, err := DeleteBaseGlobal(BaseGlobalProto.DeleteIdsArg{Ids: idsArr, ActionPersonId: actionPersonId, ActionIpAddress: actionIpAddress})
return Reply, err
}
func UpdateGlobalInfo(globalId string, globalTypeId int32, globalCode string, globalValue string, globalRemarks string, sortId int32,actionPersonId string,actionIpAddress string) (*BaseGlobalProto.Reply, error) {
func UpdateGlobalInfo(globalId string, globalTypeId int32, globalCode string, globalValue string, globalRemarks string, sortId int32, actionPersonId string, actionIpAddress string) (*BaseGlobalProto.Reply, error) {
Reply, err := UpdateBaseGlobal(BaseGlobalProto.ModelArg{GlobalId: globalId, GlobalTypeId: globalTypeId, GlobalCode: globalCode, GlobalValue: globalValue, GlobalRemarks: globalRemarks, SortId: sortId, ActionPersonId: actionPersonId, ActionIpAddress: actionIpAddress})
return Reply, err
}
func PageGlobalInfo(page int32, limit int32, globalTypeId int32,actionPersonId string,actionIpAddress string) (*BaseGlobalProto.Reply, error) {
func PageGlobalInfo(page int32, limit int32, globalTypeId int32, actionPersonId string, actionIpAddress string) (*BaseGlobalProto.Reply, error) {
Reply, err := PageBaseGlobal(BaseGlobalProto.QueryArg{Page: page, Limit: limit, GlobalTypeId: globalTypeId, ActionPersonId: actionPersonId, ActionIpAddress: actionIpAddress})
return Reply, err
}
func GetGlobalInfo(globalId string,actionPersonId string,actionIpAddress string) (*BaseGlobalProto.Reply, error) {
func GetGlobalInfo(globalId string, actionPersonId string, actionIpAddress string) (*BaseGlobalProto.Reply, error) {
Reply, err := GetBaseGlobal(BaseGlobalProto.ModelArg{GlobalId: globalId, ActionPersonId: actionPersonId, ActionIpAddress: actionIpAddress})
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
}
/**
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"
type: boolean
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:
properties:
count:
@ -2578,7 +2625,7 @@ paths:
x-rolelimit:
- "1"
x-sort:
- 3
- 4
/base/global/DeleteGlobalInfo:
post:
consumes:
@ -2607,7 +2654,7 @@ paths:
x-rolelimit:
- "1"
x-sort:
- 4
- 5
/base/global/GetGlobalInfo:
get:
consumes:
@ -2641,6 +2688,45 @@ paths:
- 2
x-tablename:
- 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:
get:
consumes:
@ -2749,7 +2835,7 @@ paths:
x-rolelimit:
- "1"
x-sort:
- 5
- 6
/base/loginperson/DisableAccountInfo:
post:
consumes:

Loading…
Cancel
Save