diff --git a/README.md b/README.md index 30ef7339..14039a02 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ | Spring Cloud Alibaba | 2021.1 | | Spring Security OAuth2 | 2.3.6 | | Mybatis Plus | 3.4.3.2 | -| hutool | 5.7.9 | +| hutool | 5.7.12 | | Avue | 2.6.18 | ### 模块说明 @@ -71,6 +71,11 @@ pig 提供了详细的[部署文档 wiki.pig4cloud.com](https://www.yuque.com/pi 请务必**完全按照**文档部署运行章节 进行操作,减少踩坑弯路!! +### 定制自己微服务 + +[PIG DIY](https://diy.pig4cloud.com) +[PIG ARCHETYPE](https://archetype.pig4cloud.com) + ### Docker 运行 ``` @@ -87,22 +92,6 @@ cd pig-ui && npm install -g cnpm --registry=https://registry.npm.taobao.org npm run build:docker && docker-compose up -d ``` -### 快速构架微服务 - -```bash - -# 在空文件夹执行以下命令,注意 windows 下 \ 修改成 ^ -mvn archetype:generate \ - -DgroupId=com.pig4cloud \ - -DartifactId=demo \ - -Dversion=1.0.0-SNAPSHOT \ - -Dpackage=com.pig4cloud.pig.demo \ - -DarchetypeGroupId=com.pig4cloud.archetype \ - -DarchetypeArtifactId=pig-gen \ - -DarchetypeVersion=3.3.2 \ - -DarchetypeCatalog=local -``` - ## 免费公开课 diff --git a/db/pig.sql b/db/pig.sql index f5eeeb8d..3b22ea1a 100644 --- a/db/pig.sql +++ b/db/pig.sql @@ -227,6 +227,10 @@ INSERT INTO `sys_menu` VALUES (2401, '客户端新增', 'sys_client_add', NULL, INSERT INTO `sys_menu` VALUES (2402, '客户端修改', 'sys_client_edit', NULL, 2400, NULL, NULL, 1, '0', '1', '0', NULL, '2018-05-15 21:37:06', NULL, '2021-05-25 06:48:34'); INSERT INTO `sys_menu` VALUES (2403, '客户端删除', 'sys_client_del', NULL, 2400, NULL, NULL, 1, '0', '1', '0', NULL, '2018-05-15 21:39:16', NULL, '2021-05-25 06:48:34'); INSERT INTO `sys_menu` VALUES (2500, '服务监控', NULL, 'http://localhost:5001', 2000, 'icon-server', NULL, 10, '0', '0', '0', NULL, '2018-06-26 10:50:32', NULL, '2019-02-01 20:41:30'); +INSERT INTO `sys_menu` VALUES (2600, '文件管理', NULL, '/admin/file/index', 2000, 'icon-wenjianguanli', NULL, 10, '0', '0', '0', NULL, '2018-06-26 10:50:32', NULL, '2019-02-01 20:41:30'); +INSERT INTO `sys_menu` VALUES (2601, '文件删除', 'sys_file_del', NULL, 2600, NULL, NULL, 1, '0', '1', '0', NULL, '2017-11-29 11:30:11', NULL, '2021-05-25 06:48:34'); +INSERT INTO `sys_menu` VALUES (2602, '文件新增', 'sys_file_add', NULL, 2600, NULL, NULL, 1, '0', '1', '0', NULL, '2018-05-11 22:34:55', NULL, '2021-05-25 06:48:34'); +INSERT INTO `sys_menu` VALUES (2603, '文件修改', 'sys_file_edit', NULL, 2600, NULL, NULL, 1, '0', '1', '0', NULL, '2018-05-11 22:36:03', NULL, '2021-05-25 06:48:34'); INSERT INTO `sys_menu` VALUES (3000, '开发平台', NULL, '/gen', -1, 'icon-shejiyukaifa-', NULL, 3, '1', '0', '0', NULL, '2020-03-11 22:15:40', NULL, '2020-03-11 23:52:54'); INSERT INTO `sys_menu` VALUES (3100, '数据源管理', NULL, '/gen/datasource', 3000, 'icon-mysql', NULL, 1, '1', '0', '0', NULL, '2020-03-11 22:17:05', NULL, '2020-03-12 00:16:09'); INSERT INTO `sys_menu` VALUES (3200, '代码生成', NULL, '/gen/index', 3000, 'icon-weibiaoti46', NULL, 2, '0', '0', '0', NULL, '2020-03-11 22:23:42', NULL, '2020-03-12 00:16:14'); @@ -346,7 +350,10 @@ INSERT INTO `sys_role_menu` VALUES (1, 2400); INSERT INTO `sys_role_menu` VALUES (1, 2401); INSERT INTO `sys_role_menu` VALUES (1, 2402); INSERT INTO `sys_role_menu` VALUES (1, 2403); -INSERT INTO `sys_role_menu` VALUES (1, 2500); +INSERT INTO `sys_role_menu` VALUES (1, 2600); +INSERT INTO `sys_role_menu` VALUES (1, 2601); +INSERT INTO `sys_role_menu` VALUES (1, 2602); +INSERT INTO `sys_role_menu` VALUES (1, 2603); INSERT INTO `sys_role_menu` VALUES (1, 3000); INSERT INTO `sys_role_menu` VALUES (1, 3100); INSERT INTO `sys_role_menu` VALUES (1, 3200); @@ -404,4 +411,20 @@ BEGIN; INSERT INTO `sys_user_role` VALUES (1, 1); COMMIT; +DROP TABLE IF EXISTS `sys_file`; +CREATE TABLE `sys_file` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号', + `file_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, + `bucket_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, + `original` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, + `type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, + `file_size` bigint DEFAULT NULL COMMENT '文件大小', + `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '0-正常,1-删除', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `update_time` datetime DEFAULT NULL COMMENT '修改时间', + `create_by` varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建者', + `update_by` varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '更新人', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='文件管理表'; + SET FOREIGN_KEY_CHECKS = 1; diff --git a/pig-common/pig-common-bom/pom.xml b/pig-common/pig-common-bom/pom.xml index 7833c28d..2e86807a 100644 --- a/pig-common/pig-common-bom/pom.xml +++ b/pig-common/pig-common-bom/pom.xml @@ -27,6 +27,7 @@ 3.4.3.32.0.31.0.0 + 1.0.1 @@ -116,6 +117,13 @@ excel-spring-boot-starter${excel.version} + + + com.pig4cloud.plugin + oss-spring-boot-starter + ${oss.version} + + com.baomidou mybatis-plus-boot-starter diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysFile.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysFile.java new file mode 100644 index 00000000..d712ee15 --- /dev/null +++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysFile.java @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.admin.api.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.pig4cloud.pig.common.mybatis.base.BaseEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 文件管理 + * + * @author Luckly + * @date 2019-06-18 17:18:42 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class SysFile extends BaseEntity { + + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @TableId(type = IdType.AUTO) + private Long id; + + /** + * 文件名 + */ + private String fileName; + + /** + * 原文件名 + */ + private String original; + + /** + * 容器名称 + */ + private String bucketName; + + /** + * 文件类型 + */ + private String type; + + /** + * 文件大小 + */ + private Long fileSize; + + /** + * 删除标识:1-删除,0-正常 + */ + @TableLogic + private Integer delFlag; + +} diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysLog.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysLog.java index 100224bd..5f8ca7a8 100644 --- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysLog.java +++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysLog.java @@ -26,6 +26,7 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.pig4cloud.pig.common.mybatis.base.BaseEntity; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import lombok.EqualsAndHashCode; import javax.validation.constraints.NotBlank; @@ -38,6 +39,7 @@ import javax.validation.constraints.NotBlank; * @since 2019/2/1 */ @Data +@EqualsAndHashCode(callSuper = true) public class SysLog extends BaseEntity { private static final long serialVersionUID = 1L; diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysUser.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysUser.java index 6fb2dd7f..b9b22508 100644 --- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysUser.java +++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysUser.java @@ -23,6 +23,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.pig4cloud.pig.common.mybatis.base.BaseEntity; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import lombok.EqualsAndHashCode; /** *

@@ -33,6 +34,7 @@ import lombok.Data; * @since 2019/2/1 */ @Data +@EqualsAndHashCode(callSuper = true) public class SysUser extends BaseEntity { private static final long serialVersionUID = 1L; diff --git a/pig-upms/pig-upms-biz/pom.xml b/pig-upms/pig-upms-biz/pom.xml index 46ceeb7f..d2d08fc5 100644 --- a/pig-upms/pig-upms-biz/pom.xml +++ b/pig-upms/pig-upms-biz/pom.xml @@ -35,6 +35,11 @@ com.pig4cloud pig-upms-api + + + com.pig4cloud.plugin + oss-spring-boot-starter + com.pig4cloud diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/FileController.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/FileController.java index 2b594947..78fe64ae 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/FileController.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/FileController.java @@ -1,36 +1,98 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + package com.pig4cloud.pig.admin.controller; -import cn.hutool.core.io.IoUtil; -import lombok.SneakyThrows; -import org.springframework.core.io.ClassPathResource; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.pig4cloud.pig.admin.api.entity.SysFile; +import com.pig4cloud.pig.admin.service.SysFileService; +import com.pig4cloud.pig.common.core.util.R; +import com.pig4cloud.pig.common.log.annotation.SysLog; +import com.pig4cloud.pig.common.security.annotation.Inner; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; /** * 文件管理 * - * @author lengleng - * @date 2021/8/23 + * @author Luckly + * @date 2021-09-11 */ @RestController -@RequestMapping("/file") +@AllArgsConstructor +@RequestMapping("/sys-file") +@Api(value = "sys-file", tags = "文件管理") public class FileController { + private final SysFileService sysFileService; + /** - * 获取本地文件 - * @param fileName 文件名称 - * @param response 本地文件 + * 分页查询 + * @param page 分页对象 + * @param sysFile 文件管理 + * @return */ - @SneakyThrows - @GetMapping("/local-file/{fileName}") - public void localFile(@PathVariable String fileName, HttpServletResponse response) { - ClassPathResource resource = new ClassPathResource("file/" + fileName); - response.setContentType("application/octet-stream; charset=UTF-8"); - IoUtil.copy(resource.getInputStream(), response.getOutputStream()); + @ApiOperation(value = "分页查询", notes = "分页查询") + @GetMapping("/page") + public R getSysFilePage(Page page, SysFile sysFile) { + return R.ok(sysFileService.page(page, Wrappers.query(sysFile))); + } + + /** + * 通过id删除文件管理 + * @param id id + * @return R + */ + @ApiOperation(value = "通过id删除文件管理", notes = "通过id删除文件管理") + @SysLog("删除文件管理") + @DeleteMapping("/{id}") + @PreAuthorize("@pms.hasPermission('sys_file_del')") + public R removeById(@PathVariable Long id) { + return R.ok(sysFileService.deleteFile(id)); + } + + /** + * 上传文件 文件名采用uuid,避免原始文件名中带"-"符号导致下载的时候解析出现异常 + * @param file 资源 + * @return R(/ admin / bucketName / filename) + */ + @PostMapping(value = "/upload") + public R upload(@RequestPart("file") MultipartFile file) { + return sysFileService.uploadFile(file); + } + + /** + * 获取文件 + * @param bucket 桶名称 + * @param fileName 文件空间/名称 + * @param response + * @return + */ + @Inner(false) + @GetMapping("/{bucket}/{fileName}") + public void file(@PathVariable String bucket, @PathVariable String fileName, HttpServletResponse response) { + sysFileService.getFile(bucket, fileName, response); } } diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysFileMapper.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysFileMapper.java new file mode 100644 index 00000000..0c80a771 --- /dev/null +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysFileMapper.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.admin.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.pig4cloud.pig.admin.api.entity.SysFile; +import org.apache.ibatis.annotations.Mapper; + +/** + * 文件管理 + * + * @author Luckly + * @date 2019-06-18 17:18:42 + */ +@Mapper +public interface SysFileMapper extends BaseMapper { + +} diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysFileService.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysFileService.java new file mode 100644 index 00000000..6d7baabf --- /dev/null +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysFileService.java @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.admin.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.pig4cloud.pig.admin.api.entity.SysFile; +import com.pig4cloud.pig.common.core.util.R; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; + +/** + * 文件管理 + * + * @author Luckly + * @date 2019-06-18 17:18:42 + */ +public interface SysFileService extends IService { + + /** + * 上传文件 + * @param file + * @return + */ + R uploadFile(MultipartFile file); + + /** + * 读取文件 + * @param bucket 桶名称 + * @param fileName 文件名称 + * @param response 输出流 + */ + void getFile(String bucket, String fileName, HttpServletResponse response); + + /** + * 删除文件 + * @param id + * @return + */ + Boolean deleteFile(Long id); + +} diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysFileServiceImpl.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysFileServiceImpl.java new file mode 100644 index 00000000..6bc8e377 --- /dev/null +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysFileServiceImpl.java @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ +package com.pig4cloud.pig.admin.service.impl; + +import cn.hutool.core.io.FileUtil; +import cn.hutool.core.io.IoUtil; +import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.StrUtil; +import com.amazonaws.services.s3.model.S3Object; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.pig4cloud.pig.admin.api.entity.SysFile; +import com.pig4cloud.pig.admin.mapper.SysFileMapper; +import com.pig4cloud.pig.admin.service.SysFileService; +import com.pig4cloud.pig.common.core.util.R; +import com.pig4cloud.plugin.oss.OssProperties; +import com.pig4cloud.plugin.oss.service.OssTemplate; +import lombok.AllArgsConstructor; +import lombok.SneakyThrows; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.util.HashMap; +import java.util.Map; + +/** + * 文件管理 + * + * @author Luckly + * @date 2019-06-18 17:18:42 + */ +@Slf4j +@Service +@AllArgsConstructor +public class SysFileServiceImpl extends ServiceImpl implements SysFileService { + + private final OssProperties ossProperties; + + private final OssTemplate minioTemplate; + + /** + * 上传文件 + * @param file + * @return + */ + @Override + public R uploadFile(MultipartFile file) { + String fileName = IdUtil.simpleUUID() + StrUtil.DOT + FileUtil.extName(file.getOriginalFilename()); + Map resultMap = new HashMap<>(4); + resultMap.put("bucketName", ossProperties.getBucketName()); + resultMap.put("fileName", fileName); + resultMap.put("url", String.format("/admin/sys-file/%s/%s", ossProperties.getBucketName(), fileName)); + + try { + minioTemplate.putObject(ossProperties.getBucketName(), fileName, file.getInputStream()); + // 文件管理数据记录,收集管理追踪文件 + fileLog(file, fileName); + } + catch (Exception e) { + log.error("上传失败", e); + return R.failed(e.getLocalizedMessage()); + } + return R.ok(resultMap); + } + + /** + * 读取文件 + * @param bucket + * @param fileName + * @param response + */ + @Override + public void getFile(String bucket, String fileName, HttpServletResponse response) { + try (S3Object s3Object = minioTemplate.getObject(bucket, fileName)) { + response.setContentType("application/octet-stream; charset=UTF-8"); + IoUtil.copy(s3Object.getObjectContent(), response.getOutputStream()); + } + catch (Exception e) { + log.error("文件读取异常: {}", e.getLocalizedMessage()); + } + } + + /** + * 删除文件 + * @param id + * @return + */ + @Override + @SneakyThrows + @Transactional(rollbackFor = Exception.class) + public Boolean deleteFile(Long id) { + SysFile file = this.getById(id); + minioTemplate.removeObject(ossProperties.getBucketName(), file.getFileName()); + return this.removeById(id); + } + + /** + * 文件管理数据记录,收集管理追踪文件 + * @param file 上传文件格式 + * @param fileName 文件名 + */ + private void fileLog(MultipartFile file, String fileName) { + SysFile sysFile = new SysFile(); + sysFile.setFileName(fileName); + sysFile.setOriginal(file.getOriginalFilename()); + sysFile.setFileSize(file.getSize()); + sysFile.setType(FileUtil.extName(file.getOriginalFilename())); + sysFile.setBucketName(ossProperties.getBucketName()); + this.save(sysFile); + } + +} diff --git a/pig-upms/pig-upms-biz/src/main/resources/mapper/SysFileMapper.xml b/pig-upms/pig-upms-biz/src/main/resources/mapper/SysFileMapper.xml new file mode 100644 index 00000000..12ddfa42 --- /dev/null +++ b/pig-upms/pig-upms-biz/src/main/resources/mapper/SysFileMapper.xml @@ -0,0 +1,26 @@ + + + + + + + + +