feat: 喵猪
This commit is contained in:
parent
992d81cb58
commit
02b6b411c7
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue