Browse Source

升级SpringBoot到最新版本2.1.1

RuoYi 6 years ago
parent
commit
a74e58f7d5
34 changed files with 133 additions and 37 deletions
  1. 1 1
      pom.xml
  2. 1 1
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysJobController.java
  3. 1 1
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysJobLogController.java
  4. 1 1
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java
  5. 1 1
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java
  6. 1 1
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java
  7. 1 1
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java
  8. 1 1
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java
  9. 1 1
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java
  10. 1 1
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java
  11. 1 1
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java
  12. 1 1
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java
  13. 1 1
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
  14. 1 1
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/GenController.java
  15. 1 1
      ruoyi-admin/src/main/resources/ehcache/ehcache-shiro.xml
  16. 1 1
      ruoyi-admin/src/main/resources/templates/system/dict/data/data.html
  17. 24 0
      ruoyi-common/src/main/java/com/ruoyi/common/exception/BusinessException.java
  18. 1 1
      ruoyi-common/src/main/java/com/ruoyi/common/page/PageDomain.java
  19. 1 1
      ruoyi-common/src/main/java/com/ruoyi/common/page/TableDataInfo.java
  20. 2 1
      ruoyi-common/src/main/java/com/ruoyi/common/utils/ExcelUtil.java
  21. 1 1
      ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/filter/online/OnlineSessionFilter.java
  22. 13 2
      ruoyi-framework/src/main/java/com/ruoyi/framework/web/base/BaseController.java
  23. 13 2
      ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/DefaultExceptionHandler.java
  24. 1 0
      ruoyi-framework/src/main/java/com/ruoyi/framework/web/page/TableSupport.java
  25. 1 1
      ruoyi-quartz/src/main/resources/mapper/quartz/SysJobMapper.xml
  26. 7 0
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java
  27. 3 1
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysLogininforMapper.java
  28. 27 2
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java
  29. 3 2
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java
  30. 3 2
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java
  31. 3 2
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java
  32. 3 2
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
  33. 10 0
      ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml
  34. 1 1
      sql/ry_20181203.sql

+ 1 - 1
pom.xml

@@ -33,7 +33,7 @@
             <dependency>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-dependencies</artifactId>
-                <version>2.0.5.RELEASE</version>
+                <version>2.1.1.RELEASE</version>
                 <type>pom</type>
                 <scope>import</scope>
             </dependency>

+ 1 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysJobController.java

@@ -13,9 +13,9 @@ import org.springframework.web.bind.annotation.ResponseBody;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.base.AjaxResult;
 import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.page.TableDataInfo;
 import com.ruoyi.common.utils.ExcelUtil;
 import com.ruoyi.framework.util.ShiroUtils;
-import com.ruoyi.framework.web.page.TableDataInfo;
 import com.ruoyi.quartz.domain.SysJob;
 import com.ruoyi.quartz.service.ISysJobService;
 import com.ruoyi.framework.web.base.BaseController;

+ 1 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysJobLogController.java

@@ -13,9 +13,9 @@ import org.springframework.web.bind.annotation.ResponseBody;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.base.AjaxResult;
 import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.page.TableDataInfo;
 import com.ruoyi.common.utils.ExcelUtil;
 import com.ruoyi.framework.web.base.BaseController;
-import com.ruoyi.framework.web.page.TableDataInfo;
 import com.ruoyi.quartz.domain.SysJobLog;
 import com.ruoyi.quartz.service.ISysJobLogService;
 

+ 1 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java

@@ -11,8 +11,8 @@ import org.springframework.web.bind.annotation.ResponseBody;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.base.AjaxResult;
 import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.page.TableDataInfo;
 import com.ruoyi.common.utils.ExcelUtil;
-import com.ruoyi.framework.web.page.TableDataInfo;
 import com.ruoyi.system.domain.SysLogininfor;
 import com.ruoyi.system.service.ISysLogininforService;
 import com.ruoyi.framework.web.base.BaseController;

+ 1 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java

@@ -13,8 +13,8 @@ import org.springframework.web.bind.annotation.ResponseBody;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.base.AjaxResult;
 import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.page.TableDataInfo;
 import com.ruoyi.common.utils.ExcelUtil;
-import com.ruoyi.framework.web.page.TableDataInfo;
 import com.ruoyi.system.domain.SysOperLog;
 import com.ruoyi.system.service.ISysOperLogService;
 import com.ruoyi.framework.web.base.BaseController;

+ 1 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java

@@ -13,10 +13,10 @@ import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.base.AjaxResult;
 import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.enums.OnlineStatus;
+import com.ruoyi.common.page.TableDataInfo;
 import com.ruoyi.framework.shiro.session.OnlineSession;
 import com.ruoyi.framework.shiro.session.OnlineSessionDAO;
 import com.ruoyi.framework.util.ShiroUtils;
-import com.ruoyi.framework.web.page.TableDataInfo;
 import com.ruoyi.system.domain.SysUserOnline;
 import com.ruoyi.system.service.impl.SysUserOnlineServiceImpl;
 import com.ruoyi.framework.web.base.BaseController;

+ 1 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java

@@ -13,9 +13,9 @@ import org.springframework.web.bind.annotation.ResponseBody;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.base.AjaxResult;
 import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.page.TableDataInfo;
 import com.ruoyi.common.utils.ExcelUtil;
 import com.ruoyi.framework.util.ShiroUtils;
-import com.ruoyi.framework.web.page.TableDataInfo;
 import com.ruoyi.system.domain.SysConfig;
 import com.ruoyi.system.service.ISysConfigService;
 import com.ruoyi.framework.web.base.BaseController;

+ 1 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java

@@ -13,9 +13,9 @@ import org.springframework.web.bind.annotation.ResponseBody;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.base.AjaxResult;
 import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.page.TableDataInfo;
 import com.ruoyi.common.utils.ExcelUtil;
 import com.ruoyi.framework.util.ShiroUtils;
-import com.ruoyi.framework.web.page.TableDataInfo;
 import com.ruoyi.system.domain.SysDictData;
 import com.ruoyi.system.service.ISysDictDataService;
 import com.ruoyi.framework.web.base.BaseController;

+ 1 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java

@@ -13,9 +13,9 @@ import org.springframework.web.bind.annotation.ResponseBody;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.base.AjaxResult;
 import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.page.TableDataInfo;
 import com.ruoyi.common.utils.ExcelUtil;
 import com.ruoyi.framework.util.ShiroUtils;
-import com.ruoyi.framework.web.page.TableDataInfo;
 import com.ruoyi.system.domain.SysDictType;
 import com.ruoyi.system.service.ISysDictTypeService;
 import com.ruoyi.framework.web.base.BaseController;

+ 1 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java

@@ -13,8 +13,8 @@ import org.springframework.web.bind.annotation.ResponseBody;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.base.AjaxResult;
 import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.page.TableDataInfo;
 import com.ruoyi.framework.util.ShiroUtils;
-import com.ruoyi.framework.web.page.TableDataInfo;
 import com.ruoyi.system.domain.SysNotice;
 import com.ruoyi.system.service.ISysNoticeService;
 import com.ruoyi.framework.web.base.BaseController;

+ 1 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java

@@ -13,9 +13,9 @@ import org.springframework.web.bind.annotation.ResponseBody;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.base.AjaxResult;
 import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.page.TableDataInfo;
 import com.ruoyi.common.utils.ExcelUtil;
 import com.ruoyi.framework.util.ShiroUtils;
-import com.ruoyi.framework.web.page.TableDataInfo;
 import com.ruoyi.system.domain.SysPost;
 import com.ruoyi.system.service.ISysPostService;
 import com.ruoyi.framework.web.base.BaseController;

+ 1 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java

@@ -14,9 +14,9 @@ import org.springframework.web.bind.annotation.ResponseBody;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.base.AjaxResult;
 import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.page.TableDataInfo;
 import com.ruoyi.common.utils.ExcelUtil;
 import com.ruoyi.framework.util.ShiroUtils;
-import com.ruoyi.framework.web.page.TableDataInfo;
 import com.ruoyi.system.domain.SysRole;
 import com.ruoyi.system.service.ISysRoleService;
 import com.ruoyi.framework.web.base.BaseController;

+ 1 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java

@@ -14,11 +14,11 @@ import org.springframework.web.bind.annotation.ResponseBody;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.base.AjaxResult;
 import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.page.TableDataInfo;
 import com.ruoyi.common.utils.ExcelUtil;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.framework.shiro.service.SysPasswordService;
 import com.ruoyi.framework.util.ShiroUtils;
-import com.ruoyi.framework.web.page.TableDataInfo;
 import com.ruoyi.system.domain.SysUser;
 import com.ruoyi.system.service.ISysPostService;
 import com.ruoyi.system.service.ISysRoleService;

+ 1 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/GenController.java

@@ -14,8 +14,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.ResponseBody;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.page.TableDataInfo;
 import com.ruoyi.common.support.Convert;
-import com.ruoyi.framework.web.page.TableDataInfo;
 import com.ruoyi.generator.domain.TableInfo;
 import com.ruoyi.generator.service.IGenService;
 import com.ruoyi.framework.web.base.BaseController;

+ 1 - 1
ruoyi-admin/src/main/resources/ehcache/ehcache-shiro.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<ehcache name="ruoyi">
+<ehcache name="ruoyi" updateCheck="false">
 
     <!-- 磁盘缓存位置 -->
     <diskStore path="java.io.tmpdir"/>

+ 1 - 1
ruoyi-admin/src/main/resources/templates/system/dict/data/data.html

@@ -35,7 +35,7 @@
 			</div>
 			
 	       <div class="btn-group-sm hidden-xs" id="toolbar" role="group">
-	            <a class="btn btn-success" th:onclick="'javascript:$.operate.add(\''+${dict.dictType}+'\')'" shiro:hasPermission="system:dict:add">
+	            <a class="btn btn-success" th:onclick="$.operate.add([[${dict.dictType}]])" shiro:hasPermission="system:dict:add">
 	                <i class="fa fa-plus"></i> 新增
 	            </a>
 	            <a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()" shiro:hasPermission="system:dict:edit">

+ 24 - 0
ruoyi-common/src/main/java/com/ruoyi/common/exception/BusinessException.java

@@ -0,0 +1,24 @@
+package com.ruoyi.common.exception;
+
+/**
+ * 业务异常
+ * 
+ * @author ruoyi
+ */
+public class BusinessException extends RuntimeException
+{
+    private static final long serialVersionUID = 1L;
+
+    protected final String message;
+
+    public BusinessException(String message)
+    {
+        this.message = message;
+    }
+
+    @Override
+    public String getMessage()
+    {
+        return message;
+    }
+}

+ 1 - 1
ruoyi-framework/src/main/java/com/ruoyi/framework/web/page/PageDomain.java → ruoyi-common/src/main/java/com/ruoyi/common/page/PageDomain.java

@@ -1,4 +1,4 @@
-package com.ruoyi.framework.web.page;
+package com.ruoyi.common.page;
 
 import com.ruoyi.common.utils.StringUtils;
 

+ 1 - 1
ruoyi-framework/src/main/java/com/ruoyi/framework/web/page/TableDataInfo.java → ruoyi-common/src/main/java/com/ruoyi/common/page/TableDataInfo.java

@@ -1,4 +1,4 @@
-package com.ruoyi.framework.web.page;
+package com.ruoyi.common.page;
 
 import java.io.Serializable;
 import java.util.List;

+ 2 - 1
ruoyi-common/src/main/java/com/ruoyi/common/utils/ExcelUtil.java

@@ -37,6 +37,7 @@ import org.slf4j.LoggerFactory;
 import com.ruoyi.common.annotation.Excel;
 import com.ruoyi.common.base.AjaxResult;
 import com.ruoyi.common.config.Global;
+import com.ruoyi.common.exception.BusinessException;
 
 /**
  * Excel相关处理
@@ -376,7 +377,7 @@ public class ExcelUtil<T>
         catch (Exception e)
         {
             log.error("导出Excel异常{}", e.getMessage());
-            return AjaxResult.error("导出Excel失败,请联系网站管理员!");
+            throw new BusinessException("导出Excel失败,请联系网站管理员!");
         }
         finally
         {

+ 1 - 1
ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/filter/online/OnlineSessionFilter.java

@@ -83,7 +83,7 @@ public class OnlineSessionFilter extends AccessControlFilter
             subject.logout();
         }
         saveRequestAndRedirectToLogin(request, response);
-        return true;
+        return false;
     }
 
     // 跳转到登录页

+ 13 - 2
ruoyi-framework/src/main/java/com/ruoyi/framework/web/base/BaseController.java

@@ -8,11 +8,11 @@ import org.springframework.web.bind.annotation.InitBinder;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.ruoyi.common.base.AjaxResult;
+import com.ruoyi.common.page.PageDomain;
+import com.ruoyi.common.page.TableDataInfo;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.framework.util.ShiroUtils;
-import com.ruoyi.framework.web.page.PageDomain;
-import com.ruoyi.framework.web.page.TableDataInfo;
 import com.ruoyi.framework.web.page.TableSupport;
 import com.ruoyi.system.domain.SysUser;
 
@@ -79,6 +79,17 @@ public class BaseController
         return rows > 0 ? success() : error();
     }
 
+    /**
+     * 响应返回结果
+     * 
+     * @param result 结果
+     * @return 操作结果
+     */
+    protected AjaxResult toAjax(boolean result)
+    {
+        return result ? success() : error();
+    }
+
     /**
      * 返回成功
      */

+ 13 - 2
ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/DefaultExceptionHandler.java

@@ -7,6 +7,7 @@ import org.springframework.web.HttpRequestMethodNotSupportedException;
 import org.springframework.web.bind.annotation.ExceptionHandler;
 import org.springframework.web.bind.annotation.RestControllerAdvice;
 import com.ruoyi.common.base.AjaxResult;
+import com.ruoyi.common.exception.BusinessException;
 import com.ruoyi.common.exception.DemoModeException;
 import com.ruoyi.framework.util.PermissionUtils;
 
@@ -19,7 +20,7 @@ import com.ruoyi.framework.util.PermissionUtils;
 public class DefaultExceptionHandler
 {
     private static final Logger log = LoggerFactory.getLogger(DefaultExceptionHandler.class);
-    
+
     /**
      * 权限校验失败
      */
@@ -59,7 +60,17 @@ public class DefaultExceptionHandler
         log.error(e.getMessage(), e);
         return AjaxResult.error("服务器错误,请联系管理员");
     }
-    
+
+    /**
+     * 业务异常
+     */
+    @ExceptionHandler(BusinessException.class)
+    public AjaxResult businessException(BusinessException e)
+    {
+        log.error(e.getMessage(), e);
+        return AjaxResult.error(e.getMessage());
+    }
+
     /**
      * 演示模式异常
      */

+ 1 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/web/page/TableSupport.java

@@ -1,6 +1,7 @@
 package com.ruoyi.framework.web.page;
 
 import com.ruoyi.common.constant.Constants;
+import com.ruoyi.common.page.PageDomain;
 import com.ruoyi.framework.util.ServletUtils;
 
 /**

+ 1 - 1
ruoyi-quartz/src/main/resources/mapper/quartz/SysJobMapper.xml

@@ -66,7 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="jobName != null and jobName != ''">job_name = #{jobName},</if>
  			<if test="jobGroup != null and jobGroup != ''">job_group = #{jobGroup},</if>
  			<if test="methodName != null and methodName != ''">method_name = #{methodName},</if>
- 			method_params = #{methodParams},
+ 			<if test="methodParams != null">method_params = #{methodParams},</if>
  			<if test="cronExpression != null and cronExpression != ''">cron_expression = #{cronExpression},</if>
  			<if test="misfirePolicy != null and misfirePolicy != ''">misfire_policy = #{misfirePolicy},</if>
  			<if test="status !=null">status = #{status},</if>

+ 7 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java

@@ -91,4 +91,11 @@ public interface SysDeptMapper
      * @return 部门列表
      */
     public List<String> selectRoleDeptTree(Long roleId);
+
+    /**
+     * 修改所在部门的父级部门状态
+     * 
+     * @param dept 部门
+     */
+    public void updateDeptStatus(SysDept dept);
 }

+ 3 - 1
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysLogininforMapper.java

@@ -29,12 +29,14 @@ public interface SysLogininforMapper
      * 批量删除系统登录日志
      * 
      * @param ids 需要删除的数据
-     * @return
+     * @return 结果
      */
     public int deleteLogininforByIds(String[] ids);
 
     /**
      * 清空系统登录日志
+     * 
+     * @return 结果
      */
     public int cleanLogininfor();
 }

+ 27 - 2
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java

@@ -8,6 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.ruoyi.common.annotation.DataScope;
 import com.ruoyi.common.constant.UserConstants;
+import com.ruoyi.common.exception.BusinessException;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.system.domain.SysDept;
 import com.ruoyi.system.domain.SysRole;
@@ -162,6 +163,11 @@ public class SysDeptServiceImpl implements ISysDeptService
     public int insertDept(SysDept dept)
     {
         SysDept info = deptMapper.selectDeptById(dept.getParentId());
+        // 如果父节点不为"正常"状态,则不允许新增子节点
+        if (!UserConstants.DEPT_NORMAL.equals(info.getStatus()))
+        {
+            throw new BusinessException("部门停用,不允许新增");
+        }
         dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
         return deptMapper.insertDept(dept);
     }
@@ -178,11 +184,30 @@ public class SysDeptServiceImpl implements ISysDeptService
         SysDept info = deptMapper.selectDeptById(dept.getParentId());
         if (StringUtils.isNotNull(info))
         {
-            String ancestors = info.getAncestors() + "," + dept.getParentId();
+            String ancestors = info.getAncestors() + "," + info.getDeptId();
             dept.setAncestors(ancestors);
             updateDeptChildren(dept.getDeptId(), ancestors);
         }
-        return deptMapper.updateDept(dept);
+        int result = deptMapper.updateDept(dept);
+        if (UserConstants.DEPT_NORMAL.equals(dept.getStatus()))
+        {
+            // 如果该部门是启用状态,则启用该部门的所有上级部门
+            updateParentDeptStatus(dept);
+        }
+        return result;
+    }
+
+    /**
+     * 修改该部门的父级部门状态
+     * 
+     * @param dept 当前部门
+     */
+    private void updateParentDeptStatus(SysDept dept)
+    {
+        String updateBy = dept.getUpdateBy();
+        dept = deptMapper.selectDeptById(dept.getDeptId());
+        dept.setUpdateBy(updateBy);
+        deptMapper.updateDeptStatus(dept);
     }
 
     /**

+ 3 - 2
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java

@@ -4,6 +4,7 @@ import java.util.List;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.ruoyi.common.constant.UserConstants;
+import com.ruoyi.common.exception.BusinessException;
 import com.ruoyi.common.support.Convert;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.system.domain.SysDictType;
@@ -79,7 +80,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
      * @return 结果
      */
     @Override
-    public int deleteDictTypeByIds(String ids) throws Exception
+    public int deleteDictTypeByIds(String ids) throws BusinessException
     {
         Long[] dictIds = Convert.toLongArray(ids);
         for (Long dictId : dictIds)
@@ -87,7 +88,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
             SysDictType dictType = selectDictTypeById(dictId);
             if (dictDataMapper.countDictDataByType(dictType.getDictType()) > 0)
             {
-                throw new Exception(String.format("%1$s已分配,不能删除", dictType.getDictName()));
+                throw new BusinessException(String.format("%1$s已分配,不能删除", dictType.getDictName()));
             }
         }
 

+ 3 - 2
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java

@@ -4,6 +4,7 @@ import java.util.List;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.ruoyi.common.constant.UserConstants;
+import com.ruoyi.common.exception.BusinessException;
 import com.ruoyi.common.support.Convert;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.system.domain.SysPost;
@@ -92,7 +93,7 @@ public class SysPostServiceImpl implements ISysPostService
      * @throws Exception
      */
     @Override
-    public int deletePostByIds(String ids) throws Exception
+    public int deletePostByIds(String ids) throws BusinessException
     {
         Long[] postIds = Convert.toLongArray(ids);
         for (Long postId : postIds)
@@ -100,7 +101,7 @@ public class SysPostServiceImpl implements ISysPostService
             SysPost post = selectPostById(postId);
             if (countUserPostById(postId) > 0)
             {
-                throw new Exception(String.format("%1$s已分配,不能删除", post.getPostName()));
+                throw new BusinessException(String.format("%1$s已分配,不能删除", post.getPostName()));
             }
         }
         return postMapper.deletePostByIds(postIds);

+ 3 - 2
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java

@@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.ruoyi.common.annotation.DataScope;
 import com.ruoyi.common.constant.UserConstants;
+import com.ruoyi.common.exception.BusinessException;
 import com.ruoyi.common.support.Convert;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.system.domain.SysRole;
@@ -141,7 +142,7 @@ public class SysRoleServiceImpl implements ISysRoleService
      * @throws Exception
      */
     @Override
-    public int deleteRoleByIds(String ids) throws Exception
+    public int deleteRoleByIds(String ids) throws BusinessException
     {
         Long[] roleIds = Convert.toLongArray(ids);
         for (Long roleId : roleIds)
@@ -149,7 +150,7 @@ public class SysRoleServiceImpl implements ISysRoleService
             SysRole role = selectRoleById(roleId);
             if (countUserRoleByRoleId(roleId) > 0)
             {
-                throw new Exception(String.format("%1$s已分配,不能删除", role.getRoleName()));
+                throw new BusinessException(String.format("%1$s已分配,不能删除", role.getRoleName()));
             }
         }
         return roleMapper.deleteRoleByIds(roleIds);

+ 3 - 2
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java

@@ -6,6 +6,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.ruoyi.common.annotation.DataScope;
 import com.ruoyi.common.constant.UserConstants;
+import com.ruoyi.common.exception.BusinessException;
 import com.ruoyi.common.support.Convert;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.system.domain.SysPost;
@@ -128,14 +129,14 @@ public class SysUserServiceImpl implements ISysUserService
      * @return 结果
      */
     @Override
-    public int deleteUserByIds(String ids) throws Exception
+    public int deleteUserByIds(String ids) throws BusinessException
     {
         Long[] userIds = Convert.toLongArray(ids);
         for (Long userId : userIds)
         {
             if (SysUser.isAdmin(userId))
             {
-                throw new Exception("不允许删除超级管理员用户");
+                throw new BusinessException("不允许删除超级管理员用户");
             }
         }
         return userMapper.deleteUserByIds(userIds);

+ 10 - 0
ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml

@@ -136,5 +136,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	<delete id="deleteDeptById" parameterType="Long">
 		update sys_dept set del_flag = '2' where dept_id = #{deptId}
 	</delete>
+	
+	<update id="updateDeptStatus" parameterType="SysDept">
+ 	    update sys_dept
+ 	    <set>
+ 	        <if test="status != null and status != ''">status = #{status},</if>
+ 	        <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
+ 	        update_time = sysdate()
+        </set>
+ 	    where dept_id in (${ancestors})
+	</update>
 
 </mapper> 

+ 1 - 1
sql/ry_20181203.sql

@@ -588,7 +588,7 @@ create table sys_job_log (
   job_name            varchar(64)   not null                   comment '任务名称',
   job_group           varchar(64)   not null                   comment '任务组名',
   method_name         varchar(500)                             comment '任务方法',
-  method_params       varchar(200)  default ''                 comment '方法参数',
+  method_params       varchar(50)   default null               comment '方法参数',
   job_message         varchar(500)                             comment '日志信息',
   status              char(1)       default '0'                comment '执行状态(0正常 1失败)',
   exception_info      varchar(2000) default ''                 comment '异常信息',