增加品牌管理,品牌动态选择
This commit is contained in:
@ -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();
|
||||
|
||||
@ -58,6 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="extend2 != null and extend2 != ''"> and extend2 = #{extend2}</if>
|
||||
<if test="extend3 != null and extend3 != ''"> and extend3 = #{extend3}</if>
|
||||
</where>
|
||||
order by update_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectZcCarBrandById" parameterType="Long" resultMap="ZcCarBrandZcCarModelResult">
|
||||
|
||||
@ -53,6 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="brandName != null and brandName != ''"> and brand_name like concat('%', #{brandName}, '%')</if>
|
||||
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||
</where>
|
||||
order by update_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectZcCarModelById" parameterType="Long" resultMap="ZcCarModelResult">
|
||||
|
||||
@ -234,19 +234,11 @@
|
||||
align: 'center',
|
||||
title: '实际支付时间'
|
||||
},
|
||||
|
||||
{
|
||||
field: 'remark',
|
||||
align: 'center',
|
||||
title: '备注'
|
||||
},
|
||||
|
||||
{
|
||||
field: 'createTime',
|
||||
align: 'center',
|
||||
title: '创建时间'
|
||||
},
|
||||
|
||||
{
|
||||
field: 'updateTime',
|
||||
align: 'center',
|
||||
|
||||
@ -50,14 +50,13 @@ public class OssService {
|
||||
// 上传文件
|
||||
ossClient.putObject(putObjectRequest);
|
||||
|
||||
// 设置预签名URL过期时间,单位为亮秒。本示例以设置过期时间为1小时为例
|
||||
Date expiration = new Date(new Date().getTime()+ 3600 * 1000L);
|
||||
//生成以GET方法访问的预签名URL、本示例没有额外请求头,其他人可以直按通过湖览器访问相关内容
|
||||
URL url = ossClient.generatePresignedUrl(ossConfig.getBucketName(), objectName, expiration);
|
||||
System.out.println(url);
|
||||
return url.toString();
|
||||
// // 设置预签名URL过期时间,单位为亮秒。本示例以设置过期时间为1小时为例
|
||||
// Date expiration = new Date(new Date().getTime()+ 3600 * 1000L);
|
||||
// //生成以GET方法访问的预签名URL、本示例没有额外请求头,其他人可以直按通过湖览器访问相关内容
|
||||
// URL url = ossClient.generatePresignedUrl(ossConfig.getBucketName(), objectName, expiration);
|
||||
// return url.toString();
|
||||
// 返回文件访问 URL
|
||||
//return "https://" + ossConfig.getDomain() + "/" + objectName;
|
||||
return "https://" + ossConfig.getDomain() + "/" + objectName;
|
||||
} catch (com.aliyun.oss.OSSException e) {
|
||||
if ("AccessDenied".equals(e.getErrorCode())) {
|
||||
throw new IOException("OSS权限不足,请联系管理员配置权限。错误代码: " + e.getErrorCode(), e);
|
||||
|
||||
Reference in New Issue
Block a user