feat(config): 支持配置名和内容模糊搜索

- 配置列表接口增加 keyword 参数,按 name 或 contents 模糊匹配
- 全局配置、应用配置和回收站页面增加关键字搜索框
This commit is contained in:
2026-09-26 21:07:59 +08:00
parent bb90f9cf79
commit de87d98876
4 changed files with 30 additions and 5 deletions
+6
View File
@@ -29,6 +29,7 @@ type ConfigListRequest struct {
Env string `form:"env"`
AppId *int `form:"appId"`
Deleted bool `form:"deleted"`
Keyword string `form:"keyword"`
}
func (h *ConfigHandler) List(c *gin.Context) {
@@ -59,6 +60,11 @@ func (h *ConfigHandler) List(c *gin.Context) {
conditions = append(conditions, "env = ?")
args = append(args, req.Env)
}
if req.Keyword != "" {
like := "%" + req.Keyword + "%"
conditions = append(conditions, "(name LIKE ? OR contents LIKE ?)")
args = append(args, like, like)
}
if req.AppId != nil {
if *req.AppId <= 0 {
conditions = append(conditions, "(app_id is null OR app_id = 0)")