 v3.8.0版本更新介绍
v3.8.0版本更新介绍
  # 新增配套并同步的Vue3前端版本
https://github.com/yangzongzhuan/RuoYi-Vue3
# 新增通用方法简化模态/缓存/下载/权限/页签使用
ruoyi-ui/src/plugins/index.js
export default {
  install(Vue) {
    // 页签操作
    Vue.prototype.$tab = tab
    // 认证对象
    Vue.prototype.$auth = auth
    // 缓存对象
    Vue.prototype.$cache = cache
    // 模态框对象
    Vue.prototype.$modal = modal
    // 下载文件
    Vue.prototype.$download = download
  }
}
2
3
4
5
6
7
8
9
10
11
12
13
14
如何使用:前端手册-》通用方法 (opens new window)
- $tab对象用于做页签操作、刷新页签、关闭页签、打开页签、修改页签等,
- $modal对象用于做消息提示、通知提示、对话框提醒、二次确认、遮罩
- $auth对象用于验证用户是否拥有某(些)权限或角色
- $cache对象用于处理缓存
- $download对象用于文件下载- ruoyi-ui/src/utils/request.js 通用下载方法 
- // 通用下载方法 export function download(url, params, filename, config) { downloadLoadingInstance = Loading.service({ text: "正在下载数据,请稍候", spinner: "el-icon-loading", background: "rgba(0, 0, 0, 0.7)", }) return service.post(url, params, { transformRequest: [(params) => { return tansParams(params) }], headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, responseType: 'blob', ...config }).then(async (data) => { const isBlob = blobValidate(data); if (isBlob) { const blob = new Blob([data]) saveAs(blob, filename) } else { const resText = await data.text(); const rspObj = JSON.parse(resText); const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default'] Message.error(errMsg); } downloadLoadingInstance.close(); }).catch((r) => { console.error(r) Message.error('下载文件出现错误,请联系管理员!') downloadLoadingInstance.close(); }) }1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 
# Excel注解支持自定义数据处理器
官方文档-》导入导入-》自定义数据处理器 (opens new window)
# Excel注解支持导入导出标题信息
官方文档-》导入导入-》自定义标题信息 (opens new window)
# Excel导入支持@Excels注解
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java
/** 部门对象 */
@Excels({
    @Excel(name = "部门名称", targetAttr = "deptName", type = Type.EXPORT),
    @Excel(name = "部门负责人", targetAttr = "leader", type = Type.EXPORT)
})
private SysDept dept;
2
3
4
5
6
type字段:支持导入和导出的时候。 字段类型(0:导出导入;1:仅导出;2:仅导入)
# 新增组件data-dict,简化数据字典使用
77章节
# 生产环境使用路由懒加载提升页面响应速度
ruoyi-ui/src/store/modules/permission.js
export const loadView = (view) => {
  if (process.env.NODE_ENV === 'development') {
    return (resolve) => require([`@/views/${view}`], resolve)
  } else {
    // 使用 import 实现生产环境的路由懒加载
    return () => import(`@/views/${view}`)
  }
}
2
3
4
5
6
7
8
点击以后才会加载页面,而不是一次性加载所有页面的js。
# 日志注解新增是否保存响应参数
ruoyi-common/src/main/java/com/ruoyi/common/annotation/Log.java
/**
 * 是否保存响应的参数
 */
public boolean isSaveResponseData() default true;
2
3
4
使用注解的时候加上参数即可
@Log(title = "任务调度日志", businessType = BusinessType.EXPORT, isSaveResponseData=false)
# 任务屏蔽违规字符&参数忽略双引号中的逗号
com/ruoyi/quartz/controller/SysJobController.java:101
else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), Constants.JOB_ERROR_STR))
 /**
     * 定时任务违规的字符
     */
    public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
            "org.springframework", "org.apache", "com.ruoyi.common.utils.file", "com.ruoyi.common.config" };
2
3
4
5
com/ruoyi/quartz/util/JobInvokeUtil.java:113
String[] methodParams = methodStr.split(",(?=([^\"']*[\"'][^\"']*[\"'])*[^\"']*$)");
现在是一个正则
# 优化mybatis全局默认的执行器
ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml
    <!-- 全局参数 -->
    <settings>
        <!-- 使全局的映射器启用或禁用缓存 -->
        <setting name="cacheEnabled"             value="true"   />
        <!-- 允许JDBC 支持自动生成主键 -->
        <setting name="useGeneratedKeys"         value="true"   />
        <!-- 配置默认的执行器.SIMPLE就是普通执行器;REUSE执行器会重用预处理语句(prepared statements);BATCH执行器将重用语句并执行批量更新 -->
        <setting name="defaultExecutorType"      value="SIMPLE" />
		<!-- 指定 MyBatis 所用日志的具体实现 -->
        <setting name="logImpl"                  value="SLF4J"  />
        <!-- 使用驼峰命名法转换字段 -->
		<!-- <setting name="mapUnderscoreToCamelCase" value="true"/> -->
	</settings>
2
3
4
5
6
7
8
9
10
11
12
13
改为了SIMPLE
# 修复swagger没有指定dataTypeClass导致启动出现warn日志
示例com/ruoyi/web/controller/tool/TestController.java:50
@ApiImplicitParam中dataTypeClass
 @ApiOperation("获取用户详细")
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class)
@GetMapping("/{userId}")
public R<UserEntity> getUser(@PathVariable Integer userId)
{}
2
3
4
5
