From ae3a2f9c5d69eaebb71064443dd505e0e9eb3561 Mon Sep 17 00:00:00 2001 From: MiniDay <372403923@qq.com> Date: Sat, 8 Apr 2023 15:02:31 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=BC=80=E5=8F=91=E4=B8=AD...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../blog/controller/AttachController.java | 9 +- .../blog/entity/repo/AttachRepository.java | 6 +- .../blog/service/impl/AttachService.java | 9 +- .../manage/AttachManageComponent.vue | 198 +++++++++++++++--- .../components/manage/BlogManageComponent.vue | 8 +- .../src/swagger/apis/attach-controller-api.ts | 68 +++--- .../src/swagger/apis/blog-controller-api.ts | 150 ++++++------- .../src/swagger/apis/user-controller-api.ts | 16 +- .../swagger/models/attach-info-response-vo.ts | 12 ++ .../swagger/models/blog-update-require-vo.ts | 4 +- .../src/swagger/models/v1-attach-body.ts | 4 +- 11 files changed, 321 insertions(+), 163 deletions(-) diff --git a/blog-backend/src/main/java/cn/hamster3/application/blog/controller/AttachController.java b/blog-backend/src/main/java/cn/hamster3/application/blog/controller/AttachController.java index cdd7bc6..d453735 100644 --- a/blog-backend/src/main/java/cn/hamster3/application/blog/controller/AttachController.java +++ b/blog-backend/src/main/java/cn/hamster3/application/blog/controller/AttachController.java @@ -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 createAttach(@RequestParam MultipartFile file) throws IOException { + public ResponseVO 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 updateAttach(@PathVariable Long attachID, @RequestParam MultipartFile file) throws IOException { + public ResponseVO updateAttach(@PathVariable Long attachID, @RequestPart("file") MultipartFile file) throws IOException { return attachService.updateAttach(attachID, file); } diff --git a/blog-backend/src/main/java/cn/hamster3/application/blog/entity/repo/AttachRepository.java b/blog-backend/src/main/java/cn/hamster3/application/blog/entity/repo/AttachRepository.java index c016cf9..9735cf2 100644 --- a/blog-backend/src/main/java/cn/hamster3/application/blog/entity/repo/AttachRepository.java +++ b/blog-backend/src/main/java/cn/hamster3/application/blog/entity/repo/AttachRepository.java @@ -15,12 +15,12 @@ public interface AttachRepository extends JpaRepository, 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 findByCreator_IdOrderByCreateTimeDesc(UUID id, Pageable pageable); diff --git a/blog-backend/src/main/java/cn/hamster3/application/blog/service/impl/AttachService.java b/blog-backend/src/main/java/cn/hamster3/application/blog/service/impl/AttachService.java index c2cb2c2..82242f9 100644 --- a/blog-backend/src/main/java/cn/hamster3/application/blog/service/impl/AttachService.java +++ b/blog-backend/src/main/java/cn/hamster3/application/blog/service/impl/AttachService.java @@ -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); diff --git a/blog-frontend/src/components/manage/AttachManageComponent.vue b/blog-frontend/src/components/manage/AttachManageComponent.vue index 4e3ea0e..41ad8b1 100644 --- a/blog-frontend/src/components/manage/AttachManageComponent.vue +++ b/blog-frontend/src/components/manage/AttachManageComponent.vue @@ -1,45 +1,161 @@ @@ -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; +} diff --git a/blog-frontend/src/components/manage/BlogManageComponent.vue b/blog-frontend/src/components/manage/BlogManageComponent.vue index 06db6b2..d21c469 100644 --- a/blog-frontend/src/components/manage/BlogManageComponent.vue +++ b/blog-frontend/src/components/manage/BlogManageComponent.vue @@ -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(1); +let pageSize = 3; let pageCount = 100; const blogs = ref>(); @@ -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; }); } diff --git a/blog-frontend/src/swagger/apis/attach-controller-api.ts b/blog-frontend/src/swagger/apis/attach-controller-api.ts index 725cf3c..4cee23d 100644 --- a/blog-frontend/src/swagger/apis/attach-controller-api.ts +++ b/blog-frontend/src/swagger/apis/attach-controller-api.ts @@ -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 => { + createAttachForm: async (file?: any, options: AxiosRequestConfig = {}): Promise => { 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 => { + updateAttachForm: async (attachID: number, file?: Blob, options: AxiosRequestConfig = {}): Promise => { // 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>> { - const localVarAxiosArgs = await AttachControllerApiAxiosParamCreator(configuration).createAttach(body, options); + async createAttachForm(file?: any, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { + 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>> { - const localVarAxiosArgs = await AttachControllerApiAxiosParamCreator(configuration).updateAttach(attachID, body, options); + async updateAttachForm(attachID: number, file?: Blob, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { + 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> { - return AttachControllerApiFp(configuration).createAttach(body, options).then((request) => request(axios, basePath)); + async createAttachForm(file?: any, options?: AxiosRequestConfig): Promise> { + 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> { - return AttachControllerApiFp(configuration).updateAttach(attachID, body, options).then((request) => request(axios, basePath)); + async updateAttachForm(attachID: number, file?: Blob, options?: AxiosRequestConfig): Promise> { + 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> { - return AttachControllerApiFp(this.configuration).createAttach(body, options).then((request) => request(this.axios, this.basePath)); + public async createAttachForm(file?: any, options?: AxiosRequestConfig) : Promise> { + 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> { - 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> { + return AttachControllerApiFp(this.configuration).updateAttachForm(attachID, file, options).then((request) => request(this.axios, this.basePath)); } } diff --git a/blog-frontend/src/swagger/apis/blog-controller-api.ts b/blog-frontend/src/swagger/apis/blog-controller-api.ts index bc77966..6eb02fb 100644 --- a/blog-frontend/src/swagger/apis/blog-controller-api.ts +++ b/blog-frontend/src/swagger/apis/blog-controller-api.ts @@ -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 => { + // 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 => { - // 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>> { + 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>> { - 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> { 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> { + 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> { 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> { - 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> { 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> { + 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> { 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> { - return BlogControllerApiFp(this.configuration).removeBlog(blogID, options).then((request) => request(this.axios, this.basePath)); - } /** * * @summary 更新博文 diff --git a/blog-frontend/src/swagger/apis/user-controller-api.ts b/blog-frontend/src/swagger/apis/user-controller-api.ts index ad65943..03e0e7e 100644 --- a/blog-frontend/src/swagger/apis/user-controller-api.ts +++ b/blog-frontend/src/swagger/apis/user-controller-api.ts @@ -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} diff --git a/blog-frontend/src/swagger/models/attach-info-response-vo.ts b/blog-frontend/src/swagger/models/attach-info-response-vo.ts index 300aef4..d79b63e 100644 --- a/blog-frontend/src/swagger/models/attach-info-response-vo.ts +++ b/blog-frontend/src/swagger/models/attach-info-response-vo.ts @@ -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} diff --git a/blog-frontend/src/swagger/models/blog-update-require-vo.ts b/blog-frontend/src/swagger/models/blog-update-require-vo.ts index b63be87..2343aac 100644 --- a/blog-frontend/src/swagger/models/blog-update-require-vo.ts +++ b/blog-frontend/src/swagger/models/blog-update-require-vo.ts @@ -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} * @memberof BlogUpdateRequireVO */ - tags: Array; + tags?: Array; } diff --git a/blog-frontend/src/swagger/models/v1-attach-body.ts b/blog-frontend/src/swagger/models/v1-attach-body.ts index 17e813a..60da610 100644 --- a/blog-frontend/src/swagger/models/v1-attach-body.ts +++ b/blog-frontend/src/swagger/models/v1-attach-body.ts @@ -19,8 +19,8 @@ export interface V1AttachBody { /** * - * @type {Blob} + * @type {any} * @memberof V1AttachBody */ - file: Blob; + file: any; }