Kaynağa Gözat

优化代码

RuoYi 1 yıl önce
ebeveyn
işleme
a256618d5d

+ 4 - 4
ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/uuid/UUID.java

@@ -343,25 +343,25 @@ public final class UUID implements java.io.Serializable, Comparable<UUID>
343 343
         final StringBuilder builder = new StringBuilder(isSimple ? 32 : 36);
344 344
         // time_low
345 345
         builder.append(digits(mostSigBits >> 32, 8));
346
-        if (false == isSimple)
346
+        if (!isSimple)
347 347
         {
348 348
             builder.append('-');
349 349
         }
350 350
         // time_mid
351 351
         builder.append(digits(mostSigBits >> 16, 4));
352
-        if (false == isSimple)
352
+        if (!isSimple)
353 353
         {
354 354
             builder.append('-');
355 355
         }
356 356
         // time_high_and_version
357 357
         builder.append(digits(mostSigBits, 4));
358
-        if (false == isSimple)
358
+        if (!isSimple)
359 359
         {
360 360
             builder.append('-');
361 361
         }
362 362
         // variant_and_sequence
363 363
         builder.append(digits(leastSigBits >> 48, 4));
364
-        if (false == isSimple)
364
+        if (!isSimple)
365 365
         {
366 366
             builder.append('-');
367 367
         }

+ 18 - 0
ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/controller/BaseController.java

@@ -7,12 +7,17 @@ import org.slf4j.Logger;
7 7
 import org.slf4j.LoggerFactory;
8 8
 import org.springframework.web.bind.WebDataBinder;
9 9
 import org.springframework.web.bind.annotation.InitBinder;
10
+import com.github.pagehelper.PageHelper;
10 11
 import com.github.pagehelper.PageInfo;
11 12
 import com.ruoyi.common.core.constant.HttpStatus;
12 13
 import com.ruoyi.common.core.utils.DateUtils;
13 14
 import com.ruoyi.common.core.utils.PageUtils;
15
+import com.ruoyi.common.core.utils.StringUtils;
16
+import com.ruoyi.common.core.utils.sql.SqlUtil;
14 17
 import com.ruoyi.common.core.web.domain.AjaxResult;
18
+import com.ruoyi.common.core.web.page.PageDomain;
15 19
 import com.ruoyi.common.core.web.page.TableDataInfo;
20
+import com.ruoyi.common.core.web.page.TableSupport;
16 21
 
17 22
 /**
18 23
  * web层通用数据处理
@@ -49,6 +54,19 @@ public class BaseController
49 54
     }
50 55
 
51 56
     /**
57
+     * 设置请求排序数据
58
+     */
59
+    protected void startOrderBy()
60
+    {
61
+        PageDomain pageDomain = TableSupport.buildPageRequest();
62
+        if (StringUtils.isNotEmpty(pageDomain.getOrderBy()))
63
+        {
64
+            String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
65
+            PageHelper.orderBy(orderBy);
66
+        }
67
+    }
68
+
69
+    /**
52 70
      * 清理分页的线程变量
53 71
      */
54 72
     protected void clearPage()

+ 2 - 10
ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/aspect/PreAuthorizeAspect.java

@@ -56,16 +56,8 @@ public class PreAuthorizeAspect
56 56
         // 注解鉴权
57 57
         MethodSignature signature = (MethodSignature) joinPoint.getSignature();
58 58
         checkMethodAnnotation(signature.getMethod());
59
-        try
60
-        {
61
-            // 执行原有逻辑
62
-            Object obj = joinPoint.proceed();
63
-            return obj;
64
-        }
65
-        catch (Throwable e)
66
-        {
67
-            throw e;
68
-        }
59
+        // 执行原有逻辑
60
+        return joinPoint.proceed();
69 61
     }
70 62
 
71 63
     /**

+ 1 - 1
ruoyi-modules/ruoyi-gen/src/main/java/com/ruoyi/gen/controller/GenController.java

@@ -57,7 +57,7 @@ public class GenController extends BaseController
57 57
     }
58 58
 
59 59
     /**
60
-     * 修改代码生成业务
60
+     * 获取代码生成信息
61 61
      */
62 62
     @RequiresPermissions("tool:gen:query")
63 63
     @GetMapping(value = "/{tableId}")

+ 1 - 1
ruoyi-modules/ruoyi-job/src/main/java/com/ruoyi/job/controller/SysJobController.java

@@ -178,7 +178,7 @@ public class SysJobController extends BaseController
178 178
     @RequiresPermissions("monitor:job:remove")
179 179
     @Log(title = "定时任务", businessType = BusinessType.DELETE)
180 180
     @DeleteMapping("/{jobIds}")
181
-    public AjaxResult remove(@PathVariable Long[] jobIds) throws SchedulerException, TaskException
181
+    public AjaxResult remove(@PathVariable Long[] jobIds) throws SchedulerException
182 182
     {
183 183
         jobService.deleteJobByIds(jobIds);
184 184
         return success();

+ 1 - 2
ruoyi-modules/ruoyi-job/src/main/java/com/ruoyi/job/util/AbstractQuartzJob.java

@@ -3,7 +3,6 @@ package com.ruoyi.job.util;
3 3
 import java.util.Date;
4 4
 import org.quartz.Job;
5 5
 import org.quartz.JobExecutionContext;
6
-import org.quartz.JobExecutionException;
7 6
 import org.slf4j.Logger;
8 7
 import org.slf4j.LoggerFactory;
9 8
 import com.ruoyi.common.core.constant.ScheduleConstants;
@@ -30,7 +29,7 @@ public abstract class AbstractQuartzJob implements Job
30 29
     private static ThreadLocal<Date> threadLocal = new ThreadLocal<>();
31 30
 
32 31
     @Override
33
-    public void execute(JobExecutionContext context) throws JobExecutionException
32
+    public void execute(JobExecutionContext context)
34 33
     {
35 34
         SysJob sysJob = new SysJob();
36 35
         BeanUtils.copyBeanProp(sysJob, context.getMergedJobDataMap().get(ScheduleConstants.TASK_PROPERTIES));

+ 1 - 1
ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -146,6 +146,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
146 146
  		insert into sys_user(
147 147
  			<if test="userId != null and userId != 0">user_id,</if>
148 148
  			<if test="deptId != null and deptId != 0">dept_id,</if>
149
+ 			<if test="userName != null and userName != ''">user_name,</if>
149 150
  			<if test="nickName != null and nickName != ''">nick_name,</if>
150 151
  			<if test="email != null and email != ''">email,</if>
151 152
  			<if test="avatar != null and avatar != ''">avatar,</if>
@@ -177,7 +178,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
177 178
  		update sys_user
178 179
  		<set>
179 180
  			<if test="deptId != null and deptId != 0">dept_id = #{deptId},</if>
180
- 			<if test="userName != null and userName != ''">user_name = #{userName},</if>
181 181
  			<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
182 182
  			<if test="email != null ">email = #{email},</if>
183 183
  			<if test="phonenumber != null ">phonenumber = #{phonenumber},</if>