feat: 喵猪

This commit is contained in:
wangyu 2021-04-07 11:00:34 +08:00
parent 992d81cb58
commit 02b6b411c7
2 changed files with 6 additions and 2 deletions

View File

@ -149,6 +149,10 @@ public class Result<T> {
return SUCCESS.equals(this.code); return SUCCESS.equals(this.code);
} }
public T data() {
return this.data;
}
public T getData() { public T getData() {
return Frameworks.config.isResultStyle() ? null : data; return Frameworks.config.isResultStyle() ? null : data;
} }

View File

@ -6,7 +6,6 @@ import com.flyfish.framework.file.config.UploadConfiguration;
import com.flyfish.framework.file.domain.Attachment; import com.flyfish.framework.file.domain.Attachment;
import com.flyfish.framework.file.service.AttachmentService; import com.flyfish.framework.file.service.AttachmentService;
import com.flyfish.framework.file.utils.DownloadUtils; import com.flyfish.framework.file.utils.DownloadUtils;
import com.flyfish.framework.service.BaseService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.http.codec.multipart.FilePart; import org.springframework.http.codec.multipart.FilePart;
import org.springframework.http.server.reactive.ServerHttpRequest; import org.springframework.http.server.reactive.ServerHttpRequest;
@ -24,6 +23,7 @@ import java.util.List;
/** /**
* 附件上传相关 * 附件上传相关
*
* @author wangyu * @author wangyu
*/ */
@RestMapping("/attachment") @RestMapping("/attachment")
@ -44,7 +44,7 @@ public class AttachmentUploadController {
public Mono<Result<List<Attachment>>> uploadAttachment(@RequestPart("file") Flux<FilePart> files) { public Mono<Result<List<Attachment>>> uploadAttachment(@RequestPart("file") Flux<FilePart> files) {
return files.flatMap(attachmentService::upload) return files.flatMap(attachmentService::upload)
.reduce(Result.accept(new ArrayList<>()), ((listResult, attachment) -> { .reduce(Result.accept(new ArrayList<>()), ((listResult, attachment) -> {
listResult.getData().add(attachment); listResult.data().add(attachment);
return listResult; return listResult;
})); }));
} }