optimized code

master
RuoYi 2 years ago
parent a606973cbe
commit 356b451b2a

@ -54,12 +54,12 @@ public @interface Excel
public int roundingMode() default BigDecimal.ROUND_HALF_EVEN; public int roundingMode() default BigDecimal.ROUND_HALF_EVEN;
/** /**
* excel * excel
*/ */
public double height() default 14; public double height() default 14;
/** /**
* excel * excel
*/ */
public double width() default 16; public double width() default 16;
@ -109,7 +109,7 @@ public @interface Excel
public ColumnType cellType() default ColumnType.STRING; public ColumnType cellType() default ColumnType.STRING;
/** /**
* *
*/ */
public IndexedColors headerBackgroundColor() default IndexedColors.GREY_50_PERCENT; public IndexedColors headerBackgroundColor() default IndexedColors.GREY_50_PERCENT;
@ -119,7 +119,7 @@ public @interface Excel
public IndexedColors headerColor() default IndexedColors.WHITE; public IndexedColors headerColor() default IndexedColors.WHITE;
/** /**
* *
*/ */
public IndexedColors backgroundColor() default IndexedColors.WHITE; public IndexedColors backgroundColor() default IndexedColors.WHITE;

@ -66,7 +66,7 @@ public final class UUID implements java.io.Serializable, Comparable<UUID>
} }
/** /**
* 4UUID 使线 UUID * 4UUID
* *
* @return {@code UUID} * @return {@code UUID}
*/ */

@ -180,6 +180,16 @@ public class AjaxResult extends HashMap<String, Object>
return Objects.equals(HttpStatus.SUCCESS, this.get(CODE_TAG)); return Objects.equals(HttpStatus.SUCCESS, this.get(CODE_TAG));
} }
/**
*
*
* @return
*/
public boolean isWarn()
{
return Objects.equals(HttpStatus.WARN, this.get(CODE_TAG));
}
/** /**
* *
* *
@ -187,7 +197,7 @@ public class AjaxResult extends HashMap<String, Object>
*/ */
public boolean isError() public boolean isError()
{ {
return !isSuccess(); return Objects.equals(HttpStatus.ERROR, this.get(CODE_TAG));
} }
/** /**

@ -5,6 +5,7 @@ import java.util.List;
import java.util.Set; import java.util.Set;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import com.ruoyi.system.api.domain.SysRole; import com.ruoyi.system.api.domain.SysRole;
import com.ruoyi.system.api.domain.SysUser; import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.service.ISysMenuService; import com.ruoyi.system.service.ISysMenuService;
@ -65,7 +66,7 @@ public class SysPermissionServiceImpl implements ISysPermissionService
else else
{ {
List<SysRole> roles = user.getRoles(); List<SysRole> roles = user.getRoles();
if (!roles.isEmpty() && roles.size() > 1) if (!CollectionUtils.isEmpty(roles))
{ {
// 多角色设置permissions属性以便数据权限匹配权限 // 多角色设置permissions属性以便数据权限匹配权限
for (SysRole role : roles) for (SysRole role : roles)

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 KiB

@ -1,4 +1,3 @@
import { isArray } from 'util'
import { exportDefault, titleCase } from '@/utils/index' import { exportDefault, titleCase } from '@/utils/index'
import { trigger } from './config' import { trigger } from './config'
@ -133,12 +132,12 @@ function buildRules(conf, ruleList) {
const rules = [] const rules = []
if (trigger[conf.tag]) { if (trigger[conf.tag]) {
if (conf.required) { if (conf.required) {
const type = isArray(conf.defaultValue) ? 'type: \'array\',' : '' const type = Array.isArray(conf.defaultValue) ? 'type: \'array\',' : ''
let message = isArray(conf.defaultValue) ? `请至少选择一个${conf.vModel}` : conf.placeholder let message = Array.isArray(conf.defaultValue) ? `请至少选择一个${conf.vModel}` : conf.placeholder
if (message === undefined) message = `${conf.label}不能为空` if (message === undefined) message = `${conf.label}不能为空`
rules.push(`{ required: true, ${type} message: '${message}', trigger: '${trigger[conf.tag]}' }`) rules.push(`{ required: true, ${type} message: '${message}', trigger: '${trigger[conf.tag]}' }`)
} }
if (conf.regList && isArray(conf.regList)) { if (conf.regList && Array.isArray(conf.regList)) {
conf.regList.forEach(item => { conf.regList.forEach(item => {
if (item.pattern) { if (item.pattern) {
rules.push(`{ pattern: ${eval(item.pattern)}, message: '${item.message}', trigger: '${trigger[conf.tag]}' }`) rules.push(`{ pattern: ${eval(item.pattern)}, message: '${item.message}', trigger: '${trigger[conf.tag]}' }`)

@ -180,7 +180,7 @@
<li>升级echarts到最新版本5.4.0</li> <li>升级echarts到最新版本5.4.0</li>
<li>升级core-js到最新版本3.25.3</li> <li>升级core-js到最新版本3.25.3</li>
<li>升级element-ui到最新版本2.15.12</li> <li>升级element-ui到最新版本2.15.12</li>
<li>移除commons-collections多余的依赖</li> <li>移除commons-collections多余的依赖</li>
<li>优化弹窗内容过多展示不全问题</li> <li>优化弹窗内容过多展示不全问题</li>
<li>优化导出对象的子列表为空会出现[]问题</li> <li>优化导出对象的子列表为空会出现[]问题</li>
<li>优化字符未使用下划线不进行驼峰式处理</li> <li>优化字符未使用下划线不进行驼峰式处理</li>
@ -322,7 +322,7 @@
<li>代码生成新增Java类型Boolean</li> <li>代码生成新增Java类型Boolean</li>
<li>定时任务目标字符串过滤特殊字符</li> <li>定时任务目标字符串过滤特殊字符</li>
<li>定时任务目标字符串验证包名白名单</li> <li>定时任务目标字符串验证包名白名单</li>
<li>升级nacos到最新版2.0.4</li> <li>升级nacos到最新版2.0.4</li>
<li>升级spring-cloud到最新版2021.0.0</li> <li>升级spring-cloud到最新版2021.0.0</li>
<li>升级spring-boot到最新版本2.6.3</li> <li>升级spring-boot到最新版本2.6.3</li>
<li>升级spring-boot-admin到最新版2.6.1</li> <li>升级spring-boot-admin到最新版2.6.1</li>
@ -352,17 +352,17 @@
<li>新增tab对象简化页签操作</li> <li>新增tab对象简化页签操作</li>
<li>修改获取缓存信息方式</li> <li>修改获取缓存信息方式</li>
<li>修改权限认证注解实现</li> <li>修改权限认证注解实现</li>
<li>自定义文字复制剪贴指令</li> <li>自定义文字复制剪贴指令</li>
<li>升级axios到最新版本0.24.0</li> <li>升级axios到最新版本0.24.0</li>
<li>升级core-js到最新版本3.19.1</li> <li>升级core-js到最新版本3.19.1</li>
<li>升级jsencrypt到最新版本3.2.1</li> <li>升级jsencrypt到最新版本3.2.1</li>
<li>升级js-cookie到最新版本3.0.1</li> <li>升级js-cookie到最新版本3.0.1</li>
<li>升级clipboard到最新版本2.0.8</li> <li>升级clipboard到最新版本2.0.8</li>
<li>升级velocity到最新版本2.3</li> <li>升级velocity到最新版本2.3</li>
<li>升级spring-boot到最新版本2.5.6</li> <li>升级spring-boot到最新版本2.5.6</li>
<li>升级spring-boot-admin到最新版2.5.4</li> <li>升级spring-boot-admin到最新版2.5.4</li>
<li>升级dynamic-ds到最新版本3.5.0</li> <li>升级dynamic-ds到最新版本3.5.0</li>
<li>代码生成预览支持复制内容</li> <li>代码生成预览支持复制内容</li>
<li>修复五级以上菜单出现的404问题</li> <li>修复五级以上菜单出现的404问题</li>
<li>生产环境使用路由懒加载提升页面响应速度</li> <li>生产环境使用路由懒加载提升页面响应速度</li>
<li>任务屏蔽违规字符&参数忽略双引号中的逗号</li> <li>任务屏蔽违规字符&参数忽略双引号中的逗号</li>
@ -821,7 +821,7 @@
</div> </div>
<div class="body"> <div class="body">
<img <img
src="https://oscimg.oschina.net/oscnet/up-d6695f82666e5018f715c41cb7ee60d3b73.png" src="@/assets/images/pay.png"
alt="donate" alt="donate"
width="100%" width="100%"
/> />

@ -90,9 +90,7 @@ module.exports = {
}) })
.end() .end()
config config.when(process.env.NODE_ENV !== 'development', config => {
.when(process.env.NODE_ENV !== 'development',
config => {
config config
.plugin('ScriptExtHtmlWebpackPlugin') .plugin('ScriptExtHtmlWebpackPlugin')
.after('html') .after('html')
@ -101,36 +99,36 @@ module.exports = {
inline: /runtime\..*\.js$/ inline: /runtime\..*\.js$/
}]) }])
.end() .end()
config
.optimization.splitChunks({ config.optimization.splitChunks({
chunks: 'all', chunks: 'all',
cacheGroups: { cacheGroups: {
libs: { libs: {
name: 'chunk-libs', name: 'chunk-libs',
test: /[\\/]node_modules[\\/]/, test: /[\\/]node_modules[\\/]/,
priority: 10, priority: 10,
chunks: 'initial' // only package third parties that are initially dependent chunks: 'initial' // only package third parties that are initially dependent
}, },
elementUI: { elementUI: {
name: 'chunk-elementUI', // split elementUI into a single package name: 'chunk-elementUI', // split elementUI into a single package
priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app test: /[\\/]node_modules[\\/]_?element-ui(.*)/, // in order to adapt to cnpm
test: /[\\/]node_modules[\\/]_?element-ui(.*)/ // in order to adapt to cnpm priority: 20 // the weight needs to be larger than libs and app or it will be packaged into libs or app
}, },
commons: { commons: {
name: 'chunk-commons', name: 'chunk-commons',
test: resolve('src/components'), // can customize your rules test: resolve('src/components'), // can customize your rules
minChunks: 3, // minimum common number minChunks: 3, // minimum common number
priority: 5, priority: 5,
reuseExistingChunk: true reuseExistingChunk: true
}
} }
}) }
})
config.optimization.runtimeChunk('single'), config.optimization.runtimeChunk('single'),
{ {
from: path.resolve(__dirname, './public/robots.txt'), //防爬虫文件 from: path.resolve(__dirname, './public/robots.txt'), //防爬虫文件
to: './' //到根目录下 to: './' //到根目录下
} }
} })
)
} }
} }

Loading…
Cancel
Save