feat: 开发中...
This commit is contained in:
@@ -6,6 +6,7 @@ import cn.hamster3.application.blog.vo.ResponseVO;
|
||||
import cn.hamster3.application.blog.vo.attach.AttachInfoResponseVO;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.core.io.InputStreamResource;
|
||||
@@ -24,9 +25,9 @@ public class AttachController {
|
||||
@Resource
|
||||
private IAttachService attachService;
|
||||
|
||||
@PostMapping("/")
|
||||
@PostMapping(value = "/", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
@Operation(summary = "新建附件")
|
||||
public ResponseVO<Long> createAttach(@RequestParam MultipartFile file) throws IOException {
|
||||
public ResponseVO<Long> createAttach(@Schema(type = "_file") @RequestPart("file") MultipartFile file) throws IOException {
|
||||
return attachService.createAttach(file);
|
||||
}
|
||||
|
||||
@@ -51,9 +52,9 @@ public class AttachController {
|
||||
return attachService.getAttachList(PageRequest.of(page, size));
|
||||
}
|
||||
|
||||
@PutMapping("/{attachID}/")
|
||||
@PutMapping(value = "/{attachID}/", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
@Operation(summary = "更新附件")
|
||||
public ResponseVO<Void> updateAttach(@PathVariable Long attachID, @RequestParam MultipartFile file) throws IOException {
|
||||
public ResponseVO<Void> updateAttach(@PathVariable Long attachID, @RequestPart("file") MultipartFile file) throws IOException {
|
||||
return attachService.updateAttach(attachID, file);
|
||||
}
|
||||
|
||||
|
@@ -15,12 +15,12 @@ public interface AttachRepository extends JpaRepository<AttachEntity, Long>, Jpa
|
||||
boolean existsByIdAndCreator_Id(Long id, UUID id1);
|
||||
|
||||
@Query("select a from AttachEntity a where a.id = ?1")
|
||||
AttachEntity findByIdWithContent(Long id);
|
||||
AttachEntity findByIdWithData(Long id);
|
||||
|
||||
@Transactional
|
||||
@Modifying
|
||||
@Query("update AttachEntity a set a.data = ?1, a.contentType = ?2 where a.id = ?3")
|
||||
void updateDataAndContentTypeById(byte[] data, String contentType, Long id);
|
||||
@Query("update AttachEntity a set a.filename = ?1, a.contentType = ?2, a.data = ?3 where a.id = ?4")
|
||||
void updateFilenameAndContentTypeAndDataById(String filename, String contentType, byte[] data, Long id);
|
||||
|
||||
@Query("select a from AttachEntity a where a.creator.id = ?1 order by a.createTime DESC")
|
||||
Page<AttachEntity> findByCreator_IdOrderByCreateTimeDesc(UUID id, Pageable pageable);
|
||||
|
@@ -77,7 +77,7 @@ public class AttachService implements IAttachService {
|
||||
if (localCacheFile.exists()) {
|
||||
entity = attachRepo.findById(attachID).orElse(null);
|
||||
} else {
|
||||
entity = attachRepo.findByIdWithContent(attachID);
|
||||
entity = attachRepo.findByIdWithData(attachID);
|
||||
}
|
||||
if (entity == null) {
|
||||
return ResponseEntity.notFound().build();
|
||||
@@ -113,7 +113,12 @@ public class AttachService implements IAttachService {
|
||||
if (!attachRepo.existsById(attachID)) {
|
||||
return ResponseVO.notFound();
|
||||
}
|
||||
attachRepo.updateDataAndContentTypeById(file.getBytes(), file.getContentType(), attachID);
|
||||
attachRepo.updateFilenameAndContentTypeAndDataById(
|
||||
file.getOriginalFilename(),
|
||||
file.getContentType(),
|
||||
file.getBytes(),
|
||||
attachID
|
||||
);
|
||||
|
||||
File localCacheFile = new File(ATTACH_FOLDER, String.valueOf(attachID));
|
||||
Files.copy(file.getInputStream(), localCacheFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||
|
@@ -1,45 +1,161 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import { onMounted, ref } from "vue";
|
||||
import { ElMessage } from "element-plus";
|
||||
import type { UploadRawFile, UploadRequestOptions } from "element-plus";
|
||||
|
||||
const form = ref({
|
||||
file: undefined,
|
||||
import { api } from "@/api";
|
||||
import type { AttachInfoResponseVO } from "@/swagger";
|
||||
|
||||
const pageIndex = ref<number>(1);
|
||||
let pageSize = 6;
|
||||
let pageCount = 100;
|
||||
const attaches = ref<Array<AttachInfoResponseVO>>();
|
||||
|
||||
let updateAttachID = 0;
|
||||
|
||||
onMounted(() => {
|
||||
loadPage(1);
|
||||
});
|
||||
const uploadDialog = ref<boolean>(false);
|
||||
|
||||
function upload() {}
|
||||
function loadPage(newPage: number) {
|
||||
api.AttachController.getAttachList(newPage - 1, pageSize).then((resp) => {
|
||||
const vo = resp.data;
|
||||
const page = vo.content;
|
||||
for (let item of page?.elements ?? []) {
|
||||
item.createTime = new Date(item?.createTime ?? 0);
|
||||
item.updateTime = new Date(item?.updateTime ?? 0);
|
||||
}
|
||||
attaches.value = page?.elements;
|
||||
pageCount = page?.totalPage ?? 1;
|
||||
pageIndex.value = newPage;
|
||||
});
|
||||
}
|
||||
|
||||
function handleClose() {}
|
||||
function uploadAttach(options: UploadRequestOptions) {
|
||||
api.AttachController.createAttachForm(options.file).then((resp) => {
|
||||
const vo = resp.data;
|
||||
if (vo.code === 200) {
|
||||
ElMessage({
|
||||
type: "success",
|
||||
message: "附件上传成功!",
|
||||
});
|
||||
loadPage(pageIndex.value);
|
||||
return;
|
||||
} else {
|
||||
ElMessage({
|
||||
type: "error",
|
||||
message: "附件上传失败:" + vo.msg,
|
||||
});
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
async function updateAttach(options: UploadRequestOptions) {
|
||||
const resp = await api.AttachController.updateAttachForm(
|
||||
updateAttachID,
|
||||
options.file
|
||||
);
|
||||
const vo = resp.data;
|
||||
if (vo.code === 200) {
|
||||
ElMessage({
|
||||
type: "success",
|
||||
message: "附件修改成功!",
|
||||
});
|
||||
loadPage(pageIndex.value);
|
||||
return;
|
||||
} else {
|
||||
ElMessage({
|
||||
type: "error",
|
||||
message: "附件修改失败:" + vo.msg,
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function deleteAttach(id: number) {
|
||||
api.AttachController.deleteAttach(id).then((resp) => {
|
||||
const vo = resp.data;
|
||||
if (vo.code === 200) {
|
||||
ElMessage({
|
||||
type: "success",
|
||||
message: "附件删除成功!",
|
||||
});
|
||||
loadPage(pageIndex.value);
|
||||
return;
|
||||
} else {
|
||||
ElMessage({
|
||||
type: "error",
|
||||
message: "附件删除失败:" + vo.msg,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="uploadDialog"
|
||||
title="Tips"
|
||||
width="30%"
|
||||
:before-close="handleClose"
|
||||
>
|
||||
<el-form :model="form">
|
||||
<el-form-item label="Promotion name" label-width="120px">
|
||||
<el-input v-model="form.file" type="file" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="uploadDialog = false"> 取消 </el-button>
|
||||
<el-button type="primary" @click="uploadDialog = false">
|
||||
确认
|
||||
</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<div class="attach-contailer">
|
||||
<div style="display: flex">
|
||||
<div style="flex-grow: 1"></div>
|
||||
<el-button type="primary" @click="uploadDialog = true">
|
||||
上传新附件
|
||||
</el-button>
|
||||
<div style="flex-grow: 1"></div>
|
||||
<div class="attach-list">
|
||||
<el-card v-for="attach in attaches" class="attach-card">
|
||||
<template #header>
|
||||
<p>附件编号:{{ attach.id }}</p>
|
||||
<p>文件名:{{ attach.filename }}</p>
|
||||
<p>文件类型:{{ attach.contentType }}</p>
|
||||
<p>
|
||||
文件路径:<a
|
||||
:href="'/api/v1/attach/' + attach.id + '/content'"
|
||||
target="_blank"
|
||||
>/api/v1/attach/{{ attach.id }}/content</a
|
||||
>
|
||||
</p>
|
||||
</template>
|
||||
<p>
|
||||
由 {{ attach.creator.nickname }} 首次创建于
|
||||
{{ attach.createTime.toTimeString() }}
|
||||
</p>
|
||||
<p>
|
||||
由 {{ attach.creator.nickname }} 最后修改于
|
||||
{{ attach.updateTime.toTimeString() }}
|
||||
</p>
|
||||
<div style="display: flex" class="attach-card-buttons">
|
||||
<div style="flex-grow: 1"></div>
|
||||
<el-upload
|
||||
:http-request="updateAttach"
|
||||
:show-file-list="false"
|
||||
:before-upload="
|
||||
() => {
|
||||
updateAttachID = attach.id;
|
||||
return true;
|
||||
}
|
||||
"
|
||||
>
|
||||
<el-button type="success">编辑</el-button>
|
||||
</el-upload>
|
||||
<el-button type="danger" @click="deleteAttach(attach.id)">
|
||||
删除
|
||||
</el-button>
|
||||
<div style="flex-grow: 1"></div>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
<p style="text-align: center; margin-top: 12px; margin-bottom: 12px">
|
||||
<el-upload :show-file-list="false" :http-request="uploadAttach">
|
||||
<el-button type="primary"> 上传新附件 </el-button>
|
||||
</el-upload>
|
||||
</p>
|
||||
</div>
|
||||
<div style="display: flex">
|
||||
<div style="flex-grow: 1"></div>
|
||||
<el-pagination
|
||||
class="pagination"
|
||||
background
|
||||
layout="prev, pager, next"
|
||||
:hide-on-single-page="false"
|
||||
:current-page="pageIndex"
|
||||
:page-count="pageCount"
|
||||
@update:current-page="loadPage"
|
||||
/>
|
||||
<div style="flex-grow: 1"></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -48,4 +164,22 @@ function handleClose() {}
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.attach-list {
|
||||
display: flex;
|
||||
margin-left: 5px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.attach-card {
|
||||
margin-left: 12px;
|
||||
}
|
||||
|
||||
attach-card-buttons {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.attach-card-buttons > * {
|
||||
margin-left: 15px;
|
||||
}
|
||||
</style>
|
||||
|
@@ -7,8 +7,8 @@ import { api } from "@/api";
|
||||
import router from "@/router";
|
||||
import { ElMessage } from "element-plus";
|
||||
|
||||
let pageIndex = ref(1);
|
||||
let pageSize = 2;
|
||||
const pageIndex = ref<number>(1);
|
||||
let pageSize = 3;
|
||||
let pageCount = 100;
|
||||
const blogs = ref<Array<BlogInfoResponseVO>>();
|
||||
|
||||
@@ -21,7 +21,7 @@ function editBlog(blogID: number) {
|
||||
}
|
||||
|
||||
function deleteBlog(blogID: number) {
|
||||
api.BlogController.removeBlog(blogID).then((resp) => {
|
||||
api.BlogController.deleteBlog(blogID).then((resp) => {
|
||||
const vo = resp.data;
|
||||
if (vo.code === 200) {
|
||||
ElMessage({
|
||||
@@ -63,7 +63,7 @@ function loadPage(newPage: number) {
|
||||
item.updateTime = new Date(item?.updateTime ?? 0);
|
||||
}
|
||||
blogs.value = page?.elements;
|
||||
pageCount = page?.totalPage;
|
||||
pageCount = page?.totalPage ?? 1;
|
||||
pageIndex.value = newPage;
|
||||
});
|
||||
}
|
||||
|
@@ -16,12 +16,10 @@ import { Configuration } from '../configuration';
|
||||
// Some imports not used depending on template conditions
|
||||
// @ts-ignore
|
||||
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base';
|
||||
import { AttachAttachIDBody } from '../models';
|
||||
import { ResponseVOAttachInfoResponseVO } from '../models';
|
||||
import { ResponseVOLong } from '../models';
|
||||
import { ResponseVOPageableVOAttachInfoResponseVO } from '../models';
|
||||
import { ResponseVOVoid } from '../models';
|
||||
import { V1AttachBody } from '../models';
|
||||
/**
|
||||
* AttachControllerApi - axios parameter creator
|
||||
* @export
|
||||
@@ -31,11 +29,11 @@ export const AttachControllerApiAxiosParamCreator = function (configuration?: Co
|
||||
/**
|
||||
*
|
||||
* @summary 新建附件
|
||||
* @param {V1AttachBody} [body]
|
||||
* @param {any} [file]
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
createAttach: async (body?: V1AttachBody, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||
createAttachForm: async (file?: any, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||
const localVarPath = `/api/v1/attach/`;
|
||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
|
||||
@@ -46,9 +44,14 @@ export const AttachControllerApiAxiosParamCreator = function (configuration?: Co
|
||||
const localVarRequestOptions :AxiosRequestConfig = { method: 'POST', ...baseOptions, ...options};
|
||||
const localVarHeaderParameter = {} as any;
|
||||
const localVarQueryParameter = {} as any;
|
||||
const localVarFormParams = new FormData();
|
||||
|
||||
localVarHeaderParameter['Content-Type'] = 'application/json';
|
||||
|
||||
if (file !== undefined) {
|
||||
localVarFormParams.append('file', file as any);
|
||||
}
|
||||
|
||||
localVarHeaderParameter['Content-Type'] = 'multipart/form-data';
|
||||
const query = new URLSearchParams(localVarUrlObj.search);
|
||||
for (const key in localVarQueryParameter) {
|
||||
query.set(key, localVarQueryParameter[key]);
|
||||
@@ -59,8 +62,7 @@ export const AttachControllerApiAxiosParamCreator = function (configuration?: Co
|
||||
localVarUrlObj.search = (new URLSearchParams(query)).toString();
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
|
||||
localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || "");
|
||||
localVarRequestOptions.data = localVarFormParams;
|
||||
|
||||
return {
|
||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
||||
@@ -243,14 +245,14 @@ export const AttachControllerApiAxiosParamCreator = function (configuration?: Co
|
||||
*
|
||||
* @summary 更新附件
|
||||
* @param {number} attachID
|
||||
* @param {AttachAttachIDBody} [body]
|
||||
* @param {Blob} [file]
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
updateAttach: async (attachID: number, body?: AttachAttachIDBody, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||
updateAttachForm: async (attachID: number, file?: Blob, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||
// verify required parameter 'attachID' is not null or undefined
|
||||
if (attachID === null || attachID === undefined) {
|
||||
throw new RequiredError('attachID','Required parameter attachID was null or undefined when calling updateAttach.');
|
||||
throw new RequiredError('attachID','Required parameter attachID was null or undefined when calling updateAttachForm.');
|
||||
}
|
||||
const localVarPath = `/api/v1/attach/{attachID}/`
|
||||
.replace(`{${"attachID"}}`, encodeURIComponent(String(attachID)));
|
||||
@@ -263,9 +265,14 @@ export const AttachControllerApiAxiosParamCreator = function (configuration?: Co
|
||||
const localVarRequestOptions :AxiosRequestConfig = { method: 'PUT', ...baseOptions, ...options};
|
||||
const localVarHeaderParameter = {} as any;
|
||||
const localVarQueryParameter = {} as any;
|
||||
const localVarFormParams = new FormData();
|
||||
|
||||
localVarHeaderParameter['Content-Type'] = 'application/json';
|
||||
|
||||
if (file !== undefined) {
|
||||
localVarFormParams.append('file', file );
|
||||
}
|
||||
|
||||
localVarHeaderParameter['Content-Type'] = 'multipart/form-data';
|
||||
const query = new URLSearchParams(localVarUrlObj.search);
|
||||
for (const key in localVarQueryParameter) {
|
||||
query.set(key, localVarQueryParameter[key]);
|
||||
@@ -276,8 +283,7 @@ export const AttachControllerApiAxiosParamCreator = function (configuration?: Co
|
||||
localVarUrlObj.search = (new URLSearchParams(query)).toString();
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
|
||||
localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || "");
|
||||
localVarRequestOptions.data = localVarFormParams;
|
||||
|
||||
return {
|
||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
||||
@@ -296,12 +302,12 @@ export const AttachControllerApiFp = function(configuration?: Configuration) {
|
||||
/**
|
||||
*
|
||||
* @summary 新建附件
|
||||
* @param {V1AttachBody} [body]
|
||||
* @param {any} [file]
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async createAttach(body?: V1AttachBody, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<ResponseVOLong>>> {
|
||||
const localVarAxiosArgs = await AttachControllerApiAxiosParamCreator(configuration).createAttach(body, options);
|
||||
async createAttachForm(file?: any, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<ResponseVOLong>>> {
|
||||
const localVarAxiosArgs = await AttachControllerApiAxiosParamCreator(configuration).createAttachForm(file, options);
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
@@ -368,12 +374,12 @@ export const AttachControllerApiFp = function(configuration?: Configuration) {
|
||||
*
|
||||
* @summary 更新附件
|
||||
* @param {number} attachID
|
||||
* @param {AttachAttachIDBody} [body]
|
||||
* @param {Blob} [file]
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async updateAttach(attachID: number, body?: AttachAttachIDBody, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<ResponseVOVoid>>> {
|
||||
const localVarAxiosArgs = await AttachControllerApiAxiosParamCreator(configuration).updateAttach(attachID, body, options);
|
||||
async updateAttachForm(attachID: number, file?: Blob, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<ResponseVOVoid>>> {
|
||||
const localVarAxiosArgs = await AttachControllerApiAxiosParamCreator(configuration).updateAttachForm(attachID, file, options);
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
@@ -391,12 +397,12 @@ export const AttachControllerApiFactory = function (configuration?: Configuratio
|
||||
/**
|
||||
*
|
||||
* @summary 新建附件
|
||||
* @param {V1AttachBody} [body]
|
||||
* @param {any} [file]
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async createAttach(body?: V1AttachBody, options?: AxiosRequestConfig): Promise<AxiosResponse<ResponseVOLong>> {
|
||||
return AttachControllerApiFp(configuration).createAttach(body, options).then((request) => request(axios, basePath));
|
||||
async createAttachForm(file?: any, options?: AxiosRequestConfig): Promise<AxiosResponse<ResponseVOLong>> {
|
||||
return AttachControllerApiFp(configuration).createAttachForm(file, options).then((request) => request(axios, basePath));
|
||||
},
|
||||
/**
|
||||
*
|
||||
@@ -443,12 +449,12 @@ export const AttachControllerApiFactory = function (configuration?: Configuratio
|
||||
*
|
||||
* @summary 更新附件
|
||||
* @param {number} attachID
|
||||
* @param {AttachAttachIDBody} [body]
|
||||
* @param {Blob} [file]
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async updateAttach(attachID: number, body?: AttachAttachIDBody, options?: AxiosRequestConfig): Promise<AxiosResponse<ResponseVOVoid>> {
|
||||
return AttachControllerApiFp(configuration).updateAttach(attachID, body, options).then((request) => request(axios, basePath));
|
||||
async updateAttachForm(attachID: number, file?: Blob, options?: AxiosRequestConfig): Promise<AxiosResponse<ResponseVOVoid>> {
|
||||
return AttachControllerApiFp(configuration).updateAttachForm(attachID, file, options).then((request) => request(axios, basePath));
|
||||
},
|
||||
};
|
||||
};
|
||||
@@ -463,13 +469,13 @@ export class AttachControllerApi extends BaseAPI {
|
||||
/**
|
||||
*
|
||||
* @summary 新建附件
|
||||
* @param {V1AttachBody} [body]
|
||||
* @param {any} [file]
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof AttachControllerApi
|
||||
*/
|
||||
public async createAttach(body?: V1AttachBody, options?: AxiosRequestConfig) : Promise<AxiosResponse<ResponseVOLong>> {
|
||||
return AttachControllerApiFp(this.configuration).createAttach(body, options).then((request) => request(this.axios, this.basePath));
|
||||
public async createAttachForm(file?: any, options?: AxiosRequestConfig) : Promise<AxiosResponse<ResponseVOLong>> {
|
||||
return AttachControllerApiFp(this.configuration).createAttachForm(file, options).then((request) => request(this.axios, this.basePath));
|
||||
}
|
||||
/**
|
||||
*
|
||||
@@ -520,12 +526,12 @@ export class AttachControllerApi extends BaseAPI {
|
||||
*
|
||||
* @summary 更新附件
|
||||
* @param {number} attachID
|
||||
* @param {AttachAttachIDBody} [body]
|
||||
* @param {Blob} [file]
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof AttachControllerApi
|
||||
*/
|
||||
public async updateAttach(attachID: number, body?: AttachAttachIDBody, options?: AxiosRequestConfig) : Promise<AxiosResponse<ResponseVOVoid>> {
|
||||
return AttachControllerApiFp(this.configuration).updateAttach(attachID, body, options).then((request) => request(this.axios, this.basePath));
|
||||
public async updateAttachForm(attachID: number, file?: Blob, options?: AxiosRequestConfig) : Promise<AxiosResponse<ResponseVOVoid>> {
|
||||
return AttachControllerApiFp(this.configuration).updateAttachForm(attachID, file, options).then((request) => request(this.axios, this.basePath));
|
||||
}
|
||||
}
|
||||
|
@@ -70,6 +70,46 @@ export const BlogControllerApiAxiosParamCreator = function (configuration?: Conf
|
||||
options: localVarRequestOptions,
|
||||
};
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary 删除博文
|
||||
* @param {number} blogID
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
deleteBlog: async (blogID: number, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||
// verify required parameter 'blogID' is not null or undefined
|
||||
if (blogID === null || blogID === undefined) {
|
||||
throw new RequiredError('blogID','Required parameter blogID was null or undefined when calling deleteBlog.');
|
||||
}
|
||||
const localVarPath = `/api/v1/blog/{blogID}/`
|
||||
.replace(`{${"blogID"}}`, encodeURIComponent(String(blogID)));
|
||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
|
||||
let baseOptions;
|
||||
if (configuration) {
|
||||
baseOptions = configuration.baseOptions;
|
||||
}
|
||||
const localVarRequestOptions :AxiosRequestConfig = { method: 'DELETE', ...baseOptions, ...options};
|
||||
const localVarHeaderParameter = {} as any;
|
||||
const localVarQueryParameter = {} as any;
|
||||
|
||||
const query = new URLSearchParams(localVarUrlObj.search);
|
||||
for (const key in localVarQueryParameter) {
|
||||
query.set(key, localVarQueryParameter[key]);
|
||||
}
|
||||
for (const key in options.params) {
|
||||
query.set(key, options.params[key]);
|
||||
}
|
||||
localVarUrlObj.search = (new URLSearchParams(query)).toString();
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
|
||||
return {
|
||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
||||
options: localVarRequestOptions,
|
||||
};
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary 获取博文信息
|
||||
@@ -162,46 +202,6 @@ export const BlogControllerApiAxiosParamCreator = function (configuration?: Conf
|
||||
options: localVarRequestOptions,
|
||||
};
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary 删除博文
|
||||
* @param {number} blogID
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
removeBlog: async (blogID: number, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||
// verify required parameter 'blogID' is not null or undefined
|
||||
if (blogID === null || blogID === undefined) {
|
||||
throw new RequiredError('blogID','Required parameter blogID was null or undefined when calling removeBlog.');
|
||||
}
|
||||
const localVarPath = `/api/v1/blog/{blogID}/`
|
||||
.replace(`{${"blogID"}}`, encodeURIComponent(String(blogID)));
|
||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
|
||||
let baseOptions;
|
||||
if (configuration) {
|
||||
baseOptions = configuration.baseOptions;
|
||||
}
|
||||
const localVarRequestOptions :AxiosRequestConfig = { method: 'DELETE', ...baseOptions, ...options};
|
||||
const localVarHeaderParameter = {} as any;
|
||||
const localVarQueryParameter = {} as any;
|
||||
|
||||
const query = new URLSearchParams(localVarUrlObj.search);
|
||||
for (const key in localVarQueryParameter) {
|
||||
query.set(key, localVarQueryParameter[key]);
|
||||
}
|
||||
for (const key in options.params) {
|
||||
query.set(key, options.params[key]);
|
||||
}
|
||||
localVarUrlObj.search = (new URLSearchParams(query)).toString();
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
|
||||
return {
|
||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
||||
options: localVarRequestOptions,
|
||||
};
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary 更新博文
|
||||
@@ -274,6 +274,20 @@ export const BlogControllerApiFp = function(configuration?: Configuration) {
|
||||
return axios.request(axiosRequestArgs);
|
||||
};
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary 删除博文
|
||||
* @param {number} blogID
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async deleteBlog(blogID: number, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<ResponseVOVoid>>> {
|
||||
const localVarAxiosArgs = await BlogControllerApiAxiosParamCreator(configuration).deleteBlog(blogID, options);
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
};
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary 获取博文信息
|
||||
@@ -303,20 +317,6 @@ export const BlogControllerApiFp = function(configuration?: Configuration) {
|
||||
return axios.request(axiosRequestArgs);
|
||||
};
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary 删除博文
|
||||
* @param {number} blogID
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async removeBlog(blogID: number, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<ResponseVOVoid>>> {
|
||||
const localVarAxiosArgs = await BlogControllerApiAxiosParamCreator(configuration).removeBlog(blogID, options);
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
};
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary 更新博文
|
||||
@@ -351,6 +351,16 @@ export const BlogControllerApiFactory = function (configuration?: Configuration,
|
||||
async createBlog(body: BlogUpdateRequireVO, options?: AxiosRequestConfig): Promise<AxiosResponse<ResponseVOLong>> {
|
||||
return BlogControllerApiFp(configuration).createBlog(body, options).then((request) => request(axios, basePath));
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary 删除博文
|
||||
* @param {number} blogID
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async deleteBlog(blogID: number, options?: AxiosRequestConfig): Promise<AxiosResponse<ResponseVOVoid>> {
|
||||
return BlogControllerApiFp(configuration).deleteBlog(blogID, options).then((request) => request(axios, basePath));
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary 获取博文信息
|
||||
@@ -372,16 +382,6 @@ export const BlogControllerApiFactory = function (configuration?: Configuration,
|
||||
async getBlogInfoList(page: number, size: number, options?: AxiosRequestConfig): Promise<AxiosResponse<ResponseVOPageableVOBlogInfoResponseVO>> {
|
||||
return BlogControllerApiFp(configuration).getBlogInfoList(page, size, options).then((request) => request(axios, basePath));
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary 删除博文
|
||||
* @param {number} blogID
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async removeBlog(blogID: number, options?: AxiosRequestConfig): Promise<AxiosResponse<ResponseVOVoid>> {
|
||||
return BlogControllerApiFp(configuration).removeBlog(blogID, options).then((request) => request(axios, basePath));
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary 更新博文
|
||||
@@ -414,6 +414,17 @@ export class BlogControllerApi extends BaseAPI {
|
||||
public async createBlog(body: BlogUpdateRequireVO, options?: AxiosRequestConfig) : Promise<AxiosResponse<ResponseVOLong>> {
|
||||
return BlogControllerApiFp(this.configuration).createBlog(body, options).then((request) => request(this.axios, this.basePath));
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @summary 删除博文
|
||||
* @param {number} blogID
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof BlogControllerApi
|
||||
*/
|
||||
public async deleteBlog(blogID: number, options?: AxiosRequestConfig) : Promise<AxiosResponse<ResponseVOVoid>> {
|
||||
return BlogControllerApiFp(this.configuration).deleteBlog(blogID, options).then((request) => request(this.axios, this.basePath));
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @summary 获取博文信息
|
||||
@@ -437,17 +448,6 @@ export class BlogControllerApi extends BaseAPI {
|
||||
public async getBlogInfoList(page: number, size: number, options?: AxiosRequestConfig) : Promise<AxiosResponse<ResponseVOPageableVOBlogInfoResponseVO>> {
|
||||
return BlogControllerApiFp(this.configuration).getBlogInfoList(page, size, options).then((request) => request(this.axios, this.basePath));
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @summary 删除博文
|
||||
* @param {number} blogID
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof BlogControllerApi
|
||||
*/
|
||||
public async removeBlog(blogID: number, options?: AxiosRequestConfig) : Promise<AxiosResponse<ResponseVOVoid>> {
|
||||
return BlogControllerApiFp(this.configuration).removeBlog(blogID, options).then((request) => request(this.axios, this.basePath));
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @summary 更新博文
|
||||
|
@@ -84,7 +84,7 @@ export const UserControllerApiAxiosParamCreator = function (configuration?: Conf
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary 查询当前用户
|
||||
* @summary 查询当前登录用户信息
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
@@ -234,7 +234,7 @@ export const UserControllerApiAxiosParamCreator = function (configuration?: Conf
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary 查询用户
|
||||
* @summary 查询指定用户信息
|
||||
* @param {string} userID 用户ID
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
@@ -433,7 +433,7 @@ export const UserControllerApiFp = function(configuration?: Configuration) {
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary 查询当前用户
|
||||
* @summary 查询当前登录用户信息
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
@@ -478,7 +478,7 @@ export const UserControllerApiFp = function(configuration?: Configuration) {
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary 查询用户
|
||||
* @summary 查询指定用户信息
|
||||
* @param {string} userID 用户ID
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
@@ -555,7 +555,7 @@ export const UserControllerApiFactory = function (configuration?: Configuration,
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary 查询当前用户
|
||||
* @summary 查询当前登录用户信息
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
@@ -588,7 +588,7 @@ export const UserControllerApiFactory = function (configuration?: Configuration,
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary 查询用户
|
||||
* @summary 查询指定用户信息
|
||||
* @param {string} userID 用户ID
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
@@ -651,7 +651,7 @@ export class UserControllerApi extends BaseAPI {
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @summary 查询当前用户
|
||||
* @summary 查询当前登录用户信息
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof UserControllerApi
|
||||
@@ -687,7 +687,7 @@ export class UserControllerApi extends BaseAPI {
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @summary 查询用户
|
||||
* @summary 查询指定用户信息
|
||||
* @param {string} userID 用户ID
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
|
@@ -24,6 +24,18 @@ export interface AttachInfoResponseVO {
|
||||
* @memberof AttachInfoResponseVO
|
||||
*/
|
||||
id: number;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof AttachInfoResponseVO
|
||||
*/
|
||||
filename: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof AttachInfoResponseVO
|
||||
*/
|
||||
contentType: string;
|
||||
/**
|
||||
*
|
||||
* @type {UserInfoResponseVO}
|
||||
|
@@ -34,7 +34,7 @@ export interface BlogUpdateRequireVO {
|
||||
* @type {string}
|
||||
* @memberof BlogUpdateRequireVO
|
||||
*/
|
||||
content: string;
|
||||
content?: string;
|
||||
/**
|
||||
*
|
||||
* @type {boolean}
|
||||
@@ -52,5 +52,5 @@ export interface BlogUpdateRequireVO {
|
||||
* @type {Array<string>}
|
||||
* @memberof BlogUpdateRequireVO
|
||||
*/
|
||||
tags: Array<string>;
|
||||
tags?: Array<string>;
|
||||
}
|
||||
|
@@ -19,8 +19,8 @@
|
||||
export interface V1AttachBody {
|
||||
/**
|
||||
*
|
||||
* @type {Blob}
|
||||
* @type {any}
|
||||
* @memberof V1AttachBody
|
||||
*/
|
||||
file: Blob;
|
||||
file: any;
|
||||
}
|
||||
|
Reference in New Issue
Block a user