!32 版本更新 v1.0.1
Merge pull request !32 from 疯狂的狮子li/dev
| | |
| | | <description>RuoYi-Vue-Plus后台管理系统</description> |
| | | |
| | | <properties> |
| | | <ruoyi-vue-plus.version>1.0.0</ruoyi-vue-plus.version> |
| | | <ruoyi-vue-plus.version>1.0.1</ruoyi-vue-plus.version> |
| | | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
| | | <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> |
| | | <java.version>1.8</java.version> |
| | |
| | | { |
| | | System.setProperty("spring.devtools.restart.enabled", "false"); |
| | | SpringApplication.run(RuoYiApplication.class, args); |
| | | System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙"); |
| | | System.out.println("(♥◠‿◠)ノ゙ RuoYi-Vue-Plus启动成功 ლ(´ڡ`ლ)゙"); |
| | | } |
| | | } |
| | |
| | | return util.exportExcel(list, "操作日志"); |
| | | } |
| | | |
| | | @Log(title = "操作日志", businessType = BusinessType.DELETE) |
| | | @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')") |
| | | @DeleteMapping("/{operIds}") |
| | | public AjaxResult remove(@PathVariable Long[] operIds) |
| | |
| | | /** |
| | | * Swagger2的接口配置 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | @Configuration |
| | | @EnableSwagger2WebMvc |
| | | @EnableKnife4j |
| | | public class SwaggerConfig |
| | | { |
| | | /** 系统基础配置 */ |
| | | public class SwaggerConfig { |
| | | /** |
| | | * 系统基础配置 |
| | | */ |
| | | @Autowired |
| | | private RuoYiConfig ruoyiConfig; |
| | | |
| | | /** 是否开启swagger */ |
| | | /** |
| | | * 是否开启swagger |
| | | */ |
| | | @Value("${swagger.enabled}") |
| | | private boolean enabled; |
| | | |
| | | /** 设置请求的统一前缀 */ |
| | | /** |
| | | * 设置请求的统一前缀 |
| | | */ |
| | | @Value("${swagger.pathMapping}") |
| | | private String pathMapping; |
| | | |
| | | /** |
| | | * 标题 |
| | | */ |
| | | @Value("${swagger.title}") |
| | | private String title; |
| | | |
| | | /** |
| | | * 描述 |
| | | */ |
| | | @Value("${swagger.description}") |
| | | private String description; |
| | | |
| | | /** |
| | | * 版本 |
| | | */ |
| | | @Value("${swagger.version}") |
| | | private String version; |
| | | |
| | | /** |
| | | * 创建API |
| | | */ |
| | | @Bean |
| | | public Docket createRestApi() |
| | | { |
| | | public Docket createRestApi() { |
| | | return new Docket(DocumentationType.SWAGGER_2) |
| | | // 是否启用Swagger |
| | | .enable(enabled) |
| | |
| | | /** |
| | | * 安全模式,这里指定token通过Authorization头请求头传递 |
| | | */ |
| | | private List<ApiKey> securitySchemes() |
| | | { |
| | | private List<ApiKey> securitySchemes() { |
| | | List<ApiKey> apiKeyList = new ArrayList<ApiKey>(); |
| | | apiKeyList.add(new ApiKey("Authorization", "Authorization", "header")); |
| | | return apiKeyList; |
| | |
| | | /** |
| | | * 安全上下文 |
| | | */ |
| | | private List<SecurityContext> securityContexts() |
| | | { |
| | | private List<SecurityContext> securityContexts() { |
| | | List<SecurityContext> securityContexts = new ArrayList<>(); |
| | | securityContexts.add( |
| | | SecurityContext.builder() |
| | |
| | | /** |
| | | * 默认的安全上引用 |
| | | */ |
| | | private List<SecurityReference> defaultAuth() |
| | | { |
| | | private List<SecurityReference> defaultAuth() { |
| | | AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); |
| | | AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; |
| | | authorizationScopes[0] = authorizationScope; |
| | |
| | | /** |
| | | * 添加摘要信息 |
| | | */ |
| | | private ApiInfo apiInfo() |
| | | { |
| | | private ApiInfo apiInfo() { |
| | | // 用ApiInfoBuilder进行定制 |
| | | return new ApiInfoBuilder() |
| | | // 设置标题 |
| | | .title("标题:若依管理系统_接口文档") |
| | | .title(title) |
| | | // 描述 |
| | | .description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...") |
| | | .description(description) |
| | | // 作者信息 |
| | | .contact(new Contact(ruoyiConfig.getName(), null, null)) |
| | | // 版本 |
| | | .version("版本号:" + ruoyiConfig.getVersion()) |
| | | .version(version) |
| | | .build(); |
| | | } |
| | | } |
| | |
| | | # MyBatis配置 |
| | | # https://baomidou.com/config/ |
| | | mybatis-plus: |
| | | mapperPackage: com.ruoyi.**.mapper |
| | | # 对应的 XML 文件位置 |
| | | mapperLocations: classpath*:mapper/**/*Mapper.xml |
| | | # 实体扫描,多个package用逗号或者分号分隔 |
| | |
| | | enabled: true |
| | | # 请求前缀 |
| | | pathMapping: /dev-api |
| | | # 标题 |
| | | title: '标题:RuoYi-Vue-Plus后台管理系统_接口文档' |
| | | # 描述 |
| | | description: '描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...' |
| | | # 版本 |
| | | version: '版本号: ${ruoyi-vue-plus.version}' |
| | | |
| | | # 防止XSS攻击 |
| | | xss: |
| | |
| | | # 匹配链接 |
| | | urlPatterns: /system/*,/monitor/*,/tool/* |
| | | |
| | | threadPoolConfig: |
| | | # 是否开启线程池 |
| | | enabled: false |
| | | # 核心线程池大小 |
| | | corePoolSize: 8 |
| | | # 最大可创建的线程数 |
| | | maxPoolSize: 16 |
| | | # 队列最大长度 |
| | | queueCapacity: 128 |
| | | # 线程池维护线程所允许的空闲时间 |
| | | keepAliveSeconds: 300 |
| | | # 线程池对拒绝任务(无线程可用)的处理策略 |
| | | # CallerRunsPolicy 等待 |
| | | # DiscardOldestPolicy 放弃最旧的 |
| | | # DiscardPolicy 丢弃 |
| | | # AbortPolicy 中止 |
| | | rejectedExecutionHandler: CallerRunsPolicy |
| | | |
| | | feign: |
| | | package: com.ruoyi.**.feign |
| | | # 开启压缩 |
| | | compression: |
| | | request: |
| | |
| | | Application Version: ${ruoyi.version} |
| | | Application Version: ${ruoyi-vue-plus.version} |
| | | Spring Boot Version: ${spring-boot.version} |
| | | __________ _____.___.__ ____ ____ __________.__ |
| | | \______ \__ __ ____\__ | |__| \ \ / /_ __ ____ \______ \ | __ __ ______ |
| | | | _/ | \/ _ \/ | | | ______ \ Y / | \_/ __ \ ______ | ___/ | | | \/ ___/ |
| | | | | \ | ( <_> )____ | | /_____/ \ /| | /\ ___/ /_____/ | | | |_| | /\___ \ |
| | | |____|_ /____/ \____// ______|__| \___/ |____/ \___ > |____| |____/____//____ > |
| | | \/ \/ \/ \/ |
| | |
| | | super(allowedExtension, extension, filename); |
| | | } |
| | | } |
| | | |
| | | public static class InvalidVideoExtensionException extends InvalidExtensionException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public InvalidVideoExtensionException(String[] allowedExtension, String extension, String filename) |
| | | { |
| | | super(allowedExtension, extension, filename); |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | File desc = new File(uploadDir + File.separator + fileName); |
| | | |
| | | if (!desc.exists()) |
| | | { |
| | | if (!desc.getParentFile().exists()) |
| | | { |
| | | desc.getParentFile().mkdirs(); |
| | | } |
| | | // 解决undertow文件上传bug,因底层实现不同,无需创建新文件 |
| | | // if (!desc.exists()) |
| | | // { |
| | | // desc.createNewFile(); |
| | | // } |
| | | } |
| | | return desc; |
| | | } |
| | | |
| | |
| | | throw new InvalidExtensionException.InvalidMediaExtensionException(allowedExtension, extension, |
| | | fileName); |
| | | } |
| | | else if (allowedExtension == MimeTypeUtils.VIDEO_EXTENSION) |
| | | { |
| | | throw new InvalidExtensionException.InvalidVideoExtensionException(allowedExtension, extension, |
| | | fileName); |
| | | } |
| | | else |
| | | { |
| | | throw new InvalidExtensionException(allowedExtension, extension, fileName); |
| | |
| | | public static final String[] MEDIA_EXTENSION = { "swf", "flv", "mp3", "wav", "wma", "wmv", "mid", "avi", "mpg", |
| | | "asf", "rm", "rmvb" }; |
| | | |
| | | public static final String[] VIDEO_EXTENSION = { "mp4", "avi", "rmvb" }; |
| | | |
| | | public static final String[] DEFAULT_ALLOWED_EXTENSION = { |
| | | // 图片 |
| | | "bmp", "gif", "jpg", "jpeg", "png", |
| | |
| | | "doc", "docx", "xls", "xlsx", "ppt", "pptx", "html", "htm", "txt", |
| | | // 压缩文件 |
| | | "rar", "zip", "gz", "bz2", |
| | | // 视频格式 |
| | | "mp4", "avi", "rmvb", |
| | | // pdf |
| | | "pdf" }; |
| | | |
| | |
| | | package com.ruoyi.framework.config; |
| | | |
| | | import java.util.TimeZone; |
| | | import org.mybatis.spring.annotation.MapperScan; |
| | | import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.context.annotation.EnableAspectJAutoProxy; |
| | | |
| | | import java.util.TimeZone; |
| | | |
| | | /** |
| | | * 程序注解配置 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | @Configuration |
| | | // 表示通过aop框架暴露该代理对象,AopContext能够访问 |
| | | @EnableAspectJAutoProxy(exposeProxy = true) |
| | | // 指定要扫描的Mapper类的包的路径 |
| | | @MapperScan("com.ruoyi.**.mapper") |
| | | public class ApplicationConfig |
| | | { |
| | | public class ApplicationConfig { |
| | | /** |
| | | * 时区配置 |
| | | */ |
| | | @Bean |
| | | public Jackson2ObjectMapperBuilderCustomizer jacksonObjectMapperCustomization() |
| | | { |
| | | public Jackson2ObjectMapperBuilderCustomizer jacksonObjectMapperCustomization() { |
| | | return jacksonObjectMapperBuilder -> jacksonObjectMapperBuilder.timeZone(TimeZone.getDefault()); |
| | | } |
| | | } |
| | |
| | | * |
| | | * @author Lion Li |
| | | */ |
| | | @EnableFeignClients("com.ruoyi.**.feign") |
| | | @EnableFeignClients("${feign.package}") |
| | | @Configuration |
| | | @ConditionalOnClass(Feign.class) |
| | | @AutoConfigureBefore(FeignAutoConfiguration.class) |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor; |
| | | import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; |
| | | import com.ruoyi.framework.mybatisplus.CreateAndUpdateMetaObjectHandler; |
| | | import org.mybatis.spring.annotation.MapperScan; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.transaction.annotation.EnableTransactionManagement; |
| | |
| | | */ |
| | | @EnableTransactionManagement(proxyTargetClass = true) |
| | | @Configuration |
| | | // 指定要扫描的Mapper类的包的路径 |
| | | @MapperScan("${mybatis-plus.mapperPackage}") |
| | | public class MybatisPlusConfig { |
| | | |
| | | @Bean |
| | |
| | | package com.ruoyi.framework.config; |
| | | |
| | | import java.util.concurrent.ScheduledExecutorService; |
| | | import java.util.concurrent.ScheduledThreadPoolExecutor; |
| | | import java.util.concurrent.ThreadPoolExecutor; |
| | | import com.ruoyi.common.utils.Threads; |
| | | import org.apache.commons.lang3.concurrent.BasicThreadFactory; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
| | | import com.ruoyi.common.utils.Threads; |
| | | |
| | | import java.util.concurrent.RejectedExecutionHandler; |
| | | import java.util.concurrent.ScheduledExecutorService; |
| | | import java.util.concurrent.ScheduledThreadPoolExecutor; |
| | | import java.util.concurrent.ThreadPoolExecutor; |
| | | |
| | | /** |
| | | * 线程池配置 |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | **/ |
| | | @Configuration |
| | | public class ThreadPoolConfig |
| | | { |
| | | public class ThreadPoolConfig { |
| | | |
| | | // 核心线程池大小 |
| | | private int corePoolSize = 50; |
| | | @Value("${threadPoolConfig.corePoolSize}") |
| | | private int corePoolSize; |
| | | |
| | | // 最大可创建的线程数 |
| | | private int maxPoolSize = 200; |
| | | @Value("${threadPoolConfig.maxPoolSize}") |
| | | private int maxPoolSize; |
| | | |
| | | // 队列最大长度 |
| | | private int queueCapacity = 1000; |
| | | @Value("${threadPoolConfig.queueCapacity}") |
| | | private int queueCapacity; |
| | | |
| | | // 线程池维护线程所允许的空闲时间 |
| | | private int keepAliveSeconds = 300; |
| | | @Value("${threadPoolConfig.keepAliveSeconds}") |
| | | private int keepAliveSeconds; |
| | | |
| | | // 线程池对拒绝任务(无线程可用)的处理策略 |
| | | @Value("${threadPoolConfig.rejectedExecutionHandler}") |
| | | private String rejectedExecutionHandler; |
| | | |
| | | @Bean(name = "threadPoolTaskExecutor") |
| | | public ThreadPoolTaskExecutor threadPoolTaskExecutor() |
| | | { |
| | | @ConditionalOnProperty(prefix = "threadPoolTaskExecutor", name = "enabled", havingValue = "true") |
| | | public ThreadPoolTaskExecutor threadPoolTaskExecutor() { |
| | | ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); |
| | | executor.setMaxPoolSize(maxPoolSize); |
| | | executor.setCorePoolSize(corePoolSize); |
| | | executor.setQueueCapacity(queueCapacity); |
| | | executor.setKeepAliveSeconds(keepAliveSeconds); |
| | | // 线程池对拒绝任务(无线程可用)的处理策略 |
| | | executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); |
| | | RejectedExecutionHandler handler; |
| | | if (rejectedExecutionHandler.equals("CallerRunsPolicy")) { |
| | | handler = new ThreadPoolExecutor.CallerRunsPolicy(); |
| | | } else if (rejectedExecutionHandler.equals("DiscardOldestPolicy")) { |
| | | handler = new ThreadPoolExecutor.DiscardOldestPolicy(); |
| | | } else if (rejectedExecutionHandler.equals("DiscardPolicy")) { |
| | | handler = new ThreadPoolExecutor.DiscardPolicy(); |
| | | } else { |
| | | handler = new ThreadPoolExecutor.AbortPolicy(); |
| | | } |
| | | executor.setRejectedExecutionHandler(handler); |
| | | return executor; |
| | | } |
| | | |
| | |
| | | * 执行周期性或定时任务 |
| | | */ |
| | | @Bean(name = "scheduledExecutorService") |
| | | protected ScheduledExecutorService scheduledExecutorService() |
| | | { |
| | | protected ScheduledExecutorService scheduledExecutorService() { |
| | | return new ScheduledThreadPoolExecutor(corePoolSize, |
| | | new BasicThreadFactory.Builder().namingPattern("schedule-pool-%d").daemon(true).build()) |
| | | { |
| | | new BasicThreadFactory.Builder().namingPattern("schedule-pool-%d").daemon(true).build()) { |
| | | @Override |
| | | protected void afterExecute(Runnable r, Throwable t) |
| | | { |
| | | protected void afterExecute(Runnable r, Throwable t) { |
| | | super.afterExecute(r, t); |
| | | Threads.printException(r, t); |
| | | } |
| | |
| | | /** |
| | | * 导入表结构(保存) |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('tool:gen:list')") |
| | | @PreAuthorize("@ss.hasPermi('tool:gen:import')") |
| | | @Log(title = "代码生成", businessType = BusinessType.IMPORT) |
| | | @PostMapping("/importTable") |
| | | public AjaxResult importTableSave(String tables) |
| | |
| | | List<SysDept> children = list(new LambdaQueryWrapper<SysDept>() |
| | | .apply("find_in_set({0},ancestors)",deptId)); |
| | | for (SysDept child : children) { |
| | | child.setAncestors(child.getAncestors().replace(oldAncestors, newAncestors)); |
| | | child.setAncestors(child.getAncestors().replaceFirst(oldAncestors, newAncestors)); |
| | | } |
| | | if (children.size() > 0) { |
| | | updateBatchById(children); |
| | |
| | | { |
| | | "name": "ruoyi-vue-plus", |
| | | "version": "1.0.0", |
| | | "version": "1.0.1", |
| | | "description": "RuoYi-Vue-Plus后台管理系统", |
| | | "author": "LionLi", |
| | | "license": "MIT", |
| | |
| | | .el-range-separator { |
| | | box-sizing: content-box; |
| | | } |
| | | |
| | | .el-menu--collapse |
| | | > div |
| | | > .el-submenu |
| | | > .el-submenu__title |
| | | .el-submenu__icon-arrow { |
| | | display: none; |
| | | } |