ice há 3 anos atrás
pai
commit
b6d90fefd6

+ 11 - 0
server/api/v1/system/sys_dictionary.go

@@ -89,6 +89,17 @@ func (s *DictionaryApi) FindSysDictionary(c *gin.Context) {
 	}
 }
 
+func (s *DictionaryApi) FindSysDictionaryName(c *gin.Context) {
+	var dictionary system.SysDictionary
+	_ = c.ShouldBindQuery(&dictionary)
+	if err, sysDictionary := dictionaryService.GetSysDictionaryDetail(dictionary.Name); err != nil {
+		global.GVA_LOG.Error("查询失败!", zap.Any("err", err))
+		response.FailWithMessage("查询失败", c)
+	} else {
+		response.OkWithDetailed(gin.H{"resysDictionary": sysDictionary}, "查询成功", c)
+	}
+}
+
 // @Tags SysDictionary
 // @Summary 分页获取SysDictionary列表
 // @Security ApiKeyAuth

+ 43 - 7
server/docs/docs.go

@@ -196,7 +196,41 @@ var doc = `{
                 }
             }
         },
-
+		"/sysDictionary/findSysDictionaryName": {
+            "get": {
+				"security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "consumes": [
+                    "application/json"
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "Dict"
+                ],
+                "summary": "获取字典",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "字典名称(城市类型)",
+                        "name": "name",
+                        "in": "query"
+                    },
+                ],
+                "responses": {
+                    "200": {
+                        "description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}",
+                        "schema": {
+                            "type": "string"
+                        }
+                    }
+                }
+            }
+        },
 		"/place/deletePlace": {
             "delete": {
                 "security": [
@@ -259,6 +293,7 @@ var doc = `{
                         "name": "ID",
                         "in": "query"
 					}
+
                 ],
                 "responses": {
                     "200": {
@@ -337,7 +372,13 @@ var doc = `{
                         "description": "每页大小",
                         "name": "pageSize",
                         "in": "query"
-                    }
+                    },
+					{
+						"type": "string",
+                        "description": "城市名称模糊查询",
+                        "name": "name",
+                        "in": "query"
+					}
                 ],
                 "responses": {
                     "200": {
@@ -424,11 +465,6 @@ var doc = `{
         },
 		"/problemInfo/findProblemInfo": {
             "get": {
-                "security": [
-                    {
-                        "ApiKeyAuth": []
-                    }
-                ],
                 "consumes": [
                     "application/json"
                 ],

+ 4 - 2
server/initialize/router.go

@@ -42,8 +42,10 @@ func Routers() *gin.Engine {
 	autocodeRouter := router.RouterGroupApp.Autocode
 	PublicGroup := Router.Group("")
 	{
-		systemRouter.InitBaseRouter(PublicGroup) // 注册基础功能路由 不做鉴权
-		systemRouter.InitInitRouter(PublicGroup) // 自动初始化相关
+		systemRouter.InitBaseRouter(PublicGroup)           // 注册基础功能路由 不做鉴权
+		systemRouter.InitInitRouter(PublicGroup)           // 自动初始化相关
+		autocodeRouter.InitProblemInfoPRouter(PublicGroup) // 问题详情
+		autocodeRouter.InitContentPRouter(PublicGroup)     // 内容详情
 	}
 	PrivateGroup := Router.Group("")
 	PrivateGroup.Use(middleware.JWTAuth()).Use(middleware.CasbinHandler())

+ 8 - 1
server/router/autocode/content.go

@@ -18,7 +18,14 @@ func (s *ContentRouter) InitContentRouter(Router *gin.RouterGroup) {
 		contentRouter.DELETE("deleteContent", contentApi.DeleteContent)           // 删除Content
 		contentRouter.DELETE("deleteContentByIds", contentApi.DeleteContentByIds) // 批量删除Content
 		contentRouter.PUT("updateContent", contentApi.UpdateContent)              // 更新Content
-		contentRouter.GET("findContent", contentApi.FindContent)                  // 根据ID获取Content
 		contentRouter.GET("getContentList", contentApi.GetContentList)            // 获取Content列表
 	}
 }
+
+func (s *ContentRouter) InitContentPRouter(Router *gin.RouterGroup) {
+	contentRouter := Router.Group("content").Use(middleware.OperationRecord())
+	var contentApi = v1.ApiGroupApp.AutoCodeApiGroup.ContentApi
+	{
+		contentRouter.GET("findContent", contentApi.FindContent) // 根据ID获取Content
+	}
+}

+ 8 - 1
server/router/autocode/problem_info.go

@@ -19,7 +19,14 @@ func (s *ProblemInfoRouter) InitProblemInfoRouter(Router *gin.RouterGroup) {
 		problemInfoRouter.DELETE("deleteProblemInfo", problemInfoApi.DeleteProblemInfo)           // 删除ProblemInfo
 		problemInfoRouter.DELETE("deleteProblemInfoByIds", problemInfoApi.DeleteProblemInfoByIds) // 批量删除ProblemInfo
 		problemInfoRouter.PUT("updateProblemInfo", problemInfoApi.UpdateProblemInfo)              // 更新ProblemInfo
-		problemInfoRouter.GET("findProblemInfo", problemInfoApi.FindProblemInfo)                  // 根据ID获取ProblemInfo
 		problemInfoRouter.GET("getProblemInfoList", problemInfoApi.GetProblemInfoList)            // 获取ProblemInfo列表
 	}
 }
+
+func (s *ProblemInfoRouter) InitProblemInfoPRouter(Router *gin.RouterGroup) {
+	problemInfoRouter := Router.Group("problemInfo").Use(middleware.OperationRecord())
+	var problemInfoApi = v1.ApiGroupApp.AutoCodeApiGroup.ProblemInfoApi
+	{
+		problemInfoRouter.GET("findProblemInfo", problemInfoApi.FindProblemInfo) // 根据ID获取ProblemInfo
+	}
+}

+ 6 - 5
server/router/system/sys_dictionary.go

@@ -13,10 +13,11 @@ func (s *DictionaryRouter) InitSysDictionaryRouter(Router *gin.RouterGroup) {
 	sysDictionaryRouter := Router.Group("sysDictionary").Use(middleware.OperationRecord())
 	var sysDictionaryApi = v1.ApiGroupApp.SystemApiGroup.DictionaryApi
 	{
-		sysDictionaryRouter.POST("createSysDictionary", sysDictionaryApi.CreateSysDictionary)   // 新建SysDictionary
-		sysDictionaryRouter.DELETE("deleteSysDictionary", sysDictionaryApi.DeleteSysDictionary) // 删除SysDictionary
-		sysDictionaryRouter.PUT("updateSysDictionary", sysDictionaryApi.UpdateSysDictionary)    // 更新SysDictionary
-		sysDictionaryRouter.GET("findSysDictionary", sysDictionaryApi.FindSysDictionary)        // 根据ID获取SysDictionary
-		sysDictionaryRouter.GET("getSysDictionaryList", sysDictionaryApi.GetSysDictionaryList)  // 获取SysDictionary列表
+		sysDictionaryRouter.POST("createSysDictionary", sysDictionaryApi.CreateSysDictionary)    // 新建SysDictionary
+		sysDictionaryRouter.DELETE("deleteSysDictionary", sysDictionaryApi.DeleteSysDictionary)  // 删除SysDictionary
+		sysDictionaryRouter.PUT("updateSysDictionary", sysDictionaryApi.UpdateSysDictionary)     // 更新SysDictionary
+		sysDictionaryRouter.GET("findSysDictionary", sysDictionaryApi.FindSysDictionary)         // 根据ID获取SysDictionary
+		sysDictionaryRouter.GET("findSysDictionaryName", sysDictionaryApi.FindSysDictionaryName) // 根据name获取SysDictionary
+		sysDictionaryRouter.GET("getSysDictionaryList", sysDictionaryApi.GetSysDictionaryList)   // 获取SysDictionary列表
 	}
 }

+ 3 - 0
server/service/autocode/place.go

@@ -55,6 +55,9 @@ func (placeService *PlaceService) GetPlaceInfoList(info autoCodeReq.PlaceSearch)
 	if info.Type != "" {
 		db.Where("type=?", info.Type)
 	}
+	if info.Name != "" {
+		db.Where("`name` LIKE ?", "%"+info.Name+"%")
+	}
 	var places []autocode.Place
 	// 如果有条件搜索 下方会自动创建搜索语句
 	err = db.Count(&total).Error