From 35d3b4249a767a750eaa8418a73ab8d6f78fa6d3 Mon Sep 17 00:00:00 2001 From: Love-YeLin <1807209079@qq.com> Date: Thu, 18 Jan 2024 15:43:06 +0800 Subject: [PATCH] =?UTF-8?q?feat:cloudmind-content.file=E5=9F=BA=E6=9C=AC?= =?UTF-8?q?=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 3 ++- biz/infrastructure/convertor/convertor.go | 2 +- biz/infrastructure/mapper/file/filter.go | 8 +++++++- biz/infrastructure/util/convertor/convertor.go | 1 + go.mod | 5 ----- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index d9e8f5f..c2a3705 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,8 @@ WORKDIR /build ADD go.mod . ADD go.sum . -RUN go mod download +RUN go mod tidy + COPY . . RUN sh ./build.sh diff --git a/biz/infrastructure/convertor/convertor.go b/biz/infrastructure/convertor/convertor.go index 6a7df50..49737a9 100644 --- a/biz/infrastructure/convertor/convertor.go +++ b/biz/infrastructure/convertor/convertor.go @@ -10,7 +10,7 @@ import ( func UserMapperToUserDetail(in *usermapper.User) *gencontent.UserDetail { return &gencontent.UserDetail{ Name: in.Name, - Sex: int64(in.Sex), + Sex: in.Sex, FullName: in.FullName, IdCard: in.IdCard, CreatedAt: in.CreateAt.UnixMilli(), diff --git a/biz/infrastructure/mapper/file/filter.go b/biz/infrastructure/mapper/file/filter.go index de51427..c608a8d 100644 --- a/biz/infrastructure/mapper/file/filter.go +++ b/biz/infrastructure/mapper/file/filter.go @@ -13,6 +13,7 @@ type FilterOptions struct { OnlyFileId *string OnlyFatherId *string OnlyFileType *int64 + OnlyTag *string IsDel int64 DocumentType int64 } @@ -34,6 +35,7 @@ func (f *MongoFileFilter) toBson() bson.M { f.CheckOnlyFileId() f.CheckOnlyFatherId() f.CheckOnlyFileType() + f.CheckIsDel() f.CheckDocumentType() return f.m } @@ -69,7 +71,11 @@ func (f *MongoFileFilter) CheckIsDel() { func (f *MongoFileFilter) CheckDocumentType() { if f.DocumentType == 2 { - f.m[consts.Tag] = bson.M{"$ne": nil} + if f.OnlyTag != nil { + f.m[consts.Tag] = bson.M{"$elemMatch": bson.M{"$eq": *f.OnlyTag}} + } else { + f.m[consts.Tag] = bson.M{"$ne": nil} + } } } diff --git a/biz/infrastructure/util/convertor/convertor.go b/biz/infrastructure/util/convertor/convertor.go index 1103e76..a3fd911 100644 --- a/biz/infrastructure/util/convertor/convertor.go +++ b/biz/infrastructure/util/convertor/convertor.go @@ -142,6 +142,7 @@ func FileFilterOptionsToFilterOptions(opts *gencontent.FileFilterOptions) (filte OnlyFileId: opts.OnlyFileId, OnlyFatherId: opts.OnlyFatherId, OnlyFileType: opts.OnlyFileType, + OnlyTag: opts.OnlyTag, IsDel: opts.IsDel, DocumentType: opts.DocumentType, } diff --git a/go.mod b/go.mod index 0f6018b..071d861 100644 --- a/go.mod +++ b/go.mod @@ -20,11 +20,6 @@ require ( google.golang.org/grpc v1.60.1 ) -replace ( - github.com/CloudStriver/go-pkg => ../go-pkg - github.com/CloudStriver/service-idl-gen-go => ../service-idl-gen-go -) - require ( github.com/apache/thrift v0.16.0 // indirect github.com/beorn7/perks v1.0.1 // indirect