From 5878dc3a81705590355affa085fec28e765edc6e Mon Sep 17 00:00:00 2001 From: wxy <14293288+zysysys@user.noreply.gitee.com> Date: Fri, 24 May 2024 15:03:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../file/controller/SysFileController.java | 48 ++++++++ .../mapper/system/SysDictTypeMapper.xml | 105 ++++++++++++++++++ 2 files changed, 153 insertions(+) create mode 100644 jing-modules/jing-file/src/main/java/com/jing/file/controller/SysFileController.java create mode 100644 jing-modules/jing-system/src/main/resources/mapper/system/SysDictTypeMapper.xml diff --git a/jing-modules/jing-file/src/main/java/com/jing/file/controller/SysFileController.java b/jing-modules/jing-file/src/main/java/com/jing/file/controller/SysFileController.java new file mode 100644 index 0000000..5d4d01e --- /dev/null +++ b/jing-modules/jing-file/src/main/java/com/jing/file/controller/SysFileController.java @@ -0,0 +1,48 @@ +package com.jing.file.controller; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; +import com.jing.common.core.domain.R; +import com.jing.common.core.utils.file.FileUtils; +import com.jing.file.service.ISysFileService; +import com.jing.system.api.domain.SysFile; + +/** + * 文件请求处理 + * + * @author ruoyi + */ +@RestController +public class SysFileController +{ + private static final Logger log = LoggerFactory.getLogger(SysFileController.class); + + @Autowired + private ISysFileService sysFileService; + + /** + * 文件上传请求 + */ + @PostMapping("upload") + public R upload(MultipartFile file) + { + try + { + // 上传并返回访问地址 + String url = sysFileService.uploadFile(file); + SysFile sysFile = new SysFile(); + sysFile.setName(FileUtils.getName(url)); + sysFile.setUrl(url); + return R.ok(sysFile); + } + catch (Exception e) + { + log.error("上传文件失败", e); + return R.fail(e.getMessage()); + } + } +} \ No newline at end of file diff --git a/jing-modules/jing-system/src/main/resources/mapper/system/SysDictTypeMapper.xml b/jing-modules/jing-system/src/main/resources/mapper/system/SysDictTypeMapper.xml new file mode 100644 index 0000000..67ebe2b --- /dev/null +++ b/jing-modules/jing-system/src/main/resources/mapper/system/SysDictTypeMapper.xml @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + select dict_id, dict_name, dict_type, status, create_by, create_time, remark + from sys_dict_type + + + + + + + + + + + + + + delete from sys_dict_type where dict_id = #{dictId} + + + + delete from sys_dict_type where dict_id in + + #{dictId} + + + + + update sys_dict_type + + dict_name = #{dictName}, + dict_type = #{dictType}, + status = #{status}, + remark = #{remark}, + update_by = #{updateBy}, + update_time = sysdate() + + where dict_id = #{dictId} + + + + insert into sys_dict_type( + dict_name, + dict_type, + status, + remark, + create_by, + create_time + )values( + #{dictName}, + #{dictType}, + #{status}, + #{remark}, + #{createBy}, + sysdate() + ) + + +