增加按name查询发布地图接口;增加门控箱ecs内容

This commit is contained in:
joylink_zhangsai 2023-10-17 10:26:31 +08:00
parent dfe084bbaa
commit 3c5d82b773
4 changed files with 34 additions and 2 deletions

View File

@ -22,6 +22,7 @@ func InitPublishedGiRouter(api *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddl
authed.POST("/publish", publishFromDraft)
authed.DELETE("/:id", deletePublishedGiById)
authed.POST("/saveAsDrafting/:id", saveAsDraftingFromPublish)
authed.GET("/:name", getPublishedGiByName)
}
// 分页查询发布的图形数据
@ -193,3 +194,30 @@ func saveAsDraftingFromPublish(c *gin.Context) {
}
service.SaveAsDraftingFromPublish(int32(id), user.(*model.User), req.Name)
}
// 根据Code查询发布地图数据
//
// @Summary 根据Code查询发布地图数据
//
// @Security JwtAuth
//
// @Description 可以通过名称过滤
// @Tags 发布的图形数据Api
// @Accept json
// @Produce json
// @Param publishedGiListReqDto query publishedGi.PublishedGiListReqDto true "查询参数"
// @Success 200 {object} []model.PublishedGi
// @Failure 401 {object} dto.ErrorDto
// @Failure 500 {object} dto.ErrorDto
// @Router /api/v1/publishedGi/list [get]
func getPublishedGiByName(c *gin.Context) {
user, _ := c.Get(middleware.IdentityKey)
slog.Debug("name查询发布的图形数据", user)
name := c.Param("name")
slog.Debug("name查询发布的图形数据", name)
entity, err := service.GetPublishedGiByCode(name)
if err != nil {
panic(dto.ErrorDto{Code: dto.DataOperationError, Message: err.Error()})
}
c.JSON(http.StatusOK, entity)
}

@ -1 +1 @@
Subproject commit 3f409d717bab334f3d39a5af043c5f00881eaddd
Subproject commit 7a105e7c0ee7ddf8e9803d31343fafac697a4872

@ -1 +1 @@
Subproject commit 93725ce93431b07d1d56863eaa8a3f5f77d3a39f
Subproject commit 67c416e96d4d7ba8c775ca10fbfbb24f2b1dab60

View File

@ -145,3 +145,7 @@ func QueryProjectPublishedGi(id int32) []*model.PublishedGi {
publishedGis, _ := dp.Select(dp.ID, dp.Name, dp.Category, dp.Type).Where(dp.ID.In(mids...), dp.Status.Eq(1)).Order(dp.Name).Find()
return publishedGis
}
func GetPublishedGiByCode(name string) (*model.PublishedGi, error) {
return dbquery.PublishedGi.Where(dbquery.PublishedGi.Name.Eq(name)).Debug().First()
}