fix
This commit is contained in:
@@ -31,9 +31,11 @@ func (t *FsTagsModel) GetAllByLevel(ctx context.Context, level int) (resp []FsTa
|
||||
}
|
||||
|
||||
type GetAllTagByParamsReq struct {
|
||||
Ids []int64
|
||||
Status *int64
|
||||
OrderBy string
|
||||
Ids []int64
|
||||
Status *int64
|
||||
OrderBy string
|
||||
LevelPrefixLeftLike string //右模糊
|
||||
WithChild bool //是否包含子层级
|
||||
}
|
||||
|
||||
func (t *FsTagsModel) GetAllTagByParams(ctx context.Context, req GetAllTagByParamsReq) (resp []FsTags, err error) {
|
||||
@@ -44,6 +46,14 @@ func (t *FsTagsModel) GetAllTagByParams(ctx context.Context, req GetAllTagByPara
|
||||
if req.Status != nil {
|
||||
db = db.Where("`status` = ?", *req.Status)
|
||||
}
|
||||
if req.LevelPrefixLeftLike != "" {
|
||||
//查询子集
|
||||
if req.WithChild {
|
||||
db = db.Where("`level_prefix` like ?", req.LevelPrefixLeftLike+`%`)
|
||||
} else {
|
||||
db = db.Where("`level_prefix` = ?", req.LevelPrefixLeftLike+`%`)
|
||||
}
|
||||
}
|
||||
switch req.OrderBy {
|
||||
case "":
|
||||
db = db.Order("`id` DESC")
|
||||
|
||||
Reference in New Issue
Block a user