From 3c5d82b773a371220a1bbf38282636ff9833bc3e Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Tue, 17 Oct 2023 10:26:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=8C=89name=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E5=8F=91=E5=B8=83=E5=9C=B0=E5=9B=BE=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=EF=BC=9B=E5=A2=9E=E5=8A=A0=E9=97=A8=E6=8E=A7=E7=AE=B1ecs?= =?UTF-8?q?=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/publishedGi.go | 28 ++++++++++++++++++++++++++++ bj-rtss-message | 2 +- rtss_simulation | 2 +- service/publishedGi.go | 4 ++++ 4 files changed, 34 insertions(+), 2 deletions(-) diff --git a/api/publishedGi.go b/api/publishedGi.go index 03cc2da..7835812 100644 --- a/api/publishedGi.go +++ b/api/publishedGi.go @@ -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) +} diff --git a/bj-rtss-message b/bj-rtss-message index 3f409d7..7a105e7 160000 --- a/bj-rtss-message +++ b/bj-rtss-message @@ -1 +1 @@ -Subproject commit 3f409d717bab334f3d39a5af043c5f00881eaddd +Subproject commit 7a105e7c0ee7ddf8e9803d31343fafac697a4872 diff --git a/rtss_simulation b/rtss_simulation index 93725ce..67c416e 160000 --- a/rtss_simulation +++ b/rtss_simulation @@ -1 +1 @@ -Subproject commit 93725ce93431b07d1d56863eaa8a3f5f77d3a39f +Subproject commit 67c416e96d4d7ba8c775ca10fbfbb24f2b1dab60 diff --git a/service/publishedGi.go b/service/publishedGi.go index b76b5f8..286702a 100644 --- a/service/publishedGi.go +++ b/service/publishedGi.go @@ -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() +}