Merge pull request #314 from samwafgo/feat_313

feat:add item quick set
This commit is contained in:
samwafgo
2025-05-21 09:15:29 +08:00
committed by GitHub
4 changed files with 19 additions and 0 deletions
+10
View File
@@ -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)
}
}
+3
View File
@@ -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
}
+1
View File
@@ -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)
+5
View File
@@ -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)