Commit 511ff0f125046a331432ded53a549c744188816e

Authored by RuoYi
1 parent bf46e38c

优化代码

ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableDataInfo.java
... ... @@ -37,7 +37,7 @@ public class TableDataInfo implements Serializable
37 37 * @param list 列表数据
38 38 * @param total 总记录数
39 39 */
40   - public TableDataInfo(List<?> list, int total)
  40 + public TableDataInfo(List<?> list, long total)
41 41 {
42 42 this.rows = list;
43 43 this.total = total;
... ...
ruoyi-common/src/main/java/com/ruoyi/common/utils/Arith.java
... ... @@ -108,7 +108,6 @@ public class Arith
108 108 "The scale must be a positive integer or zero");
109 109 }
110 110 BigDecimal b = new BigDecimal(Double.toString(v));
111   - BigDecimal one = BigDecimal.ONE;
112   - return b.divide(one, scale, RoundingMode.HALF_UP).doubleValue();
  111 + return b.divide(BigDecimal.ONE, scale, RoundingMode.HALF_UP).doubleValue();
113 112 }
114 113 }
... ...
ruoyi-common/src/main/java/com/ruoyi/common/utils/StringUtils.java
... ... @@ -287,6 +287,32 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
287 287 }
288 288  
289 289 /**
  290 + * 在字符串中查找第一个出现的 `open` 和最后一个出现的 `close` 之间的子字符串
  291 + *
  292 + * @param str 要截取的字符串
  293 + * @param open 起始字符串
  294 + * @param close 结束字符串
  295 + * @return 截取结果
  296 + */
  297 + public static String substringBetweenLast(final String str, final String open, final String close)
  298 + {
  299 + if (isEmpty(str) || isEmpty(open) || isEmpty(close))
  300 + {
  301 + return NULLSTR;
  302 + }
  303 + final int start = str.indexOf(open);
  304 + if (start != INDEX_NOT_FOUND)
  305 + {
  306 + final int end = str.lastIndexOf(close);
  307 + if (end != INDEX_NOT_FOUND)
  308 + {
  309 + return str.substring(start + open.length(), end);
  310 + }
  311 + }
  312 + return NULLSTR;
  313 + }
  314 +
  315 + /**
290 316 * 判断是否为空,并且不是空白字符
291 317 *
292 318 * @param str 要判断的value
... ...
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java
... ... @@ -1448,8 +1448,7 @@ public class ExcelUtil&lt;T&gt;
1448 1448 */
1449 1449 public String encodingFilename(String filename)
1450 1450 {
1451   - filename = UUID.randomUUID() + "_" + filename + ".xlsx";
1452   - return filename;
  1451 + return UUID.randomUUID() + "_" + filename + ".xlsx";
1453 1452 }
1454 1453  
1455 1454 /**
... ...
ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java
... ... @@ -52,7 +52,7 @@ public class LogAspect
52 52 * 处理请求前执行
53 53 */
54 54 @Before(value = "@annotation(controllerLog)")
55   - public void boBefore(JoinPoint joinPoint, Log controllerLog)
  55 + public void doBefore(JoinPoint joinPoint, Log controllerLog)
56 56 {
57 57 TIME_THREADLOCAL.set(System.currentTimeMillis());
58 58 }
... ...
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysPermissionService.java
... ... @@ -70,7 +70,7 @@ public class SysPermissionService
70 70 // 多角色设置permissions属性,以便数据权限匹配权限
71 71 for (SysRole role : roles)
72 72 {
73   - if (StringUtils.equals(role.getStatus(), UserConstants.ROLE_NORMAL))
  73 + if (StringUtils.equals(role.getStatus(), UserConstants.ROLE_NORMAL) && !role.isAdmin())
74 74 {
75 75 Set<String> rolePerms = menuService.selectMenuPermsByRoleId(role.getRoleId());
76 76 role.setPermissions(rolePerms);
... ...
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java
... ... @@ -120,6 +120,7 @@ public class TokenService
120 120  
121 121 Map<String, Object> claims = new HashMap<>();
122 122 claims.put(Constants.LOGIN_USER_KEY, token);
  123 + claims.put(Constants.JWT_USERNAME, loginUser.getUsername());
123 124 return createToken(claims);
124 125 }
125 126  
... ...
ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/JobInvokeUtil.java
... ... @@ -105,7 +105,7 @@ public class JobInvokeUtil
105 105 */
106 106 public static List<Object[]> getMethodParams(String invokeTarget)
107 107 {
108   - String methodStr = StringUtils.substringBetween(invokeTarget, "(", ")");
  108 + String methodStr = StringUtils.substringBetweenLast(invokeTarget, "(", ")");
109 109 if (StringUtils.isEmpty(methodStr))
110 110 {
111 111 return null;
... ...
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
... ... @@ -178,7 +178,6 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
178 178 update sys_user
179 179 <set>
180 180 <if test="deptId != null and deptId != 0">dept_id = #{deptId},</if>
181   - <if test="userName != null and userName != ''">user_name = #{userName},</if>
182 181 <if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
183 182 <if test="email != null ">email = #{email},</if>
184 183 <if test="phonenumber != null ">phonenumber = #{phonenumber},</if>
... ...
ruoyi-ui/src/views/index.vue
1 1 <template>
2 2 <div class="app-container home">
3 3 <el-row :gutter="20">
4   - <el-col :sm="24" :lg="24">
5   - <blockquote class="text-warning" style="font-size: 14px">
6   - 阿里云服务器折扣区<el-link href="http://aly.ruoyi.vip" type="primary" target="_blank">☛☛点我进入☚☚</el-link> &nbsp;&nbsp;&nbsp; 腾讯云服务器秒杀区<el-link href="http://txy.ruoyi.vip" type="primary" target="_blank">☛☛点我进入☚☚</el-link>
7   - </blockquote>
8   - <hr />
9   - </el-col>
10   - </el-row>
11   - <el-row :gutter="20">
12 4 <el-col :sm="24" :lg="12" style="padding-left: 20px">
13 5 <h2>若依后台管理框架</h2>
14 6 <p>
... ...