增加草稿数据列表查询接口;增加屏蔽门ecs相关内容
This commit is contained in:
parent
47e3b5c6f7
commit
387e304f0a
|
@ -19,6 +19,7 @@ import (
|
|||
func InitDraftingRouter(api *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
|
||||
authed := api.Group("/v1/drafting").Use(authMiddleware.MiddlewareFunc(), middleware.PermissMiddleware)
|
||||
authed.GET("/paging", pageQueryDrafting)
|
||||
authed.GET("/list", listQueryDrafting)
|
||||
authed.POST("", createDrafting)
|
||||
authed.POST("/:id/saveAs", saveAsDrafting)
|
||||
authed.GET("/:id", queryDraftingInfo)
|
||||
|
@ -58,6 +59,37 @@ func pageQueryDrafting(c *gin.Context) {
|
|||
c.JSON(http.StatusOK, page)
|
||||
}
|
||||
|
||||
// 列表查询草稿
|
||||
//
|
||||
// @Summary 列表查询草稿
|
||||
//
|
||||
// @Security JwtAuth
|
||||
//
|
||||
// @Description 可以通过草稿类型过滤,列表查询草稿
|
||||
// @Tags 草稿Api
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param ListDraftingReqDto query dto.ListDraftingReqDto true "草稿查询条件带分页信息"
|
||||
// @Success 200 {object} dto.PageDto
|
||||
// @Failure 401 {object} dto.ErrorDto
|
||||
// @Failure 404 {object} dto.ErrorDto
|
||||
// @Failure 500 {object} dto.ErrorDto
|
||||
// @Router /api/v1/drafting/paging [get]
|
||||
func listQueryDrafting(c *gin.Context) {
|
||||
user, _ := c.Get(middleware.IdentityKey)
|
||||
slog.Debug("列表查询草稿", user)
|
||||
req := dto.ListDraftingReqDto{}
|
||||
if err := c.ShouldBind(&req); err != nil {
|
||||
panic(dto.ErrorDto{Code: dto.ArgumentParseError, Message: err.Error()})
|
||||
}
|
||||
slog.Debug("列表查草稿参数", req)
|
||||
list, err := service.ListDraftingQuery(&req)
|
||||
if err != nil {
|
||||
panic(dto.ErrorDto{Code: dto.DataOperationError, Message: err.Error()})
|
||||
}
|
||||
c.JSON(http.StatusOK, list)
|
||||
}
|
||||
|
||||
// 创建草稿
|
||||
//
|
||||
// @Summary 创建草稿
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit c772733535c2f9b370d2bfaf220cc686344b755e
|
||||
Subproject commit 85290a8ba96ee41ab47a61f44e913f308c8599d7
|
|
@ -7,6 +7,10 @@ type PageDraftingReqDto struct {
|
|||
Name string `json:"name" form:"name"`
|
||||
}
|
||||
|
||||
type ListDraftingReqDto struct {
|
||||
Type int32 `json:"type" form:"type"`
|
||||
}
|
||||
|
||||
type DraftingDto struct {
|
||||
Id int `json:"id" form:"id"`
|
||||
Name string `json:"name" form:"name"`
|
||||
|
|
|
@ -23,6 +23,19 @@ func PageDraftingQuery(query *dto.PageDraftingReqDto) (*dto.PageDto, error) {
|
|||
return &dto.PageDto{Total: int(total), PageQueryDto: query.PageQueryDto, Records: records}, nil
|
||||
}
|
||||
|
||||
func ListDraftingQuery(query *dto.ListDraftingReqDto) ([]*model.Drafting, error) {
|
||||
d := dbquery.Drafting
|
||||
dq := d.Where()
|
||||
if query.Type != 0 {
|
||||
dq = dq.Where(d.Type.Eq(query.Type))
|
||||
}
|
||||
records, err := dq.Debug().Omit(d.Proto).Find()
|
||||
if err != nil {
|
||||
panic(dto.ErrorDto{Code: dto.QueryDBError, Message: err.Error()})
|
||||
}
|
||||
return records, nil
|
||||
}
|
||||
|
||||
// 创建草稿
|
||||
func CreateDrafting(createId int32, dd *dto.DraftingDto) (*model.Drafting, error) {
|
||||
if err := checkDraftingInfo(dd.Name); err != nil {
|
||||
|
|
Loading…
Reference in New Issue