From a71243d9eba30bca63aff56f02f3fc8601fe8495 Mon Sep 17 00:00:00 2001 From: dqjdda <201507802@qq.com> Date: Sat, 7 Sep 2019 22:02:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E4=BA=86=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?=E5=AD=98=E5=82=A8=E5=8A=9F=E8=83=BD=EF=BC=8C=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=A4=B4=E5=83=8F=E5=AD=98=E5=82=A8=E6=96=B9=E5=BC=8F=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E6=9C=AC=E5=9C=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/me/zhengjie/redis/RedisConfig.java | 1 + .../main/java/me/zhengjie/utils/FileUtil.java | 69 +++++++++- .../me/zhengjie/config/ConfigurerAdapter.java | 30 ++--- .../security/config/SecurityConfig.java | 5 + .../zhengjie/modules/system/domain/User.java | 5 +- .../modules/system/domain/UserAvatar.java | 36 ++++++ .../repository/UserAvatarRepository.java | 15 +++ .../modules/system/rest/UserController.java | 3 +- .../modules/system/service/UserService.java | 6 +- .../system/service/impl/MenuServiceImpl.java | 8 +- .../system/service/impl/UserServiceImpl.java | 34 +++-- .../system/service/mapper/UserMapper.java | 5 + .../main/resources/config/application-dev.yml | 10 +- .../resources/config/application-prod.yml | 10 +- .../template/generator/front/eForm.ftl | 2 +- .../java/me/zhengjie/domain/LocalStorage.java | 83 ++++++++++++ .../repository/LocalStorageRepository.java | 12 ++ .../repository/QiNiuConfigRepository.java | 6 + .../zhengjie/rest/LocalStorageController.java | 70 +++++++++++ .../me/zhengjie/rest/QiniuController.java | 1 + .../zhengjie/service/LocalStorageService.java | 69 ++++++++++ .../me/zhengjie/service/QiNiuService.java | 4 + .../zhengjie/service/dto/LocalStorageDTO.java | 41 ++++++ .../dto/LocalStorageQueryCriteria.java | 17 +++ .../service/impl/LocalStorageServiceImpl.java | 118 ++++++++++++++++++ .../service/impl/QiNiuServiceImpl.java | 18 +-- .../service/mapper/LocalStorageMapper.java | 16 +++ sql/eladmin.sql | 86 +++++++++---- 28 files changed, 703 insertions(+), 77 deletions(-) create mode 100644 eladmin-system/src/main/java/me/zhengjie/modules/system/domain/UserAvatar.java create mode 100644 eladmin-system/src/main/java/me/zhengjie/modules/system/repository/UserAvatarRepository.java create mode 100644 eladmin-tools/src/main/java/me/zhengjie/domain/LocalStorage.java create mode 100644 eladmin-tools/src/main/java/me/zhengjie/repository/LocalStorageRepository.java create mode 100644 eladmin-tools/src/main/java/me/zhengjie/rest/LocalStorageController.java create mode 100644 eladmin-tools/src/main/java/me/zhengjie/service/LocalStorageService.java create mode 100644 eladmin-tools/src/main/java/me/zhengjie/service/dto/LocalStorageDTO.java create mode 100644 eladmin-tools/src/main/java/me/zhengjie/service/dto/LocalStorageQueryCriteria.java create mode 100644 eladmin-tools/src/main/java/me/zhengjie/service/impl/LocalStorageServiceImpl.java create mode 100644 eladmin-tools/src/main/java/me/zhengjie/service/mapper/LocalStorageMapper.java diff --git a/eladmin-common/src/main/java/me/zhengjie/redis/RedisConfig.java b/eladmin-common/src/main/java/me/zhengjie/redis/RedisConfig.java index a9486165..e72ae435 100644 --- a/eladmin-common/src/main/java/me/zhengjie/redis/RedisConfig.java +++ b/eladmin-common/src/main/java/me/zhengjie/redis/RedisConfig.java @@ -61,6 +61,7 @@ public class RedisConfig extends CachingConfigurerSupport { // 建议使用这种方式,小范围指定白名单 ParserConfig.getGlobalInstance().addAccept("me.zhengjie.domain"); ParserConfig.getGlobalInstance().addAccept("me.zhengjie.modules.system.service.dto"); + ParserConfig.getGlobalInstance().addAccept("me.zhengjie.service.dto"); ParserConfig.getGlobalInstance().addAccept("me.zhengjie.modules.system.domain"); ParserConfig.getGlobalInstance().addAccept("me.zhengjie.modules.quartz.domain"); ParserConfig.getGlobalInstance().addAccept("me.zhengjie.modules.monitor.domain"); diff --git a/eladmin-common/src/main/java/me/zhengjie/utils/FileUtil.java b/eladmin-common/src/main/java/me/zhengjie/utils/FileUtil.java index 011b92bf..5872c46c 100644 --- a/eladmin-common/src/main/java/me/zhengjie/utils/FileUtil.java +++ b/eladmin-common/src/main/java/me/zhengjie/utils/FileUtil.java @@ -4,12 +4,16 @@ import cn.hutool.core.io.IoUtil; import cn.hutool.core.util.IdUtil; import cn.hutool.poi.excel.ExcelUtil; import cn.hutool.poi.excel.ExcelWriter; +import me.zhengjie.exception.BadRequestException; import org.springframework.web.multipart.MultipartFile; +import sun.misc.BASE64Encoder; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import java.io.*; import java.text.DecimalFormat; +import java.text.SimpleDateFormat; +import java.util.Date; import java.util.List; import java.util.Map; @@ -107,7 +111,7 @@ public class FileUtil extends cn.hutool.core.io.FileUtil { * @param size * @return */ - public static String getSize(int size){ + public static String getSize(long size){ String resultSize = ""; if (size / GB >= 1) { //如果当前Byte的值大于等于1GB @@ -147,6 +151,47 @@ public class FileUtil extends cn.hutool.core.io.FileUtil { return file; } + /** + * 将文件名解析成文件的上传路径 + * + * @param file + * @param filePath + * @return 上传到服务器的文件名 + */ + public static File upload(MultipartFile file, String filePath) { + Date date = new Date(); + SimpleDateFormat format = new SimpleDateFormat("yyyyMMddhhmmssS"); + String name = getFileNameNoEx(file.getOriginalFilename()); + String suffix = getExtensionName(file.getOriginalFilename()); + String nowStr = "-" + format.format(date); + try { + String fileName = name + nowStr + "." + suffix; + String path = filePath + fileName; + File dest = new File(path); + // 检测是否存在目录 + if (!dest.getParentFile().exists()) { + dest.getParentFile().mkdirs();// 新建文件夹 + } + String d = dest.getPath(); + file.transferTo(dest);// 文件写入 + return dest; + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + public static String fileToBase64(File file) throws Exception { + FileInputStream inputFile = new FileInputStream(file); + String base64 =null; + byte[] buffer = new byte[(int)file.length()]; + inputFile.read(buffer); + inputFile.close(); + base64=new BASE64Encoder().encode(buffer); + String encoded = base64.replaceAll("[\\s*\t\n\r]", ""); + return encoded; + } + /** * 导出excel * @param list @@ -174,4 +219,26 @@ public class FileUtil extends cn.hutool.core.io.FileUtil { //此处记得关闭输出Servlet流 IoUtil.close(out); } + + public static String getFileType(String type) { + String documents = "txt doc pdf ppt pps xlsx xls"; + String music = "mp3 wav wma mpa ram ra aac aif m4a"; + String video = "avi mpg mpe mpeg asf wmv mov qt rm mp4 flv m4v webm ogv ogg"; + String image = "bmp dib pcp dif wmf gif jpg tif eps psd cdr iff tga pcd mpt png jpeg"; + if(image.indexOf(type) != -1){ + return "图片"; + } else if(documents.indexOf(type) != -1){ + return "文档"; + } else if(music.indexOf(type) != -1){ + return "音乐"; + } else if(video.indexOf(type) != -1){ + return "视频"; + } else return "其他"; + } + + public static void checkSize(long maxSize, long size) { + if(size > (maxSize * 1024 * 1024)){ + throw new BadRequestException("文件超出规定大小"); + } + } } diff --git a/eladmin-system/src/main/java/me/zhengjie/config/ConfigurerAdapter.java b/eladmin-system/src/main/java/me/zhengjie/config/ConfigurerAdapter.java index 24d0b831..87d2d15d 100644 --- a/eladmin-system/src/main/java/me/zhengjie/config/ConfigurerAdapter.java +++ b/eladmin-system/src/main/java/me/zhengjie/config/ConfigurerAdapter.java @@ -3,6 +3,7 @@ package me.zhengjie.config; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.module.SimpleModule; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.converter.StringHttpMessageConverter; @@ -25,6 +26,12 @@ import java.util.List; @EnableWebMvc public class ConfigurerAdapter implements WebMvcConfigurer { + @Value("${file.path}") + private String path; + + @Value("${file.avatar}") + private String avatar; + @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**") @@ -35,27 +42,12 @@ public class ConfigurerAdapter implements WebMvcConfigurer { } -// 可解决Long 类型在 前端精度丢失的问题, 如不想全局 直接添加注解 @JsonSerialize(using= ToStringSerializer.class) 到相应的字段 - -// @Override -// public void configureMessageConverters(List> converters) { -// -// MappingJackson2HttpMessageConverter jackson2HttpMessageConverter = -// new MappingJackson2HttpMessageConverter(); -// -// ObjectMapper objectMapper = new ObjectMapper(); -// SimpleModule simpleModule = new SimpleModule(); -// simpleModule.addSerializer(BigInteger.class, ToStringSerializer.instance); -// simpleModule.addSerializer(Long.class, ToStringSerializer.instance); -// simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance); -// objectMapper.registerModule(simpleModule); -// jackson2HttpMessageConverter.setObjectMapper(objectMapper); -// converters.add(jackson2HttpMessageConverter); -// converters.add(new StringHttpMessageConverter(Charset.forName("UTF-8"))); -// } - @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { + String avatarUtl = "file:" + avatar.replace("\\","/"); + String pathUtl = "file:" + path.replace("\\","/"); + registry.addResourceHandler("/avatar/**").addResourceLocations(avatarUtl).setCachePeriod(0); + registry.addResourceHandler("/file/**").addResourceLocations(pathUtl).setCachePeriod(0); registry.addResourceHandler("/**").addResourceLocations("classpath:/META-INF/resources/").setCachePeriod(0); } } diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/security/config/SecurityConfig.java b/eladmin-system/src/main/java/me/zhengjie/modules/security/config/SecurityConfig.java index d7f006c1..d10bd218 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/security/config/SecurityConfig.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/security/config/SecurityConfig.java @@ -106,6 +106,11 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { // 接口限流测试 .antMatchers("/test/**").anonymous() + // 文件 + .antMatchers("/avatar/**").anonymous() + .antMatchers("/file/**").anonymous() + + // 放行OPTIONS请求 .antMatchers(HttpMethod.OPTIONS, "/**").anonymous() .antMatchers("/druid/**").anonymous() diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/User.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/User.java index b801b558..0bb62850 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/User.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/User.java @@ -31,7 +31,9 @@ public class User implements Serializable { @Column(unique = true) private String username; - private String avatar; + @OneToOne + @JoinColumn(name = "avatar_id") + private UserAvatar userAvatar; @NotBlank @Pattern(regexp = "([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}",message = "格式错误") @@ -69,7 +71,6 @@ public class User implements Serializable { return "User{" + "id=" + id + ", username='" + username + '\'' + - ", avatar='" + avatar + '\'' + ", email='" + email + '\'' + ", enabled=" + enabled + ", password='" + password + '\'' + diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/UserAvatar.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/UserAvatar.java new file mode 100644 index 00000000..bba30dc2 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/UserAvatar.java @@ -0,0 +1,36 @@ +package me.zhengjie.modules.system.domain; + +import cn.hutool.core.util.ObjectUtil; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.persistence.*; +import java.sql.Timestamp; + +/** + * @author Zheng Jie + * @date 2019年9月7日 16:16:59 + */ +@Entity +@Table(name = "user_avatar") +@Data +@NoArgsConstructor +public class UserAvatar { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + private String realName; + + private String path; + + private String size; + + public UserAvatar(UserAvatar userAvatar,String realName, String path, String size) { + this.id = ObjectUtil.isNotEmpty(userAvatar) ? userAvatar.getId() : null; + this.realName = realName; + this.path = path; + this.size = size; + } +} diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/UserAvatarRepository.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/UserAvatarRepository.java new file mode 100644 index 00000000..38136f85 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/UserAvatarRepository.java @@ -0,0 +1,15 @@ +package me.zhengjie.modules.system.repository; + +import me.zhengjie.modules.system.domain.UserAvatar; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +import java.util.Date; + +/** + * @author Zheng Jie + * @date 2018-11-22 + */ +public interface UserAvatarRepository extends JpaRepository, JpaSpecificationExecutor { + +} diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/UserController.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/UserController.java index 9e4b8d44..35706f73 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/UserController.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/UserController.java @@ -155,8 +155,7 @@ public class UserController { */ @PostMapping(value = "/users/updateAvatar") public ResponseEntity updateAvatar(@RequestParam MultipartFile file){ - Picture picture = pictureService.upload(file, SecurityUtils.getUsername()); - userService.updateAvatar(SecurityUtils.getUsername(),picture.getUrl()); + userService.updateAvatar(file); return new ResponseEntity(HttpStatus.OK); } diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/UserService.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/UserService.java index fd16c599..1414e1f8 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/UserService.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/UserService.java @@ -8,6 +8,7 @@ import org.springframework.cache.annotation.CacheConfig; import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.Cacheable; import org.springframework.data.domain.Pageable; +import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; import java.util.List; @@ -67,11 +68,10 @@ public interface UserService { /** * 修改头像 - * @param username - * @param url + * @param file */ @CacheEvict(allEntries = true) - void updateAvatar(String username, String url); + void updateAvatar(MultipartFile file); /** * 修改邮箱 diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/MenuServiceImpl.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/MenuServiceImpl.java index da3242b7..1f8afdf4 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/MenuServiceImpl.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/MenuServiceImpl.java @@ -197,15 +197,13 @@ public class MenuServiceImpl implements MenuService { if (menuDTO!=null){ List menuDTOList = menuDTO.getChildren(); MenuVo menuVo = new MenuVo(); - menuVo.setName(ObjectUtil.isNotEmpty(menuDTO.getComponentName()) ? menuDTO.getComponentName() : RandomUtil.randomString(5)); - menuVo.setPath(menuDTO.getPath()); + menuVo.setName(ObjectUtil.isNotEmpty(menuDTO.getComponentName()) ? menuDTO.getComponentName() : menuDTO.getName()); + // 一级目录需要加斜杠,不然会报警告 + menuVo.setPath(menuDTO.getPid() == 0 ? "/" + menuDTO.getPath() :menuDTO.getPath()); menuVo.setHidden(menuDTO.getHidden()); - // 如果不是外链 if(!menuDTO.getIFrame()){ if(menuDTO.getPid() == 0){ - //一级目录需要加斜杠,不然访问 会跳转404页面 - menuVo.setPath("/" + menuDTO.getPath()); menuVo.setComponent(StrUtil.isEmpty(menuDTO.getComponent())?"Layout":menuDTO.getComponent()); }else if(!StrUtil.isEmpty(menuDTO.getComponent())){ menuVo.setComponent(menuDTO.getComponent()); diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/UserServiceImpl.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/UserServiceImpl.java index eeb40847..32921765 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/UserServiceImpl.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/UserServiceImpl.java @@ -7,24 +7,27 @@ import me.zhengjie.modules.monitor.service.RedisService; import me.zhengjie.modules.system.domain.User; import me.zhengjie.exception.EntityExistException; import me.zhengjie.exception.EntityNotFoundException; +import me.zhengjie.modules.system.domain.UserAvatar; +import me.zhengjie.modules.system.repository.UserAvatarRepository; import me.zhengjie.modules.system.repository.UserRepository; import me.zhengjie.modules.system.service.UserService; import me.zhengjie.modules.system.service.dto.RoleSmallDTO; import me.zhengjie.modules.system.service.dto.UserDTO; import me.zhengjie.modules.system.service.dto.UserQueryCriteria; import me.zhengjie.modules.system.service.mapper.UserMapper; -import me.zhengjie.utils.FileUtil; -import me.zhengjie.utils.PageUtil; -import me.zhengjie.utils.QueryHelp; -import me.zhengjie.utils.ValidationUtil; +import me.zhengjie.utils.*; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; + import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; +import java.io.File; import java.io.IOException; import java.util.*; import java.util.stream.Collectors; @@ -46,6 +49,12 @@ public class UserServiceImpl implements UserService { @Autowired private RedisService redisService; + @Autowired + private UserAvatarRepository userAvatarRepository; + + @Value("${file.avatar}") + private String avatar; + @Override public Object queryAll(UserQueryCriteria criteria, Pageable pageable) { Page page = userRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); @@ -79,7 +88,6 @@ public class UserServiceImpl implements UserService { // 默认密码 123456,此密码是加密后的字符 resources.setPassword("e10adc3949ba59abbe56e057f20f883e"); - resources.setAvatar("https://i.loli.net/2019/04/04/5ca5b971e1548.jpeg"); return userMapper.toDto(userRepository.save(resources)); } @@ -149,8 +157,20 @@ public class UserServiceImpl implements UserService { @Override @Transactional(rollbackFor = Exception.class) - public void updateAvatar(String username, String url) { - userRepository.updateAvatar(username,url); + public void updateAvatar(MultipartFile multipartFile) { + User user = userRepository.findByUsername(SecurityUtils.getUsername()); + UserAvatar userAvatar = user.getUserAvatar(); + String oldPath = ""; + if(userAvatar != null){ + oldPath = userAvatar.getPath(); + } + File file = FileUtil.upload(multipartFile, avatar); + userAvatar = userAvatarRepository.save(new UserAvatar(userAvatar,file.getName(), file.getPath(), FileUtil.getSize(multipartFile.getSize()))); + user.setUserAvatar(userAvatar); + userRepository.save(user); + if(StringUtils.isNotBlank(oldPath)){ + FileUtil.del(oldPath); + } } @Override diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapper/UserMapper.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapper/UserMapper.java index 50cbfb8f..248003a3 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapper/UserMapper.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapper/UserMapper.java @@ -4,8 +4,11 @@ import me.zhengjie.modules.system.domain.User; import me.zhengjie.mapper.EntityMapper; import me.zhengjie.modules.system.service.dto.UserDTO; import org.mapstruct.Mapper; +import org.mapstruct.Mapping; import org.mapstruct.ReportingPolicy; +import java.util.List; + /** * @author Zheng Jie * @date 2018-11-23 @@ -13,4 +16,6 @@ import org.mapstruct.ReportingPolicy; @Mapper(componentModel = "spring",uses = {RoleMapper.class, DeptMapper.class, JobMapper.class},unmappedTargetPolicy = ReportingPolicy.IGNORE) public interface UserMapper extends EntityMapper { + @Mapping(source = "user.userAvatar.realName",target = "avatar") + UserDTO toDto(User user); } diff --git a/eladmin-system/src/main/resources/config/application-dev.yml b/eladmin-system/src/main/resources/config/application-dev.yml index 58489bb7..45b7a500 100644 --- a/eladmin-system/src/main/resources/config/application-dev.yml +++ b/eladmin-system/src/main/resources/config/application-dev.yml @@ -59,4 +59,12 @@ generator: #是否开启 swagger-ui swagger: - enabled: true \ No newline at end of file + enabled: true + +# 文件存储路径 +file: + path: C:\eladmin\file\ + avatar: C:\eladmin\avatar\ + # 文件大小 /M + maxSize: 100 + avatarMaxSize: 5 \ No newline at end of file diff --git a/eladmin-system/src/main/resources/config/application-prod.yml b/eladmin-system/src/main/resources/config/application-prod.yml index dfd1d716..a1ae2b74 100644 --- a/eladmin-system/src/main/resources/config/application-prod.yml +++ b/eladmin-system/src/main/resources/config/application-prod.yml @@ -68,4 +68,12 @@ generator: #是否开启 swagger-ui swagger: - enabled: false \ No newline at end of file + enabled: false + +# 文件存储路径 +file: + path: /home/eladmin/file/ + avatar: /home/eladmin/avatar/ + # 文件大小 /M + maxSize: 100 + avatarMaxSize: 5 \ No newline at end of file diff --git a/eladmin-system/src/main/resources/template/generator/front/eForm.ftl b/eladmin-system/src/main/resources/template/generator/front/eForm.ftl index 84acd88f..1e8fbcd9 100644 --- a/eladmin-system/src/main/resources/template/generator/front/eForm.ftl +++ b/eladmin-system/src/main/resources/template/generator/front/eForm.ftl @@ -1,5 +1,5 @@