新增画作预览列表的筛选条件

This commit is contained in:
徐俊杰 2023-03-28 13:38:07 +08:00
parent 75f292ee01
commit bc0f15f77e
4 changed files with 47 additions and 14 deletions

View File

@ -10,6 +10,8 @@ import (
"context"
"errors"
"fmt"
"time"
"github.com/fonchain/fonchain-artistinfo/cmd/model"
"github.com/fonchain/fonchain-artistinfo/pb/artistInfoArtwork"
"github.com/fonchain/fonchain-artistinfo/pb/artwork_query"
@ -17,7 +19,6 @@ import (
"github.com/fonchain/fonchain-artistinfo/pkg/service"
"github.com/fonchain/fonchain-artistinfo/pkg/util/stime"
"gorm.io/gorm"
"time"
)
func CreateArtworkLockRecord(in *model.ArtworkLockRecord) error {
@ -142,8 +143,14 @@ func GetArtworkLockRecords(req *artistInfoArtwork.GetArtworkLockRecordsRequest)
case artistInfoArtwork.ArtworkQueryMode_AllAuditPassArtwork: //所有审核通过的画作
tx = tx.Where("supplement_audit_status = 4").Order("lock_time desc")
}
if req.AuditStatus != 0 {
tx = tx.Where("audit_status = ?", req.AuditStatus)
if req.BaseAuditStatus != 0 {
tx = tx.Where("base_audit_status = ?", req.BaseAuditStatus)
}
if req.SupplementAuditStatus != 0 {
tx = tx.Where("supplement_audit_status = ?", req.SupplementAuditStatus)
}
if len(req.ArtworkUids) > 0 {
tx = tx.Where("artwork_uid in ?", req.ArtworkUids)
}
err = tx.Find(&datas).Error
for _, v := range datas {

View File

@ -364,7 +364,9 @@ type GetArtworkLockRecordsRequest struct {
ArtistUid string `protobuf:"bytes,1,opt,name=artistUid,proto3" json:"artistUid,omitempty"` //画家uid
QueryType ArtworkQueryMode `protobuf:"varint,2,opt,name=queryType,proto3,enum=artistinfo.ArtworkQueryMode" json:"queryType,omitempty"` //查询模式
AuditStatus int64 `protobuf:"varint,3,opt,name=AuditStatus,proto3" json:"AuditStatus,omitempty"` //审批状态 可选
BaseAuditStatus int64 `protobuf:"varint,3,opt,name=baseAuditStatus,proto3" json:"baseAuditStatus,omitempty"` //基本信息审批状态 可选
SupplementAuditStatus int64 `protobuf:"varint,4,opt,name=supplementAuditStatus,proto3" json:"supplementAuditStatus,omitempty"` //基本信息审批状态 可选
ArtworkUids []string `protobuf:"bytes,5,rep,name=artworkUids,proto3" json:"artworkUids,omitempty"` //画作uid列表
}
func (x *GetArtworkLockRecordsRequest) Reset() {
@ -413,13 +415,27 @@ func (x *GetArtworkLockRecordsRequest) GetQueryType() ArtworkQueryMode {
return ArtworkQueryMode_Non
}
func (x *GetArtworkLockRecordsRequest) GetAuditStatus() int64 {
func (x *GetArtworkLockRecordsRequest) GetBaseAuditStatus() int64 {
if x != nil {
return x.AuditStatus
return x.BaseAuditStatus
}
return 0
}
func (x *GetArtworkLockRecordsRequest) GetSupplementAuditStatus() int64 {
if x != nil {
return x.SupplementAuditStatus
}
return 0
}
func (x *GetArtworkLockRecordsRequest) GetArtworkUids() []string {
if x != nil {
return x.ArtworkUids
}
return nil
}
type ArtistLockInfo struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -1595,7 +1611,7 @@ var file_pb_artistinfoArtwork_proto_rawDesc = []byte{
0x74, 0x69, 0x73, 0x74, 0x55, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6c, 0x6f, 0x63, 0x6b, 0x18,
0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x1a, 0x0a, 0x08, 0x6c,
0x6f, 0x63, 0x6b, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c,
0x6f, 0x63, 0x6b, 0x54, 0x69, 0x6d, 0x65, 0x22, 0xa6, 0x01, 0x0a, 0x1c, 0x47, 0x65, 0x74, 0x41,
0x6f, 0x63, 0x6b, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x86, 0x02, 0x0a, 0x1c, 0x47, 0x65, 0x74, 0x41,
0x72, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x4c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64,
0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x09, 0x61, 0x72, 0x74, 0x69,
0x73, 0x74, 0x55, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xba, 0xe9, 0xc0,
@ -1603,9 +1619,15 @@ var file_pb_artistinfoArtwork_proto_rawDesc = []byte{
0x69, 0x64, 0x12, 0x3a, 0x0a, 0x09, 0x71, 0x75, 0x65, 0x72, 0x79, 0x54, 0x79, 0x70, 0x65, 0x18,
0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x61, 0x72, 0x74, 0x69, 0x73, 0x74, 0x69, 0x6e,
0x66, 0x6f, 0x2e, 0x41, 0x72, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4d,
0x6f, 0x64, 0x65, 0x52, 0x09, 0x71, 0x75, 0x65, 0x72, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x20,
0x0a, 0x0b, 0x41, 0x75, 0x64, 0x69, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20,
0x01, 0x28, 0x03, 0x52, 0x0b, 0x41, 0x75, 0x64, 0x69, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73,
0x6f, 0x64, 0x65, 0x52, 0x09, 0x71, 0x75, 0x65, 0x72, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x28,
0x0a, 0x0f, 0x62, 0x61, 0x73, 0x65, 0x41, 0x75, 0x64, 0x69, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75,
0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x62, 0x61, 0x73, 0x65, 0x41, 0x75, 0x64,
0x69, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x34, 0x0a, 0x15, 0x73, 0x75, 0x70, 0x70,
0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x75, 0x64, 0x69, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75,
0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x15, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x65, 0x6d,
0x65, 0x6e, 0x74, 0x41, 0x75, 0x64, 0x69, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x20,
0x0a, 0x0b, 0x61, 0x72, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x55, 0x69, 0x64, 0x73, 0x18, 0x05, 0x20,
0x03, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x72, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x55, 0x69, 0x64, 0x73,
0x22, 0xec, 0x04, 0x0a, 0x0e, 0x41, 0x72, 0x74, 0x69, 0x73, 0x74, 0x4c, 0x6f, 0x63, 0x6b, 0x49,
0x6e, 0x66, 0x6f, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x72, 0x74, 0x69, 0x73, 0x74, 0x55, 0x69, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x72, 0x74, 0x69, 0x73, 0x74, 0x55, 0x69,

View File

@ -587,7 +587,9 @@ func (m *GetArtworkLockRecordsRequest) validate(all bool) error {
// no validation rules for QueryType
// no validation rules for AuditStatus
// no validation rules for BaseAuditStatus
// no validation rules for SupplementAuditStatus
if len(errors) > 0 {
return GetArtworkLockRecordsRequestMultiError(errors)

View File

@ -54,7 +54,9 @@ enum ArtworkQueryMode {
message GetArtworkLockRecordsRequest{
string artistUid =1 [(validate.rules).message.required = true];//uid
ArtworkQueryMode queryType =2 ; //
int64 AuditStatus =3; //
int64 baseAuditStatus =3; //
int64 supplementAuditStatus =4; //
repeated string artworkUids=5; //uid列表
}
message ArtistLockInfo{