From cd913fbbf0fb6a5f8795cdb8a1af53ff034892e2 Mon Sep 17 00:00:00 2001 From: samwaf Date: Wed, 21 May 2025 09:14:59 +0800 Subject: [PATCH] feat:add item quick set #313 --- api/waf_system_config.go | 10 ++++++++++ model/request/waf_system_config_req.go | 3 +++ router/waf_system_config.go | 1 + service/waf_service/waf_system_config.go | 5 +++++ 4 files changed, 19 insertions(+) diff --git a/api/waf_system_config.go b/api/waf_system_config.go index 68cec27..1734d7c 100644 --- a/api/waf_system_config.go +++ b/api/waf_system_config.go @@ -94,3 +94,13 @@ func (w *WafSystemConfigApi) ModifyApi(c *gin.Context) { response.FailWithMessage("解析失败", c) } } +func (w *WafSystemConfigApi) GetDetailByItemApi(c *gin.Context) { + var req request.WafSystemConfigDetailByItemReq + err := c.ShouldBind(&req) + if err == nil { + bean := wafSystemConfigService.GetDetailByItemApi(req) + response.OkWithDetailed(bean, "获取成功", c) + } else { + response.FailWithMessage("解析失败", c) + } +} diff --git a/model/request/waf_system_config_req.go b/model/request/waf_system_config_req.go index 5276c67..29bc13a 100644 --- a/model/request/waf_system_config_req.go +++ b/model/request/waf_system_config_req.go @@ -30,3 +30,6 @@ type WafSystemConfigSearchReq struct { Remarks string `json:"remarks" form:"remarks"` request.PageInfo } +type WafSystemConfigDetailByItemReq struct { + Item string `json:"item" form:"item"` //item +} diff --git a/router/waf_system_config.go b/router/waf_system_config.go index 0604659..51630c2 100644 --- a/router/waf_system_config.go +++ b/router/waf_system_config.go @@ -13,6 +13,7 @@ func (receiver *SystemConfigRouter) InitSystemConfigRouter(group *gin.RouterGrou router := group.Group("") router.POST("/samwaf/systemconfig/list", api.GetListApi) router.GET("/samwaf/systemconfig/detail", api.GetDetailApi) + router.GET("/samwaf/systemconfig/getdetailByItem", api.GetDetailByItemApi) router.POST("/samwaf/systemconfig/add", api.AddApi) router.GET("/samwaf/systemconfig/del", api.DelApi) router.POST("/samwaf/systemconfig/edit", api.ModifyApi) diff --git a/service/waf_service/waf_system_config.go b/service/waf_service/waf_system_config.go index b16db69..74d90a7 100644 --- a/service/waf_service/waf_system_config.go +++ b/service/waf_service/waf_system_config.go @@ -63,6 +63,11 @@ func (receiver *WafSystemConfigService) GetDetailApi(req request.WafSystemConfig global.GWAF_LOCAL_DB.Where("id=?", req.Id).Find(&bean) return bean } +func (receiver *WafSystemConfigService) GetDetailByItemApi(req request.WafSystemConfigDetailByItemReq) model.SystemConfig { + var bean model.SystemConfig + global.GWAF_LOCAL_DB.Where("Item=?", req.Item).Find(&bean) + return bean +} func (receiver *WafSystemConfigService) GetDetailByIdApi(id string) model.SystemConfig { var bean model.SystemConfig global.GWAF_LOCAL_DB.Where("id=?", id).Find(&bean)