From 91aa3aaa799f829240ccf0c2c5791af366d23902 Mon Sep 17 00:00:00 2001 From: 19173159168 Date: Tue, 12 Aug 2025 21:53:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=93=81=E7=89=8C=E7=AE=A1?= =?UTF-8?q?=E7=90=86=EF=BC=8C=E5=93=81=E7=89=8C=E5=8A=A8=E6=80=81=E9=80=89?= =?UTF-8?q?=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/common/CommonController.java | 44 +++++++++---------- .../mapper/operation/ZcCarBrandMapper.xml | 1 + .../mapper/operation/ZcCarModelMapper.xml | 1 + .../templates/orders/order/edit.html | 8 ---- .../ruoyi/common/utils/oss/OssService.java | 13 +++--- 5 files changed, 30 insertions(+), 37 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java index 78104e7..dc67b4f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java @@ -284,30 +284,30 @@ public class CommonController try { /** oss --------------- */ -// // 检查文件是否为空 -// if (file.isEmpty()) { -// return AjaxResult.error("上传文件不能为空"); -// } -// -// // 检查文件类型(可选) -// String contentType = file.getContentType(); -// if (contentType == null || !contentType.startsWith("image/")) { -// return AjaxResult.error("只允许上传图片文件"); -// } -// -// // 上传到 OSS -// String url = ossService.uploadImage(file); -// // 返回文件访问 URL -// String[] str = url.split("/"); -// String fileName = str[str.length - 1]; + // 检查文件是否为空 + if (file.isEmpty()) { + return AjaxResult.error("上传文件不能为空"); + } + + // 检查文件类型(可选) + String contentType = file.getContentType(); + if (contentType == null || !contentType.startsWith("image/")) { + return AjaxResult.error("只允许上传图片文件"); + } + + // 上传到 OSS + String url = ossService.uploadImage(file); + // 返回文件访问 URL + String[] str = url.split("/"); + String fileName = str[str.length - 1]; /** 原文件上传 --------------- */ - // 上传文件路径 - String filePath = RuoYiConfig.getUploadPath(); - // 上传并返回新文件名称 - String fileName = FileUploadUtils.upload(filePath, fileType, file); - - String url = serverConfig.getUrl() + fileName; +// // 上传文件路径 +// String filePath = RuoYiConfig.getUploadPath(); +// // 上传并返回新文件名称 +// String fileName = FileUploadUtils.upload(filePath, fileType, file); +// +// String url = serverConfig.getUrl() + fileName; /** -------------------------- */ String uuid = UUID.randomUUID().toString(); CommonAttachment insert = new CommonAttachment(); diff --git a/ruoyi-admin/src/main/resources/mapper/operation/ZcCarBrandMapper.xml b/ruoyi-admin/src/main/resources/mapper/operation/ZcCarBrandMapper.xml index a980756..e8cdcf0 100644 --- a/ruoyi-admin/src/main/resources/mapper/operation/ZcCarBrandMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/operation/ZcCarBrandMapper.xml @@ -58,6 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and extend2 = #{extend2} and extend3 = #{extend3} + order by update_time desc