RuoYi 5 vuotta sitten
vanhempi
commit
d066539616
60 muutettua tiedostoa jossa 745 lisäystä ja 121 poistoa
  1. 2 2
      pom.xml
  2. 1 1
      ruoyi-admin/pom.xml
  3. 46 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRegisterController.java
  4. 28 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
  5. 1 1
      ruoyi-admin/src/main/resources/application.yml
  6. 1 0
      ruoyi-admin/src/main/resources/static/i18n/messages.properties
  7. 1 1
      ruoyi-admin/src/main/resources/static/ruoyi/css/ry-ui.css
  8. 2 2
      ruoyi-admin/src/main/resources/static/ruoyi/index.js
  9. 0 1
      ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js
  10. 1 1
      ruoyi-admin/src/main/resources/static/ruoyi/login.js
  11. 82 0
      ruoyi-admin/src/main/resources/static/ruoyi/register.js
  12. 2 2
      ruoyi-admin/src/main/resources/templates/demo/form/summernote.html
  13. 8 8
      ruoyi-admin/src/main/resources/templates/demo/table/search.html
  14. 1 1
      ruoyi-admin/src/main/resources/templates/error/unauth.html
  15. 4 3
      ruoyi-admin/src/main/resources/templates/include.html
  16. 6 7
      ruoyi-admin/src/main/resources/templates/index.html
  17. 5 8
      ruoyi-admin/src/main/resources/templates/login.html
  18. 69 4
      ruoyi-admin/src/main/resources/templates/main.html
  19. 2 1
      ruoyi-admin/src/main/resources/templates/monitor/operlog/operlog.html
  20. 83 0
      ruoyi-admin/src/main/resources/templates/register.html
  21. 1 1
      ruoyi-admin/src/main/resources/templates/skin.html
  22. 4 1
      ruoyi-admin/src/main/resources/templates/system/dict/type/type.html
  23. 1 1
      ruoyi-admin/src/main/resources/templates/system/role/authUser.html
  24. 1 1
      ruoyi-admin/src/main/resources/templates/system/role/role.html
  25. 103 0
      ruoyi-admin/src/main/resources/templates/system/user/authRole.html
  26. 1 1
      ruoyi-admin/src/main/resources/templates/system/user/profile/profile.html
  27. 10 1
      ruoyi-admin/src/main/resources/templates/system/user/user.html
  28. 1 1
      ruoyi-common/pom.xml
  29. 5 0
      ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java
  30. 4 4
      ruoyi-common/src/main/java/com/ruoyi/common/constant/ShiroConstants.java
  31. 6 0
      ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java
  32. 1 1
      ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java
  33. 1 1
      ruoyi-framework/pom.xml
  34. 2 1
      ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java
  35. 2 0
      ruoyi-framework/src/main/java/com/ruoyi/framework/config/ShiroConfig.java
  36. 1 1
      ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/RepeatSubmitInterceptor.java
  37. 2 1
      ruoyi-framework/src/main/java/com/ruoyi/framework/manager/factory/AsyncFactory.java
  38. 1 1
      ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/service/SysPasswordService.java
  39. 80 0
      ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/service/SysRegisterService.java
  40. 2 2
      ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/session/OnlineSessionDAO.java
  41. 1 1
      ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/ConfigService.java
  42. 1 1
      ruoyi-generator/pom.xml
  43. 4 4
      ruoyi-generator/src/main/resources/vm/html/list-tree.html.vm
  44. 6 6
      ruoyi-generator/src/main/resources/vm/html/list.html.vm
  45. 1 1
      ruoyi-quartz/pom.xml
  46. 13 1
      ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobLogController.java
  47. 3 2
      ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobServiceImpl.java
  48. 1 1
      ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/JobInvokeUtil.java
  49. 8 4
      ruoyi-quartz/src/main/resources/templates/monitor/job/job.html
  50. 3 2
      ruoyi-quartz/src/main/resources/templates/monitor/job/jobLog.html
  51. 1 1
      ruoyi-system/pom.xml
  52. 1 0
      ruoyi-system/src/main/java/com/ruoyi/system/domain/SysRole.java
  53. 15 0
      ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUser.java
  54. 9 1
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java
  55. 25 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java
  56. 42 8
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
  57. 4 3
      ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml
  58. 9 5
      ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
  59. 6 2
      ruoyi-system/src/main/resources/mapper/system/SysUserRoleMapper.xml
  60. 18 16
      sql/ry_20200323.sql

+ 2 - 2
pom.xml

@@ -6,14 +6,14 @@
 	
     <groupId>com.ruoyi</groupId>
     <artifactId>ruoyi</artifactId>
-    <version>4.1.0</version>
+    <version>4.2.0</version>
 
     <name>ruoyi</name>
 	<url>http://www.ruoyi.vip</url>
     <description>若依管理系统</description>
     
     <properties>
-	    <ruoyi.version>4.1.0</ruoyi.version>
+	    <ruoyi.version>4.2.0</ruoyi.version>
 		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
 		<java.version>1.8</java.version>

+ 1 - 1
ruoyi-admin/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>ruoyi</artifactId>
         <groupId>com.ruoyi</groupId>
-        <version>4.1.0</version>
+        <version>4.2.0</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 	<packaging>jar</packaging>

+ 46 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRegisterController.java

@@ -0,0 +1,46 @@
+package com.ruoyi.web.controller.system;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.framework.shiro.service.SysRegisterService;
+import com.ruoyi.system.domain.SysUser;
+import com.ruoyi.system.service.ISysConfigService;
+
+/**
+ * 注册验证
+ * 
+ * @author ruoyi
+ */
+@Controller
+public class SysRegisterController extends BaseController
+{
+    @Autowired
+    private SysRegisterService registerService;
+
+    @Autowired
+    private ISysConfigService configService;
+
+    @GetMapping("/register")
+    public String register()
+    {
+        return "register";
+    }
+
+    @PostMapping("/register")
+    @ResponseBody
+    public AjaxResult ajaxRegister(SysUser user)
+    {
+        if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser"))))
+        {
+            return error("当前系统没有开启注册功能!");
+        }
+        String msg = registerService.register(user);
+        return StringUtils.isEmpty(msg) ? success() : error(msg);
+    }
+}

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

@@ -22,6 +22,7 @@ import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.shiro.service.SysPasswordService;
 import com.ruoyi.framework.util.ShiroUtils;
 import com.ruoyi.system.domain.SysUser;
+import com.ruoyi.system.domain.SysUserRole;
 import com.ruoyi.system.service.ISysPostService;
 import com.ruoyi.system.service.ISysRoleService;
 import com.ruoyi.system.service.ISysUserService;
@@ -200,6 +201,33 @@ public class SysUserController extends BaseController
         return error();
     }
 
+    /**
+     * 进入授权角色页
+     */
+    @GetMapping("/authRole/{userId}")
+    public String authRole(@PathVariable("userId") Long userId, ModelMap mmap)
+    {
+        SysUser user = userService.selectUserById(userId);
+        // 获取用户所属的角色列表
+        List<SysUserRole> userRoles = userService.selectUserRoleByUserId(userId);
+        mmap.put("user", user);
+        mmap.put("userRoles", userRoles);
+        return prefix + "/authRole";
+    }
+
+    /**
+     * 用户授权角色
+     */
+    @RequiresPermissions("system:user:add")
+    @Log(title = "用户管理", businessType = BusinessType.GRANT)
+    @PostMapping("/authRole/insertAuthRole")
+    @ResponseBody
+    public AjaxResult insertAuthRole(Long userId, Long[] roleIds)
+    {
+        userService.insertUserAuth(userId, roleIds);
+        return success();
+    }
+
     @RequiresPermissions("system:user:remove")
     @Log(title = "用户管理", businessType = BusinessType.DELETE)
     @PostMapping("/remove")

+ 1 - 1
ruoyi-admin/src/main/resources/application.yml

@@ -3,7 +3,7 @@ ruoyi:
   # 名称
   name: RuoYi
   # 版本
-  version: 4.1.0
+  version: 4.2.0
   # 版权年份
   copyrightYear: 2019
   # 实例演示开关

+ 1 - 0
ruoyi-admin/src/main/resources/static/i18n/messages.properties

@@ -18,6 +18,7 @@ user.password.not.valid=* 5-50个字符
 user.email.not.valid=邮箱格式错误
 user.mobile.phone.number.not.valid=手机号格式错误
 user.login.success=登录成功
+user.register.success=注册成功
 user.notfound=请重新登录
 user.forcelogout=管理员强制退出,请重新登录
 user.unknown.error=未知错误,请重新登录

+ 1 - 1
ruoyi-admin/src/main/resources/static/ruoyi/css/ry-ui.css

@@ -644,7 +644,7 @@ label {
 	margin: 5px 15px 5px 0px;
 }
 
-.select-list li p, .select-list li label{
+.select-list li p, .select-list li label:not(.radio-box){
 	float: left;
 	width: 65px;
 	margin: 5px 5px 5px 0px;

+ 2 - 2
ruoyi-admin/src/main/resources/static/ruoyi/index.js

@@ -13,10 +13,10 @@ $(function() {
     // MetsiMenu
     $('#side-menu').metisMenu();
 
-    //固定菜单栏
+    // 固定菜单栏
     $(function() {
         $('.sidebar-collapse').slimScroll({
-            height: '100%',
+            height: '96%',
             railOpacity: 0.9,
             alwaysVisible: false
         });

+ 0 - 1
ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js

@@ -359,7 +359,6 @@ var table = {
     			} else{
     				$("#" + table.options.id).bootstrapTable('refresh', params);
     			}
-    		    data = {};
     		},
     		// 导出数据
     		exportExcel: function(formId) {

+ 1 - 1
ruoyi-admin/src/main/resources/static/ruoyi/login.js

@@ -26,7 +26,7 @@ function login() {
         data: {
             "username": username,
             "password": password,
-            "validateCode" : validateCode,
+            "validateCode": validateCode,
             "rememberMe": rememberMe
         },
         success: function(r) {

+ 82 - 0
ruoyi-admin/src/main/resources/static/ruoyi/register.js

@@ -0,0 +1,82 @@
+
+$(function() {
+    validateRule();
+    $('.imgcode').click(function() {
+		var url = ctx + "captcha/captchaImage?type=" + captchaType + "&s=" + Math.random();
+		$(".imgcode").attr("src", url);
+	});
+});
+
+$.validator.setDefaults({
+    submitHandler: function() {
+    	register();
+    }
+});
+
+function register() {
+	$.modal.loading($("#btnSubmit").data("loading"));
+	var username = $.common.trim($("input[name='username']").val());
+    var password = $.common.trim($("input[name='password']").val());
+    var validateCode = $("input[name='validateCode']").val();
+    $.ajax({
+        type: "post",
+        url: ctx + "register",
+        data: {
+            "loginName": username,
+            "password": password,
+            "validateCode": validateCode
+        },
+        success: function(r) {
+            if (r.code == 0) {
+            	layer.alert("<font color='red'>恭喜你,您的账号 " + username + " 注册成功!</font>", {
+        	        icon: 1,
+        	        title: "系统提示"
+        	    },
+        	    function(index) {
+        	        //关闭弹窗
+        	        layer.close(index);
+        	        location.href = ctx + 'login';
+        	    });
+            } else {
+            	$.modal.closeLoading();
+            	$('.imgcode').click();
+            	$(".code").val("");
+            	$.modal.msg(r.msg);
+            }
+        }
+    });
+}
+
+function validateRule() {
+	var icon = "<i class='fa fa-times-circle'></i> ";
+    $("#registerForm").validate({
+        rules: {
+            username: {
+                required: true,
+                minlength: 2
+            },
+            password: {
+                required: true,
+                minlength: 5
+            },
+            confirmPassword: {
+                required: true,
+                equalTo: "[name='password']"
+            }
+        },
+        messages: {
+            username: {
+                required: icon + "请输入您的用户名",
+                minlength: icon + "用户名不能小于2个字符"
+            },
+            password: {
+            	required: icon + "请输入您的密码",
+                minlength: icon + "密码不能小于5个字符",
+            },
+            confirmPassword: {
+                required: icon + "请再次输入您的密码",
+                equalTo: icon + "两次密码输入不一致"
+            }
+        }
+    })
+}

+ 2 - 2
ruoyi-admin/src/main/resources/templates/demo/form/summernote.html

@@ -17,7 +17,7 @@
                             <h2>若依后台管理系统</h2>
                             <p>ruoyi是一个完全响应式,基于Bootstrap3.3.6最新版本开发的扁平化主题,她采用了主流的左右两栏式布局,使用了Html5+CSS3等现代技术,她提供了诸多的强大的可以重新组合的UI组件,并集成了最新的jQuery版本(v2.1.1),当然,也集成了很多功能强大,用途广泛的就jQuery插件,她可以用于所有的Web应用程序,如<b>网站管理后台</b>,<b>网站会员中心</b>,<b>CMS</b>,<b>CRM</b>,<b>OA</b>等等,当然,您也可以对她进行深度定制,以做出更强系统。</p>
                             <p>
-                                <b>当前版本:</b>v4.1.0
+                                <b>当前版本:</b>v4.2.0
                             </p>
                             <p>
                                 <span class="label label-warning">免费开源</span>
@@ -56,7 +56,7 @@
                             <h3>你好,若依 </h3>
                             <p>H+是一个完全响应式,基于Bootstrap3.3.6最新版本开发的扁平化主题,她采用了主流的左右两栏式布局,使用了Html5+CSS3等现代技术,她提供了诸多的强大的可以重新组合的UI组件,并集成了最新的jQuery版本(v2.1.1),当然,也集成了很多功能强大,用途广泛的就jQuery插件,她可以用于所有的Web应用程序,如<b>网站管理后台</b>,<b>网站会员中心</b>,<b>CMS</b>,<b>CRM</b>,<b>OA</b>等等,当然,您也可以对她进行深度定制,以做出更强系统。</p>
                             <p>
-                                <b>当前版本:</b>v4.1.0
+                                <b>当前版本:</b>v4.2.0
                             </p>
                             <p>
                                 <span class="label label-warning">开源免费</span>

+ 8 - 8
ruoyi-admin/src/main/resources/templates/demo/table/search.html

@@ -97,19 +97,19 @@
 					<div class="select-list">
 						<ul>
 							<li>
-								<p style="width: 80px">商户编号:</p>
+								<label style="width: 80px">商户编号:</label>
 								<input type="text" name="userId"/>
 							</li>
 							<li>
-								<p style="width: 80px">订单号:</p>
+								<label style="width: 80px">订单号:</label>
 								<input type="text" name="orderNo"/>
 							</li>
 							<li>
-								<p style="width: 80px">日期:</p>
+								<label style="width: 80px">日期:</label>
 								<input type="text" class="time-input" placeholder="日期"/>
 							</li>
 							<li class="select-selectpicker">
-								<p style="width: 80px">状态:</p>
+								<label style="width: 80px">状态:</label>
 								<select class="selectpicker" data-none-selected-text="请选择" multiple>
 									<option value="">所有</option>
 									<option value="0">初始</option>
@@ -119,7 +119,7 @@
 								</select>
 							</li>
 							<li>
-								<p style="width: 80px">供货商通道:</p>
+								<label style="width: 80px">供货商通道:</label>
 								<select>
 									<option value="">所有</option>
 									<option value="0">腾讯</option>
@@ -128,7 +128,7 @@
 								</select>
 							</li>
 							<li>
-								<p style="width: 80px">来源:</p>
+								<label style="width: 80px">来源:</label>
 								<select>
 									<option value="">所有</option>
 									<option value="0">手机</option>
@@ -137,7 +137,7 @@
 								</select>
 							</li>
 							<li>
-								<p style="width: 80px">运营商:</p>
+								<label style="width: 80px">运营商:</label>
 								<select>
 									<option value="">所有</option>
 									<option value="0">移动</option>
@@ -146,7 +146,7 @@
 								</select>
 							</li>
 							<li class="select-time">
-								<p style="width: 80px">回调时间:</p>
+								<label style="width: 80px">回调时间:</label>
 								<input type="text" class="time-input" placeholder="开始时间"/>
 								<span>-</span>
 								<input type="text" class="time-input" placeholder="结束时间"/>

+ 1 - 1
ruoyi-admin/src/main/resources/templates/error/unauth.html

@@ -15,7 +15,7 @@
 
         <div class="error-desc">
                                 对不起,您没有访问权限,请不要进行非法操作!您可以返回主页面
-            <a th:href="javascript:index()" class="btn btn-outline btn-primary btn-xs">返回主页</a>
+            <a href="javascript:index()" class="btn btn-outline btn-primary btn-xs">返回主页</a>
         </div>
     </div>
     <script th:inline="javascript">

+ 4 - 3
ruoyi-admin/src/main/resources/templates/include.html

@@ -2,6 +2,7 @@
 <head th:fragment=header(title)>
 	<meta charset="utf-8">
 	<meta name="viewport" content="width=device-width, initial-scale=1.0">
+	<meta http-equiv="X-UA-Compatible" content="IE=edge">
 	<meta name="keywords" content="">
 	<meta name="description" content="">
 	<title th:text="${title}"></title>
@@ -17,6 +18,7 @@
 
 <!-- 通用JS -->
 <div th:fragment="footer">
+    <a id="scroll-up" href="#" class="btn btn-sm display"><i class="fa fa-angle-double-up"></i></a>
 	<script th:src="@{/js/jquery.min.js}"></script>
 	<script th:src="@{/js/bootstrap.min.js}"></script>
 	<!-- bootstrap-table 表格插件 -->
@@ -39,10 +41,9 @@
     <script th:src="@{/ajax/libs/iCheck/icheck.min.js}"></script>
 	<script th:src="@{/ajax/libs/layer/layer.min.js}"></script>
 	<script th:src="@{/ajax/libs/layui/layui.js}"></script>
-	<script th:src="@{/ruoyi/js/common.js?v=4.1.0}"></script>
-	<script th:src="@{/ruoyi/js/ry-ui.js?v=4.1.0}"></script>
+	<script th:src="@{/ruoyi/js/common.js?v=4.2.0}"></script>
+	<script th:src="@{/ruoyi/js/ry-ui.js?v=4.2.0}"></script>
 	<script th:inline="javascript"> var ctx = [[@{/}]]; </script>
-	<a id="scroll-up" href="#" class="btn btn-sm display"><i class="fa fa-angle-double-up"></i></a>
 </div>
 
 <!-- ztree树插件 -->

+ 6 - 7
ruoyi-admin/src/main/resources/templates/index.html

@@ -5,9 +5,8 @@
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
     <meta name="renderer" content="webkit">
     <title>若依系统首页</title>
-    <!--[if lt IE 9]>
-    <meta http-equiv="refresh" content="0;ie.html"/>
-    <![endif]-->
+    <!-- 避免IE使用兼容模式 -->
+ 	<meta http-equiv="X-UA-Compatible" content="IE=edge">
     <link th:href="@{favicon.ico}" rel="stylesheet"/>
     <link th:href="@{/css/bootstrap.min.css}" rel="stylesheet"/>
     <link th:href="@{/css/jquery.contextMenu.min.css}" rel="stylesheet"/>
@@ -15,7 +14,7 @@
     <link th:href="@{/css/animate.css}" rel="stylesheet"/>
     <link th:href="@{/css/style.css}" rel="stylesheet"/>
     <link th:href="@{/css/skins.css}" rel="stylesheet"/>
-    <link th:href="@{/ruoyi/css/ry-ui.css?v=4.1.0}" rel="stylesheet"/>
+    <link th:href="@{/ruoyi/css/ry-ui.css?v=4.2.0}" rel="stylesheet"/>
 </head>
 <body class="fixed-sidebar full-height-layout gray-bg" style="overflow: hidden">
 <div id="wrapper">
@@ -187,7 +186,7 @@
                     <li class="dropdown user-menu">
 						<a href="javascript:void(0)" class="dropdown-toggle" data-hover="dropdown">
 							<img th:src="(${user.avatar} == '') ? @{/img/profile.jpg} : @{${user.avatar}}" class="user-image">
-							<span class="hidden-xs">[[${user.userName}]]</span>
+							<span class="hidden-xs">[[${#strings.defaultString(user.userName, '-')}]]</span>
 						</a>
 						<ul class="dropdown-menu">
 							<li class="mt5">
@@ -247,8 +246,8 @@
 <script th:src="@{/js/jquery.contextMenu.min.js}"></script>
 <script th:src="@{/ajax/libs/blockUI/jquery.blockUI.js}"></script>
 <script th:src="@{/ajax/libs/layer/layer.min.js}"></script>
-<script th:src="@{/ruoyi/js/ry-ui.js?v=4.1.0}"></script>
-<script th:src="@{/ruoyi/js/common.js?v=4.1.0}"></script>
+<script th:src="@{/ruoyi/js/ry-ui.js?v=4.2.0}"></script>
+<script th:src="@{/ruoyi/js/common.js?v=4.2.0}"></script>
 <script th:src="@{/ruoyi/index.js}"></script>
 <script th:src="@{/ajax/libs/fullscreen/jquery.fullscreen.js}"></script>
 <script th:inline="javascript">

+ 5 - 8
ruoyi-admin/src/main/resources/templates/login.html

@@ -3,14 +3,13 @@
 <head>
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
-    
     <title>登录若依系统</title>
     <meta name="description" content="若依后台管理框架">
     <link href="../static/css/bootstrap.min.css" th:href="@{/css/bootstrap.min.css}" rel="stylesheet"/>
     <link href="../static/css/font-awesome.min.css" th:href="@{/css/font-awesome.min.css}" rel="stylesheet"/>
     <link href="../static/css/style.css" th:href="@{/css/style.css}" rel="stylesheet"/>
     <link href="../static/css/login.min.css" th:href="@{/css/login.min.css}" rel="stylesheet"/>
-    <link href="../static/ruoyi/css/ry-ui.css" th:href="@{/ruoyi/css/ry-ui.css?v=4.1.0}" rel="stylesheet"/>
+    <link href="../static/ruoyi/css/ry-ui.css" th:href="@{/ruoyi/css/ry-ui.css?v=4.2.0}" rel="stylesheet"/>
     <!-- 360浏览器急速模式 -->
     <meta name="renderer" content="webkit">
     <!-- 避免IE使用兼容模式 -->
@@ -21,9 +20,7 @@
         if(window.top!==window.self){alert('未登录或登录超时。请重新登录');window.top.location=window.location};
     </script>
 </head>
-
 <body class="signin">
-
     <div class="signinpanel">
         <div class="row">
             <div class="col-sm-7">
@@ -40,18 +37,18 @@
                         <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> Thymeleaf</li>
                         <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> Bootstrap</li>
                     </ul>
-                    <strong>还没有账号? <a href="#">立即注册&raquo;</a></strong>
+                    <strong th:if="${@config.getKey('sys.account.registerUser')}">还没有账号? <a th:href="@{/register}">立即注册&raquo;</a></strong>
                 </div>
             </div>
             <div class="col-sm-5">
-                <form id="signupForm">
+                <form id="signupForm" autocomplete="off">
                     <h4 class="no-margins">登录:</h4>
                     <p class="m-t-md">你若不离不弃,我必生死相依</p>
                     <input type="text"     name="username" class="form-control uname"     placeholder="用户名" value="admin"    />
                     <input type="password" name="password" class="form-control pword"     placeholder="密码"   value="admin123" />
 					<div class="row m-t" th:if="${captchaEnabled==true}">
 						<div class="col-xs-6">
-						    <input type="text" name="validateCode" class="form-control code" placeholder="验证码" maxlength="5" autocomplete="off">
+						    <input type="text" name="validateCode" class="form-control code" placeholder="验证码" maxlength="5" />
 						</div>
 						<div class="col-xs-6">
 							<a href="javascript:void(0);" title="点击更换验证码">
@@ -81,7 +78,7 @@
 <script src="../static/ajax/libs/validate/messages_zh.min.js" th:src="@{/ajax/libs/validate/messages_zh.min.js}"></script>
 <script src="../static/ajax/libs/layer/layer.min.js" th:src="@{/ajax/libs/layer/layer.min.js}"></script>
 <script src="../static/ajax/libs/blockUI/jquery.blockUI.js" th:src="@{/ajax/libs/blockUI/jquery.blockUI.js}"></script>
-<script src="../static/ruoyi/js/ry-ui.js" th:src="@{/ruoyi/js/ry-ui.js?v=4.1.0}"></script>
+<script src="../static/ruoyi/js/ry-ui.js" th:src="@{/ruoyi/js/ry-ui.js?v=4.2.0}"></script>
 <script src="../static/ruoyi/login.js" th:src="@{/ruoyi/login.js}"></script>
 </body>
 </html>

+ 69 - 4
ruoyi-admin/src/main/resources/templates/main.html

@@ -96,13 +96,78 @@
                     <div class="ibox-content no-padding">
                         <div class="panel-body">
                             <div class="panel-group" id="version">
+                            <div class="panel panel-default">
+								<div class="panel-heading">
+								   <h5 class="panel-title">
+									   <a data-toggle="collapse" data-parent="#version" href="#v42">v4.2.0</a><code class="pull-right">2020.03.23</code>
+								   </h5>
+								</div>
+								<div id="v42" class="panel-collapse collapse in">
+									<div class="panel-body">
+									   <ol>
+									        <li>用户管理添加分配角色页面</li>
+									        <li>定时任务添加调度日志按钮</li>
+									        <li>新增是否开启用户注册功能</li>
+											<li>新增页面滚动显示返回顶部按钮</li>
+											<li>用户&角色&任务添加更多操作按钮</li>
+											<li>iframe框架页会话过期弹出超时提示</li>
+											<li>移动端登录不显示左侧菜单</li>
+											<li>侧边栏添加一套深蓝色主题</li>
+											<li>首页logo固定,不随菜单滚动</li>
+											<li>支持mode配置history(表示去掉地址栏的#)</li>
+											<li>任务分组字典翻译(调度日志详细)</li>
+											<li>字典管理添加缓存读取</li>
+											<li>字典数据列表标签显示样式</li>
+											<li>参数管理支持缓存操作</li>
+											<li>日期控件清空结束时间设置开始默认值为2099-12-31</li>
+											<li>表格树添加获取数据后响应回调处理</li>
+											<li>批量替换表前缀调整</li>
+											<li>支持表格导入模板的弹窗表单加入其它输入控件</li>
+											<li>表单重置刷新表格树</li>
+											<li>新增支持导出数据字段排序</li>
+											<li>新增表格参数(是否单选checkbox)</li>
+											<li>druid未授权不允许访问</li>
+											<li>表格树父节点兼容0,'0','',null</li>
+											<li>表单必填的项添加星号</li>
+											<li>修复select2不显示校验错误信息</li>
+											<li>添加自定义HTML过滤器</li>
+											<li>修复多数据源下开关关闭出现异常问题</li>
+											<li>修复翻页记住选择项数据问题</li>
+											<li>用户邮箱长度限制20</li>
+											<li>修改错误页面返回主页出现嵌套问题</li>
+											<li>表格浮动提示单双引号转义</li>
+											<li>支持配置四级菜单</li>
+											<li>升级shiro到最新版1.4.2 阻止rememberMe漏洞攻击</li>
+											<li>升级summernote到最新版本v0.8.12</li>
+											<li>导入Excel根据dateFormat属性格式处理</li>
+											<li>修复War部署无法正常shutdown,ehcache内存泄漏</li>
+											<li>修复代码生成短字段无法识别问题</li>
+											<li>修复serviceImpl模版,修改方法判断日期错误</li>
+											<li>代码生成模板增加导出功能日志记录</li>
+											<li>代码生成唯一编号调整为tableId</li>
+											<li>代码生成查询时忽略大小写</li>
+											<li>代码生成支持翻页记住选中</li>
+											<li>代码生成表注释未填写也允许导入</li>
+											<li>Global全局配置类修改为注解,防止多环境配置下读取问题</li>
+											<li>修复多表格情况下,firstLoad只对第一个表格生效</li>
+											<li>处理Maven打包出现警告问题</li>
+											<li>默认主题样式,防止网速慢情况下出现空白</li>
+											<li>修复文件上传多级目录识别问题</li>
+											<li>锚链接解码url,防止中文导致页面不能加载问题</li>
+											<li>修复右键Tab页刷新事件重复请求问题</li>
+											<li>角色禁用&菜单隐藏不查询权限</li>
+											<li>其他细节优化</li>
+										</ol>
+									</div>
+								</div>
+							</div>
                             <div class="panel panel-default">
 								<div class="panel-heading">
 								   <h5 class="panel-title">
 									   <a data-toggle="collapse" data-parent="#version" href="#v41">v4.1.0</a><code class="pull-right">2019.10.22</code>
 								   </h5>
 								</div>
-								<div id="v41" class="panel-collapse collapse in">
+								<div id="v41" class="panel-collapse collapse">
 									<div class="panel-body">
 									   <ol>
 									        <li>支持多表格实例操作</li>
@@ -142,7 +207,7 @@
 										</ol>
 									</div>
 								</div>
-							 </div>
+							</div>
                             <div class="panel panel-default">
 								<div class="panel-heading">
 								   <h5 class="panel-title">
@@ -203,8 +268,8 @@
 											<li>其他细节优化</li>
 										</ol>
 									</div>
-								</div>
-							 </div>
+							    </div>
+							</div>
                             <div class="panel panel-default">
 								<div class="panel-heading">
 								   <h5 class="panel-title">

+ 2 - 1
ruoyi-admin/src/main/resources/templates/monitor/operlog/operlog.html

@@ -155,8 +155,9 @@
 		}
 		
 		function resetPre() {
-			$.form.reset();
+			$("#operlog-form")[0].reset();
 			$("#businessTypes").selectpicker('refresh');
+			$.table.search('operlog-form', 'bootstrap-table');
 		}
 	</script>
 </body>

+ 83 - 0
ruoyi-admin/src/main/resources/templates/register.html

@@ -0,0 +1,83 @@
+<!DOCTYPE html>
+<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
+<head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
+    <title>注册若依系统</title>
+    <meta name="description" content="若依后台管理框架">
+    <link href="../static/css/bootstrap.min.css" th:href="@{/css/bootstrap.min.css}" rel="stylesheet"/>
+    <link href="../static/css/font-awesome.min.css" th:href="@{/css/font-awesome.min.css}" rel="stylesheet"/>
+    <link href="../static/css/style.css" th:href="@{/css/style.css}" rel="stylesheet"/>
+    <link href="../static/css/login.min.css" th:href="@{/css/login.min.css}" rel="stylesheet"/>
+    <link href="../static/ruoyi/css/ry-ui.css" th:href="@{/ruoyi/css/ry-ui.css?v=4.2.0}" rel="stylesheet"/>
+    <!-- 360浏览器急速模式 -->
+    <meta name="renderer" content="webkit">
+    <!-- 避免IE使用兼容模式 -->
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <link rel="shortcut icon" href="../static/favicon.ico" th:href="@{favicon.ico}"/>
+    <style type="text/css">label.error { position:inherit;  }</style>
+</head>
+<body class="signin">
+    <div class="signinpanel">
+        <div class="row">
+            <div class="col-sm-7">
+                <div class="signin-info">
+                    <div class="logopanel m-b">
+                        <h1><img alt="[ 若依 ]" src="../static/ruoyi.png" th:src="@{/ruoyi.png}"></h1>
+                    </div>
+                    <div class="m-b"></div>
+                    <h4>欢迎使用 <strong>若依 后台管理系统</strong></h4>
+                    <ul class="m-b">
+                        <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> SpringBoot</li>
+                        <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> Mybatis</li>
+                        <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> Shiro</li>
+                        <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> Thymeleaf</li>
+                        <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> Bootstrap</li>
+                    </ul>
+                    <strong>已经注册过? <a th:href="@{/login}">直接登录&raquo;</a></strong>
+                </div>
+            </div>
+            <div class="col-sm-5">
+                <form id="registerForm" autocomplete="off">
+                    <h4 class="no-margins">注册:</h4>
+                    <p class="m-t-md">你若不离不弃,我必生死相依</p>
+                    <input type="text"     name="username" class="form-control uname"         placeholder="用户名"   maxlength="20" />
+                    <input type="password" name="password" class="form-control pword"         placeholder="密码"     maxlength="20" />
+                    <input type="password" name="confirmPassword" class="form-control pword"  placeholder="确认密码" maxlength="20" />
+					<div class="row m-t" th:if="${captchaEnabled==true}">
+						<div class="col-xs-6">
+						    <input type="text" name="validateCode" class="form-control code"  placeholder="验证码"   maxlength="5" >
+						</div>
+						<div class="col-xs-6">
+							<a href="javascript:void(0);" title="点击更换验证码">
+								<img th:src="@{captcha/captchaImage(type=${captchaType})}" class="imgcode" width="85%"/>
+							</a>
+						</div>
+					</div>
+                    <div class="checkbox-custom" th:classappend="${captchaEnabled==false} ? 'm-t'">
+				        <input type="checkbox" id="acceptTerm" name="acceptTerm"> <label for="acceptTerm">我已阅读并同意</label>
+				        <a href="https://gitee.com/y_project/RuoYi/blob/master/README.md" target="_blank">使用条款</a>
+				    </div>
+                    <button class="btn btn-success btn-block" id="btnSubmit" data-loading="正在验证注册,请稍后...">注册</button>
+                </form>
+            </div>
+        </div>
+        <div class="signup-footer">
+            <div class="pull-left">
+                &copy; 2019 All Rights Reserved. RuoYi <br>
+            </div>
+        </div>
+    </div>
+<script th:inline="javascript"> var ctx = [[@{/}]]; var captchaType = [[${captchaType}]]; </script>
+<!-- 全局js -->
+<script src="../static/js/jquery.min.js" th:src="@{/js/jquery.min.js}"></script>
+<script src="../static/js/bootstrap.min.js" th:src="@{/js/bootstrap.min.js}"></script>
+<!-- 验证插件 -->
+<script src="../static/ajax/libs/validate/jquery.validate.min.js" th:src="@{/ajax/libs/validate/jquery.validate.min.js}"></script>
+<script src="../static/ajax/libs/validate/messages_zh.min.js" th:src="@{/ajax/libs/validate/messages_zh.min.js}"></script>
+<script src="../static/ajax/libs/layer/layer.min.js" th:src="@{/ajax/libs/layer/layer.min.js}"></script>
+<script src="../static/ajax/libs/blockUI/jquery.blockUI.js" th:src="@{/ajax/libs/blockUI/jquery.blockUI.js}"></script>
+<script src="../static/ruoyi/js/ry-ui.js" th:src="@{/ruoyi/js/ry-ui.js?v=4.2.0}"></script>
+<script src="../static/ruoyi/register.js" th:src="@{/ruoyi/register.js}"></script>
+</body>
+</html>

+ 1 - 1
ruoyi-admin/src/main/resources/templates/skin.html

@@ -140,7 +140,7 @@
 </ul>
 </body>
 <script th:src="@{/js/jquery.min.js}"></script>
-<script th:src="@{/ruoyi/js/common.js?v=4.1.0}"></script>
+<script th:src="@{/ruoyi/js/common.js?v=4.2.0}"></script>
 <script type="text/javascript">
 //皮肤样式列表
 var skins = ["skin-blue", "skin-green", "skin-purple", "skin-red", "skin-yellow"];

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

@@ -108,7 +108,10 @@
 		        },
 		        {
 		            field: 'remark',
-		            title: '备注'
+		            title: '备注',
+		            formatter: function(value, row, index) {
+                        return $.table.tooltip(value);
+			        }
 		        },
 		        {
 		            field: 'createTime',

+ 1 - 1
ruoyi-admin/src/main/resources/templates/system/role/authUser.html

@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
 <head>
-	<th:block th:include="include :: header('角色用户分配')" />
+	<th:block th:include="include :: header('角色分配用户')" />
 </head>
 <body class="gray-bg">
 	<div class="container-div">

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

@@ -117,7 +117,7 @@
 		                actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.roleId + '\')"><i class="fa fa-remove"></i>删除</a> ');
 		                var more = [];
 		                more.push("<a class='btn btn-default btn-xs " + editFlag + "' href='javascript:void(0)' onclick='authDataScope(" + row.roleId + ")'><i class='fa fa-check-square-o'></i>数据权限</a> ");
-		                more.push("<a class='btn btn-default btn-xs " + editFlag + "' href='javascript:void(0)' onclick='authUser(" + row.roleId + ")'><i class='fa fa-user'></i>分配用户</a> ");
+		                more.push("<a class='btn btn-default btn-xs " + editFlag + "' href='javascript:void(0)' onclick='authUser(" + row.roleId + ")'><i class='fa fa-user'></i>分配用户</a>");
 		                actions.push('<a class="btn btn-info btn-xs" role="button" data-toggle="popover" data-content="' + more.join('') + '"><i class="fa fa-chevron-circle-right"></i>更多操作</a>');
 		                return actions.join('');
 		            }

+ 103 - 0
ruoyi-admin/src/main/resources/templates/system/user/authRole.html

@@ -0,0 +1,103 @@
+<!DOCTYPE html>
+<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
+<head>
+	<th:block th:include="include :: header('用户分配角色')" />
+</head>
+<body>
+    <div class="main-content">
+        <form id="form-user-add" class="form-horizontal">
+            <input type="hidden" id="userId" name="userId" th:value="${user.userId}">
+            <h4 class="form-header h4">基本信息</h4>
+            <div class="row">
+            	<div class="col-sm-6">
+                    <div class="form-group">
+                        <label class="col-sm-4 control-label is-required">用户名称:</label>
+                        <div class="col-sm-8">
+                            <input name="userName" class="form-control" type="text" disabled th:value="${user.userName}">
+                        </div>
+                    </div>
+                </div>
+                <div class="col-sm-6">
+                    <div class="form-group">
+                        <label class="col-sm-4 control-label is-required">登录账号:</label>
+                        <div class="col-sm-8">
+                            <input name="loginName" class="form-control" type="text" disabled th:value="${user.loginName}">
+                        </div>
+                    </div>
+                </div> 
+            </div>
+           
+            <h4 class="form-header h4">分配角色</h4>
+            <div class="row">
+                <div class="col-sm-12">
+                    <div class="col-sm-12 select-table table-striped">
+					    <table id="bootstrap-table"></table>
+					</div>
+                </div>
+            </div>
+        </form>
+    </div>
+      
+    <div class="row">
+        <div class="col-sm-offset-5 col-sm-10">
+            <button type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i>保 存</button>&nbsp;
+            <button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭 </button>
+        </div>
+    </div>
+	<th:block th:include="include :: footer" />
+	<script th:inline="javascript">
+	    var prefix = ctx + "system/user/authRole";
+	    var userRoles = [[${userRoles}]]
+	    
+	    $(function() {
+		    var options = {
+		        url: ctx + "system/role/list",
+		        sortName: "roleSort",
+		        showSearch: false,
+                showRefresh: false,
+                showToggle: false,
+                showColumns: false,
+                clickToSelect: true,
+		        columns: [{
+		            checkbox: true,
+		            formatter:function (value, row, index) {
+		            	for (var i = 0; i < userRoles.length; i++) {
+		            	    if (userRoles[i].roleId == row.roleId) {
+		            	        return { checked: true };
+		            	    }
+		            	}
+		            	return { checked: false };
+		            }
+		        },
+		        {
+		            field: 'roleId',
+		            title: '角色编号'
+		        },
+		        {
+		            field: 'roleName',
+		            title: '角色名称',
+		            sortable: true
+		        },
+		        {
+		            field: 'roleKey',
+		            title: '权限字符',
+		            sortable: true
+		        },
+		        {
+		            field: 'createTime',
+		            title: '创建时间',
+		            sortable: true
+		        }]
+		    };
+		    $.table.init(options);
+		});
+	    
+	    /* 添加角色-提交 */
+        function submitHandler(index, layero){
+        	var rows = $.table.selectFirstColumns();
+        	var data = { "userId": $("#userId").val(), "roleIds": rows.join() };
+			$.operate.saveTab(prefix + "/insertAuthRole", data);
+        }
+    </script>
+</body>
+</html>

+ 1 - 1
ruoyi-admin/src/main/resources/templates/system/user/profile/profile.html

@@ -27,7 +27,7 @@
                             <b  class="font-noraml">手机号码:</b>
                             <p class="pull-right">[[${user.phonenumber}]]</p>
                         </li>
-                        <li class="list-group-item"><i class="fa fa-group"></i>
+                        <li class="list-group-item" th:if="${user.dept?.deptName != null}"><i class="fa fa-group"></i>
                             <b  class="font-noraml">所属部门:</b>
                             <p class="pull-right" >[[${user.dept?.deptName}]] / [[${#strings.defaultString(postGroup,'无岗位')}]]</p>
                         </li>

+ 10 - 1
ruoyi-admin/src/main/resources/templates/system/user/user.html

@@ -166,7 +166,10 @@
 		                var actions = [];
 		                actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.userId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
 		                actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.userId + '\')"><i class="fa fa-remove"></i>删除</a> ');
-		                actions.push('<a class="btn btn-info btn-xs ' + resetPwdFlag + '" href="javascript:void(0)" onclick="resetPwd(\'' + row.userId + '\')"><i class="fa fa-key"></i>重置</a>');
+		                var more = [];
+		                more.push("<a class='btn btn-default btn-xs " + resetPwdFlag + "' href='javascript:void(0)' onclick='resetPwd(" + row.userId + ")'><i class='fa fa-key'></i>重置密码</a> ");
+		                more.push("<a class='btn btn-default btn-xs " + editFlag + "' href='javascript:void(0)' onclick='authRole(" + row.userId + ")'><i class='fa fa-check-square-o'></i>分配角色</a>");
+		                actions.push('<a class="btn btn-info btn-xs" role="button" data-toggle="popover" data-content="' + more.join('') + '"><i class="fa fa-chevron-circle-right"></i>更多操作</a>');
 		                return actions.join('');
 		            }
 		        }]
@@ -219,6 +222,12 @@
 		    $.modal.open("重置密码", url, '800', '300');
 		}
 		
+		/* 用户管理-分配角色 */
+		function authRole(userId) {
+		    var url = prefix + '/authRole/' + userId;
+		    $.modal.openTab("用户分配角色", url);
+		}
+		
 		/* 用户状态显示 */
 		function statusTools(row) {
 		    if (row.status == 1) {

+ 1 - 1
ruoyi-common/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>ruoyi</artifactId>
         <groupId>com.ruoyi</groupId>
-        <version>4.1.0</version>
+        <version>4.2.0</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 	

+ 5 - 0
ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java

@@ -31,6 +31,11 @@ public class Constants
      * 注销
      */
     public static final String LOGOUT = "Logout";
+    
+    /**
+     * 注册
+     */
+    public static final String REGISTER = "Register";
 
     /**
      * 登录失败

+ 4 - 4
ruoyi-common/src/main/java/com/ruoyi/common/constant/ShiroConstants.java

@@ -20,22 +20,22 @@ public interface ShiroConstants
     /**
      * 消息key
      */
-    public static String MESSAGE = "message";
+    public static final String MESSAGE = "message";
 
     /**
      * 错误key
      */
-    public static String ERROR = "errorMsg";
+    public static final String ERROR = "errorMsg";
 
     /**
      * 编码格式
      */
-    public static String ENCODING = "UTF-8";
+    public static final String ENCODING = "UTF-8";
 
     /**
      * 当前在线会话
      */
-    public String ONLINE_SESSION = "online_session";
+    public static final String ONLINE_SESSION = "online_session";
 
     /**
      * 验证码key

+ 6 - 0
ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java

@@ -89,6 +89,12 @@ public class UserConstants
     public static final int PASSWORD_MIN_LENGTH = 5;
     public static final int PASSWORD_MAX_LENGTH = 20;
 
+    /**
+     * 用户类型
+     */
+    public static final String SYSTEM_USER_TYPE = "00";
+    public static final String REGISTER_USER_TYPE = "01";
+
     /**
      * 手机号码格式限制
      */

+ 1 - 1
ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java

@@ -91,7 +91,7 @@ public class FileUploadUtils
      *
      * @param baseDir 相对应用的基目录
      * @param file 上传的文件
-     * @param extension 上传文件类型
+     * @param allowedExtension 上传文件类型
      * @return 返回上传成功的文件名
      * @throws FileSizeLimitExceededException 如果超出最大大小
      * @throws FileNameLengthLimitExceededException 文件名太长

+ 1 - 1
ruoyi-framework/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>ruoyi</artifactId>
         <groupId>com.ruoyi</groupId>
-        <version>4.1.0</version>
+        <version>4.2.0</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 	

+ 2 - 1
ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java

@@ -92,7 +92,8 @@ public class DataScopeAspect
      * 
      * @param joinPoint 切点
      * @param user 用户
-     * @param alias 别名
+     * @param deptAlias 部门别名
+     * @param userAlias 用户别名
      */
     public static void dataScopeFilter(JoinPoint joinPoint, SysUser user, String deptAlias, String userAlias)
     {

+ 2 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/config/ShiroConfig.java

@@ -254,6 +254,8 @@ public class ShiroConfig
         filterChainDefinitionMap.put("/logout", "logout");
         // 不需要拦截的访问
         filterChainDefinitionMap.put("/login", "anon,captchaValidate");
+        // 注册相关
+        filterChainDefinitionMap.put("/register", "anon,captchaValidate");
         // 系统权限列表
         // filterChainDefinitionMap.putAll(SpringUtils.getBean(IMenuService.class).selectPermsAll());
 

+ 1 - 1
ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/RepeatSubmitInterceptor.java

@@ -47,7 +47,7 @@ public abstract class RepeatSubmitInterceptor extends HandlerInterceptorAdapter
     /**
      * 验证是否重复提交由子类实现具体的防重复提交的规则
      * 
-     * @param httpServletRequest
+     * @param request
      * @return
      * @throws Exception
      */

+ 2 - 1
ruoyi-framework/src/main/java/com/ruoyi/framework/manager/factory/AsyncFactory.java

@@ -6,6 +6,7 @@ import org.slf4j.LoggerFactory;
 import com.ruoyi.common.constant.Constants;
 import com.ruoyi.common.utils.AddressUtils;
 import com.ruoyi.common.utils.ServletUtils;
+import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.spring.SpringUtils;
 import com.ruoyi.framework.shiro.session.OnlineSession;
 import com.ruoyi.framework.util.LogUtils;
@@ -119,7 +120,7 @@ public class AsyncFactory
                 logininfor.setOs(os);
                 logininfor.setMsg(message);
                 // 日志状态
-                if (Constants.LOGIN_SUCCESS.equals(status) || Constants.LOGOUT.equals(status))
+                if (StringUtils.equalsAny(status, Constants.LOGIN_SUCCESS, Constants.LOGOUT, Constants.REGISTER))
                 {
                     logininfor.setStatus(Constants.SUCCESS);
                 }

+ 1 - 1
ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/service/SysPasswordService.java

@@ -80,7 +80,7 @@ public class SysPasswordService
 
     public String encryptPassword(String username, String password, String salt)
     {
-        return new Md5Hash(username + password + salt).toHex().toString();
+        return new Md5Hash(username + password + salt).toHex();
     }
 
     public void unlock(String loginName){

+ 80 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/service/SysRegisterService.java

@@ -0,0 +1,80 @@
+package com.ruoyi.framework.shiro.service;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.util.StringUtils;
+import com.ruoyi.common.constant.Constants;
+import com.ruoyi.common.constant.ShiroConstants;
+import com.ruoyi.common.constant.UserConstants;
+import com.ruoyi.common.utils.MessageUtils;
+import com.ruoyi.common.utils.ServletUtils;
+import com.ruoyi.framework.manager.AsyncManager;
+import com.ruoyi.framework.manager.factory.AsyncFactory;
+import com.ruoyi.framework.util.ShiroUtils;
+import com.ruoyi.system.domain.SysUser;
+import com.ruoyi.system.service.ISysUserService;
+
+/**
+ * 注册校验方法
+ * 
+ * @author ruoyi
+ */
+@Component
+public class SysRegisterService
+{
+    @Autowired
+    private ISysUserService userService;
+
+    @Autowired
+    private SysPasswordService passwordService;
+
+    /**
+     * 注册
+     */
+    public String register(SysUser user)
+    {
+        String msg = "", username = user.getLoginName(), password = user.getPassword();
+
+        if (!StringUtils.isEmpty(ServletUtils.getRequest().getAttribute(ShiroConstants.CURRENT_CAPTCHA)))
+        {
+            msg = "验证码错误";
+        }
+        else if (StringUtils.isEmpty(username))
+        {
+            msg = "用户名不能为空";
+        }
+        else if (StringUtils.isEmpty(password))
+        {
+            msg = "用户密码不能为空";
+        }
+        else if (password.length() < UserConstants.PASSWORD_MIN_LENGTH
+                || password.length() > UserConstants.PASSWORD_MAX_LENGTH)
+        {
+            msg = "密码长度必须在5到20个字符之间";
+        }
+        else if (username.length() < UserConstants.USERNAME_MIN_LENGTH
+                || username.length() > UserConstants.USERNAME_MAX_LENGTH)
+        {
+            msg = "账户长度必须在2到20个字符之间";
+        }
+        else if (UserConstants.USER_NAME_NOT_UNIQUE.equals(userService.checkLoginNameUnique(username)))
+        {
+            msg = "保存用户'" + username + "'失败,注册账号已存在";
+        }
+        else
+        {
+            user.setSalt(ShiroUtils.randomSalt());
+            user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
+            boolean regFlag = userService.registerUser(user);
+            if (!regFlag)
+            {
+                msg = "注册失败,请联系系统管理人员";
+            }
+            else
+            {
+                AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.REGISTER, MessageUtils.message("user.register.success")));
+            }
+        }
+        return msg;
+    }
+}

+ 2 - 2
ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/session/OnlineSessionDAO.java

@@ -80,12 +80,12 @@ public class OnlineSessionDAO extends EnterpriseCacheSessionDAO
             boolean isGuest = onlineSession.getUserId() == null || onlineSession.getUserId() == 0L;
 
             // session 数据变更了 同步
-            if (isGuest == false && onlineSession.isAttributeChanged())
+            if (!isGuest == false && onlineSession.isAttributeChanged())
             {
                 needSync = true;
             }
 
-            if (needSync == false)
+            if (!needSync)
             {
                 return;
             }

+ 1 - 1
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/ConfigService.java

@@ -18,7 +18,7 @@ public class ConfigService
     /**
      * 根据键名查询参数配置信息
      * 
-     * @param configName 参数名称
+     * @param configKey 参数键名
      * @return 参数键值
      */
     public String getKey(String configKey)

+ 1 - 1
ruoyi-generator/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>ruoyi</artifactId>
         <groupId>com.ruoyi</groupId>
-        <version>4.1.0</version>
+        <version>4.2.0</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 4 - 4
ruoyi-generator/src/main/resources/vm/html/list-tree.html.vm

@@ -115,8 +115,8 @@
 #if($column.pk)
 #elseif($column.list && "" != $dictType)
                 {
-                    field : '${javaField}', 
-                    title : '${comment}',
+                    field: '${javaField}', 
+                    title: '${comment}',
                     align: 'left',
                     formatter: function(value, row, index) {
                         return $.table.selectDictLabel(${javaField}Datas, value);
@@ -124,8 +124,8 @@
                 },
 #elseif($column.list && "" != $javaField)
                 {
-                    field : '${javaField}', 
-                    title : '${comment}',
+                    field: '${javaField}', 
+                    title: '${comment}',
                     align: 'left'
                 },
 #end                

+ 6 - 6
ruoyi-generator/src/main/resources/vm/html/list.html.vm

@@ -111,22 +111,22 @@
 #end
 #if($column.pk)
                 {
-                    field : '${javaField}', 
-                    title : '${comment}',
+                    field: '${javaField}', 
+                    title: '${comment}',
                     visible: false
                 },
 #elseif($column.list && "" != $dictType)
                 {
-                    field : '${javaField}', 
-                    title : '${comment}',
+                    field: '${javaField}', 
+                    title: '${comment}',
                     formatter: function(value, row, index) {
                        return $.table.selectDictLabel(${javaField}Datas, value);
                     }
                 },
 #elseif($column.list && "" != $javaField)
                 {
-                    field : '${javaField}', 
-                    title : '${comment}'
+                    field: '${javaField}', 
+                    title: '${comment}'
                 },
 #end                
 #end

+ 1 - 1
ruoyi-quartz/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>ruoyi</artifactId>
         <groupId>com.ruoyi</groupId>
-        <version>4.1.0</version>
+        <version>4.2.0</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 13 - 1
ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobLogController.java

@@ -9,15 +9,19 @@ import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.ResponseBody;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.quartz.domain.SysJob;
 import com.ruoyi.quartz.domain.SysJobLog;
 import com.ruoyi.quartz.service.ISysJobLogService;
+import com.ruoyi.quartz.service.ISysJobService;
 
 /**
  * 调度日志操作处理
@@ -30,13 +34,21 @@ public class SysJobLogController extends BaseController
 {
     private String prefix = "monitor/job";
 
+    @Autowired
+    private ISysJobService jobService;
+
     @Autowired
     private ISysJobLogService jobLogService;
 
     @RequiresPermissions("monitor:job:view")
     @GetMapping()
-    public String jobLog()
+    public String jobLog(@RequestParam(value = "jobId", required = false) Long jobId, ModelMap mmap)
     {
+        if (StringUtils.isNotNull(jobId))
+        {
+            SysJob job = jobService.selectJobById(jobId);
+            mmap.put("job", job);
+        }
         return prefix + "/jobLog";
     }
 

+ 3 - 2
ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobServiceImpl.java

@@ -34,15 +34,16 @@ public class SysJobServiceImpl implements ISysJobService
 
     /**
      * 项目启动时,初始化定时器 
-     * 主要是防止手动修改数据库导致未同步到定时任务处理(注:不能手动修改数据库ID和任务组名,否则会导致脏数据)
+	 主要是防止手动修改数据库导致未同步到定时任务处理(注:不能手动修改数据库ID和任务组名,否则会导致脏数据)
      */
     @PostConstruct
     public void init() throws SchedulerException, TaskException
     {
+        scheduler.clear();
         List<SysJob> jobList = jobMapper.selectJobAll();
         for (SysJob job : jobList)
         {
-            updateSchedulerJob(job, job.getJobGroup());
+            ScheduleUtils.createScheduleJob(scheduler, job);
         }
     }
 

+ 1 - 1
ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/JobInvokeUtil.java

@@ -65,7 +65,7 @@ public class JobInvokeUtil
     /**
      * 校验是否为为class包名
      * 
-     * @param str 名称
+     * @param invokeTarget 名称
      * @return true是 false否
      */
     public static boolean isValidClassName(String invokeTarget)

+ 8 - 4
ruoyi-quartz/src/main/resources/templates/monitor/job/job.html

@@ -47,7 +47,7 @@
 		         <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="monitor:job:export">
 		            <i class="fa fa-download"></i> 导出
 		        </a>
-		        <a class="btn btn-info" onclick="javascript:jobLog()" shiro:hasPermission="monitor:job:list">
+		        <a class="btn btn-info" onclick="javascript:jobLog()" shiro:hasPermission="monitor:job:detail">
 		            <i class="fa fa-list"></i> 日志
 		        </a>
 	        </div>
@@ -129,6 +129,7 @@
 		                var more = [];
 		                more.push("<a class='btn btn-default btn-xs " + statusFlag + "' href='javascript:void(0)' onclick='run(" + row.jobId + ")'><i class='fa fa-play-circle-o'></i> 执行一次</a> ");
 		                more.push("<a class='btn btn-default btn-xs " + detailFlag + "' href='javascript:void(0)' onclick='$.operate.detail(" + row.jobId + ")'><i class='fa fa-search'></i>任务详细</a> ");
+		                more.push("<a class='btn btn-default btn-xs " + detailFlag + "' href='javascript:void(0)' onclick='jobLog(" + row.jobId + ")'><i class='fa fa-list'></i>调度日志</a>");
 		                actions.push('<a class="btn btn-info btn-xs" role="button" data-toggle="popover" data-content="' + more.join('') + '"><i class="fa fa-chevron-circle-right"></i>更多操作</a>');
 		                return actions.join('');
 		            }
@@ -168,9 +169,12 @@
 		}
 
 		/* 调度日志查询 */
-		function jobLog(id) {
-			var url = ctx + 'monitor/jobLog';
-			$.modal.openTab("调度日志", url);
+		function jobLog(jobId) {
+		    var url = ctx + 'monitor/jobLog';
+		    if ($.common.isNotEmpty(jobId)) {
+		        url += '?jobId=' + jobId;
+		    }
+		    $.modal.openTab("调度日志", url);
 		}
 	</script>
 </body>

+ 3 - 2
ruoyi-quartz/src/main/resources/templates/monitor/job/jobLog.html

@@ -12,12 +12,13 @@
 					<div class="select-list">
 						<ul>
 							<li>
-								任务名称:<input type="text" name="jobName"/>
+								任务名称:<input type="text" name="jobName" th:value="${job!=null?job.jobName:''}"/>
 							</li>
 							<li>
 								任务分组:<select name="jobGroup" th:with="type=${@dict.getType('sys_job_group')}">
 									<option value="">所有</option>
-									<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
+									<th:block th:if="${job==null}"><option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option></th:block>
+									<th:block th:if="${job!=null}"><option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{job.jobGroup}"></option></th:block>
 								</select>
 							</li>
 							<li>

+ 1 - 1
ruoyi-system/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>ruoyi</artifactId>
         <groupId>com.ruoyi</groupId>
-        <version>4.1.0</version>
+        <version>4.2.0</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     

+ 1 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysRole.java

@@ -177,6 +177,7 @@ public class SysRole extends BaseEntity
         this.deptIds = deptIds;
     }
 
+    @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
             .append("roleId", getRoleId())

+ 15 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUser.java

@@ -42,6 +42,9 @@ public class SysUser extends BaseEntity
     @Excel(name = "用户名称")
     private String userName;
 
+    /** 用户类型 */
+    private String userType;
+
     /** 用户邮箱 */
     @Excel(name = "用户邮箱")
     private String email;
@@ -176,6 +179,16 @@ public class SysUser extends BaseEntity
         this.userName = userName;
     }
 
+    public String getUserType()
+    {
+        return userType;
+    }
+
+    public void setUserType(String userType)
+    {
+        this.userType = userType;
+    }
+
     @Email(message = "邮箱格式不正确")
     @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
     public String getEmail()
@@ -330,6 +343,7 @@ public class SysUser extends BaseEntity
             .append("deptId", getDeptId())
             .append("loginName", getLoginName())
             .append("userName", getUserName())
+            .append("userType", getUserType())
             .append("email", getEmail())
             .append("phonenumber", getPhonenumber())
             .append("sex", getSex())
@@ -346,6 +360,7 @@ public class SysUser extends BaseEntity
             .append("updateTime", getUpdateTime())
             .append("remark", getRemark())
             .append("dept", getDept())
+			.append("roles", getRoles())
             .toString();
     }
 }

+ 9 - 1
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java

@@ -11,6 +11,14 @@ import com.ruoyi.system.domain.SysUserRole;
  */
 public interface SysUserRoleMapper
 {
+    /**
+     * 通过用户ID查询用户和角色关联
+     * 
+     * @param userId 用户ID
+     * @return 用户和角色关联列表
+     */
+    public List<SysUserRole> selectUserRoleByUserId(Long userId);
+
     /**
      * 通过用户ID删除用户和角色关联
      * 
@@ -42,7 +50,7 @@ public interface SysUserRoleMapper
      * @return 结果
      */
     public int batchUserRole(List<SysUserRole> userRoleList);
-    
+
     /**
      * 删除用户和角色关联信息
      * 

+ 25 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java

@@ -2,6 +2,7 @@ package com.ruoyi.system.service;
 
 import java.util.List;
 import com.ruoyi.system.domain.SysUser;
+import com.ruoyi.system.domain.SysUserRole;
 
 /**
  * 用户 业务层
@@ -66,6 +67,14 @@ public interface ISysUserService
      */
     public SysUser selectUserById(Long userId);
 
+    /**
+     * 通过用户ID查询用户和角色关联
+     * 
+     * @param userId 用户ID
+     * @return 用户和角色关联列表
+     */
+    public List<SysUserRole> selectUserRoleByUserId(Long userId);
+
     /**
      * 通过用户ID删除用户
      * 
@@ -91,6 +100,14 @@ public interface ISysUserService
      */
     public int insertUser(SysUser user);
 
+    /**
+     * 注册用户信息
+     * 
+     * @param user 用户信息
+     * @return 结果
+     */
+    public boolean registerUser(SysUser user);
+
     /**
      * 保存用户信息
      * 
@@ -107,6 +124,14 @@ public interface ISysUserService
      */
     public int updateUserInfo(SysUser user);
 
+    /**
+     * 用户授权角色
+     * 
+     * @param userId 用户ID
+     * @param roleIds 角色组
+     */
+    public void insertUserAuth(Long userId, Long[] roleIds);
+
     /**
      * 修改用户密码信息
      * 

+ 42 - 8
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java

@@ -139,6 +139,17 @@ public class SysUserServiceImpl implements ISysUserService
         return userMapper.selectUserById(userId);
     }
 
+    /**
+     * 通过用户ID查询用户和角色关联
+     * 
+     * @param userId 用户ID
+     * @return 用户和角色关联列表
+     */
+    public List<SysUserRole> selectUserRoleByUserId(Long userId)
+    {
+        return userRoleMapper.selectUserRoleByUserId(userId);
+    }
+
     /**
      * 通过用户ID删除用户
      * 
@@ -187,10 +198,22 @@ public class SysUserServiceImpl implements ISysUserService
         // 新增用户岗位关联
         insertUserPost(user);
         // 新增用户与角色管理
-        insertUserRole(user);
+        insertUserRole(user.getUserId(), user.getRoleIds());
         return rows;
     }
 
+    /**
+     * 注册用户信息
+     * 
+     * @param user 用户信息
+     * @return 结果
+     */
+    public boolean registerUser(SysUser user)
+    {
+        user.setUserType(UserConstants.REGISTER_USER_TYPE);
+        return userMapper.insertUser(user) > 0;
+    }
+
     /**
      * 修改保存用户信息
      * 
@@ -205,7 +228,7 @@ public class SysUserServiceImpl implements ISysUserService
         // 删除用户与角色关联
         userRoleMapper.deleteUserRoleByUserId(userId);
         // 新增用户与角色管理
-        insertUserRole(user);
+        insertUserRole(user.getUserId(), user.getRoleIds());
         // 删除用户与岗位关联
         userPostMapper.deleteUserPostByUserId(userId);
         // 新增用户与岗位管理
@@ -225,6 +248,18 @@ public class SysUserServiceImpl implements ISysUserService
         return userMapper.updateUser(user);
     }
 
+    /**
+     * 用户授权角色
+     * 
+     * @param userId 用户ID
+     * @param roleIds 角色组
+     */
+    public void insertUserAuth(Long userId, Long[] roleIds)
+    {
+        userRoleMapper.deleteUserRoleByUserId(userId);
+        insertUserRole(userId, roleIds);
+    }
+
     /**
      * 修改用户密码
      * 
@@ -242,17 +277,16 @@ public class SysUserServiceImpl implements ISysUserService
      * 
      * @param user 用户对象
      */
-    public void insertUserRole(SysUser user)
+    public void insertUserRole(Long userId, Long[] roleIds)
     {
-        Long[] roles = user.getRoleIds();
-        if (StringUtils.isNotNull(roles))
+        if (StringUtils.isNotNull(roleIds))
         {
             // 新增用户与角色管理
             List<SysUserRole> list = new ArrayList<SysUserRole>();
-            for (Long roleId : roles)
+            for (Long roleId : roleIds)
             {
                 SysUserRole ur = new SysUserRole();
-                ur.setUserId(user.getUserId());
+                ur.setUserId(userId);
                 ur.setRoleId(roleId);
                 list.add(ur);
             }
@@ -307,7 +341,7 @@ public class SysUserServiceImpl implements ISysUserService
     }
 
     /**
-     * 校验用户名称是否唯一
+     * 校验手机号码是否唯一
      *
      * @param user 用户信息
      * @return

+ 4 - 3
ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml

@@ -65,7 +65,8 @@
 		from sys_menu m
 			 left join sys_role_menu rm on m.menu_id = rm.menu_id
 			 left join sys_user_role ur on rm.role_id = ur.role_id
-		where ur.user_id = #{userId}
+			 left join sys_role r on r.role_id = ur.role_id
+		where m.visible = '0' and r.status = '0' and ur.user_id = #{userId}
 	</select>
 
 	<select id="selectMenuTree" parameterType="Long" resultType="String">
@@ -131,13 +132,13 @@
 			<if test="menuName != null and menuName != ''">menu_name = #{menuName},</if>
 			<if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
 			<if test="orderNum != null and orderNum != ''">order_num = #{orderNum},</if>
-			<if test="url != null and url != ''">url = #{url},</if>
+			<if test="url != null">url = #{url},</if>
 			<if test="target != null and target != ''">target = #{target},</if>
 			<if test="menuType != null and menuType != ''">menu_type = #{menuType},</if>
 			<if test="visible != null">visible = #{visible},</if>
 			<if test="perms !=null">perms = #{perms},</if>
 			<if test="icon !=null and icon != ''">icon = #{icon},</if>
-			<if test="remark != null and remark != ''">remark = #{remark},</if>
+			<if test="remark != null">remark = #{remark},</if>
 			<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
 			update_time = sysdate()
 		</set>

+ 9 - 5
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -9,6 +9,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		<result property="deptId"       column="dept_id"      />
 		<result property="loginName"    column="login_name"   />
 		<result property="userName"     column="user_name"    />
+		<result property="userType"     column="user_type"    />
 		<result property="email"        column="email"        />
 		<result property="phonenumber"  column="phonenumber"  />
 		<result property="sex"          column="sex"          />
@@ -47,7 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	</resultMap>
 	
 	<sql id="selectUserVo">
-        select  u.user_id, u.dept_id, u.login_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.password, u.salt, u.status, u.del_flag, u.login_ip, u.login_date, u.create_time, u.remark,
+        select  u.user_id, u.dept_id, u.login_name, u.user_name, u.user_type, u.email, u.avatar, u.phonenumber, u.sex, u.password, u.salt, u.status, u.del_flag, u.login_ip, u.login_date, u.create_time, u.remark,
        		    d.dept_id, d.parent_id, d.dept_name, d.order_num, d.leader, d.status as dept_status,
        		    r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
 		from sys_user u
@@ -57,7 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </sql>
 	
 	<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
-		select u.user_id, u.dept_id, u.login_name, u.user_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.salt, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u
+		select u.user_id, u.dept_id, u.login_name, u.user_name, u.user_type, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.salt, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u
 		left join sys_dept d on u.dept_id = d.dept_id
 		where u.del_flag = '0'
 		<if test="loginName != null and loginName != ''">
@@ -83,7 +84,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	</select>
 	
 	<select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult">
-	    select distinct u.user_id, u.dept_id, u.login_name, u.user_name, u.email, u.avatar, u.phonenumber, u.status, u.create_time
+	    select distinct u.user_id, u.dept_id, u.login_name, u.user_name, u.user_type, u.email, u.avatar, u.phonenumber, u.status, u.create_time
 	    from sys_user u
 			 left join sys_dept d on u.dept_id = d.dept_id
 			 left join sys_user_role ur on u.user_id = ur.user_id
@@ -100,7 +101,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	</select>
 	
 	<select id="selectUnallocatedList" parameterType="SysUser" resultMap="SysUserResult">
-	    select distinct u.user_id, u.dept_id, u.login_name, u.user_name, u.email, u.avatar, u.phonenumber, u.status, u.create_time
+	    select distinct u.user_id, u.dept_id, u.login_name, u.user_name, u.user_type, u.email, u.avatar, u.phonenumber, u.status, u.create_time
 	    from sys_user u
 			 left join sys_dept d on u.dept_id = d.dept_id
 			 left join sys_user_role ur on u.user_id = ur.user_id
@@ -150,7 +151,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	</select>
 	
 	<delete id="deleteUserById" parameterType="Long">
- 		delete from sys_user where user_id = #{userId}
+ 		update sys_user set del_flag = '2' where user_id = #{userId}
  	</delete>
  	
  	<delete id="deleteUserByIds" parameterType="Long">
@@ -166,6 +167,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="deptId != null and deptId != 0">dept_id = #{deptId},</if>
  			<if test="loginName != null and loginName != ''">login_name = #{loginName},</if>
  			<if test="userName != null and userName != ''">user_name = #{userName},</if>
+ 			<if test="userType != null and userType != ''">user_type = #{userType},</if>
  			<if test="email != null and email != ''">email = #{email},</if>
  			<if test="phonenumber != null and phonenumber != ''">phonenumber = #{phonenumber},</if>
  			<if test="sex != null and sex != ''">sex = #{sex},</if>
@@ -188,6 +190,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="deptId != null and deptId != 0">dept_id,</if>
  			<if test="loginName != null and loginName != ''">login_name,</if>
  			<if test="userName != null and userName != ''">user_name,</if>
+ 			<if test="userType != null and userType != ''">user_type,</if>
  			<if test="email != null and email != ''">email,</if>
  			<if test="avatar != null and avatar != ''">avatar,</if>
  			<if test="phonenumber != null and phonenumber != ''">phonenumber,</if>
@@ -203,6 +206,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="deptId != null and deptId != ''">#{deptId},</if>
  			<if test="loginName != null and loginName != ''">#{loginName},</if>
  			<if test="userName != null and userName != ''">#{userName},</if>
+ 			<if test="userType != null and userType != ''">#{userType},</if>
  			<if test="email != null and email != ''">#{email},</if>
  			<if test="avatar != null and avatar != ''">#{avatar},</if>
  			<if test="phonenumber != null and phonenumber != ''">#{phonenumber},</if>

+ 6 - 2
ruoyi-system/src/main/resources/mapper/system/SysUserRoleMapper.xml

@@ -8,13 +8,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		<result property="userId"     column="user_id"      />
 		<result property="roleId"     column="role_id"      />
 	</resultMap>
+	
+	<select id="selectUserRoleByUserId" parameterType="Long" resultMap="SysUserRoleResult">
+		select user_id, role_id from sys_user_role where user_id = #{userId}
+	</select>
 
 	<delete id="deleteUserRoleByUserId" parameterType="Long">
-		delete from sys_user_role where user_id=#{userId}
+		delete from sys_user_role where user_id = #{userId}
 	</delete>
 	
 	<select id="countUserRoleByRoleId" resultType="Integer">
-	    select count(1) from sys_user_role where role_id=#{roleId}  
+	    select count(1) from sys_user_role where role_id = #{roleId}  
 	</select>
 	
 	<delete id="deleteUserRole" parameterType="Long">

+ 18 - 16
sql/ry_20191122.sql → sql/ry_20200323.sql

@@ -43,8 +43,8 @@ create table sys_user (
   user_id           bigint(20)      not null auto_increment    comment '用户ID',
   dept_id           bigint(20)      default null               comment '部门ID',
   login_name        varchar(30)     not null                   comment '登录账号',
-  user_name         varchar(30)     not null                   comment '用户昵称',
-  user_type         varchar(2)      default '00'               comment '用户类型(00系统用户)',
+  user_name         varchar(30)     default ''                 comment '用户昵称',
+  user_type         varchar(2)      default '00'               comment '用户类型(00系统用户 01注册用户)',
   email             varchar(50)     default ''                 comment '用户邮箱',
   phonenumber       varchar(11)     default ''                 comment '手机号码',
   sex               char(1)         default '0'                comment '用户性别(0男 1女 2未知)',
@@ -497,17 +497,18 @@ insert into sys_dict_data values(14, 1,  '通知',     '1',       'sys_notice_ty
 insert into sys_dict_data values(15, 2,  '公告',     '2',       'sys_notice_type',     '',   'success', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '公告');
 insert into sys_dict_data values(16, 1,  '正常',     '0',       'sys_notice_status',   '',   'primary', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '正常状态');
 insert into sys_dict_data values(17, 2,  '关闭',     '1',       'sys_notice_status',   '',   'danger',  'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '关闭状态');
-insert into sys_dict_data values(18, 1,  '新增',     '1',       'sys_oper_type',       '',   'info',    'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作');
-insert into sys_dict_data values(19, 2,  '修改',     '2',       'sys_oper_type',       '',   'info',    'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '修改操作');
-insert into sys_dict_data values(20, 3,  '删除',     '3',       'sys_oper_type',       '',   'danger',  'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '删除操作');
-insert into sys_dict_data values(21, 4,  '授权',     '4',       'sys_oper_type',       '',   'primary', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '授权操作');
-insert into sys_dict_data values(22, 5,  '导出',     '5',       'sys_oper_type',       '',   'warning', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '导出操作');
-insert into sys_dict_data values(23, 6,  '导入',     '6',       'sys_oper_type',       '',   'warning', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '导入操作');
-insert into sys_dict_data values(24, 7,  '强退',     '7',       'sys_oper_type',       '',   'danger',  'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '强退操作');
-insert into sys_dict_data values(25, 8,  '生成代码', '8',       'sys_oper_type',       '',   'warning', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '生成操作');
-insert into sys_dict_data values(26, 9,  '清空数据', '9',       'sys_oper_type',       '',   'danger',  'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '清空操作');
-insert into sys_dict_data values(27, 1,  '成功',     '0',       'sys_common_status',   '',   'primary', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '正常状态');
-insert into sys_dict_data values(28, 2,  '失败',     '1',       'sys_common_status',   '',   'danger',  'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '停用状态');
+insert into sys_dict_data values(18, 99, '其他',     '0',       'sys_oper_type',       '',   'info',    'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '其他操作');
+insert into sys_dict_data values(19, 1,  '新增',     '1',       'sys_oper_type',       '',   'info',    'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作');
+insert into sys_dict_data values(20, 2,  '修改',     '2',       'sys_oper_type',       '',   'info',    'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '修改操作');
+insert into sys_dict_data values(21, 3,  '删除',     '3',       'sys_oper_type',       '',   'danger',  'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '删除操作');
+insert into sys_dict_data values(22, 4,  '授权',     '4',       'sys_oper_type',       '',   'primary', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '授权操作');
+insert into sys_dict_data values(23, 5,  '导出',     '5',       'sys_oper_type',       '',   'warning', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '导出操作');
+insert into sys_dict_data values(24, 6,  '导入',     '6',       'sys_oper_type',       '',   'warning', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '导入操作');
+insert into sys_dict_data values(25, 7,  '强退',     '7',       'sys_oper_type',       '',   'danger',  'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '强退操作');
+insert into sys_dict_data values(26, 8,  '生成代码', '8',       'sys_oper_type',       '',   'warning', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '生成操作');
+insert into sys_dict_data values(27, 9,  '清空数据', '9',       'sys_oper_type',       '',   'danger',  'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '清空操作');
+insert into sys_dict_data values(28, 1,  '成功',     '0',       'sys_common_status',   '',   'primary', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '正常状态');
+insert into sys_dict_data values(29, 2,  '失败',     '1',       'sys_common_status',   '',   'danger',  'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '停用状态');
 
 
 -- ----------------------------
@@ -528,9 +529,10 @@ create table sys_config (
   primary key (config_id)
 ) engine=innodb auto_increment=100 comment = '参数配置表';
 
-insert into sys_config values(1, '主框架页-默认皮肤样式名称', 'sys.index.skinName',     'skin-blue',     'Y', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '蓝色 skin-blue、绿色 skin-green、紫色 skin-purple、红色 skin-red、黄色 skin-yellow' );
-insert into sys_config values(2, '用户管理-账号初始密码',     'sys.user.initPassword',  '123456',        'Y', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '初始化密码 123456' );
-insert into sys_config values(3, '主框架页-侧边栏主题',       'sys.index.sideTheme',    'theme-dark',    'Y', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '深黑主题theme-dark,浅色主题theme-light,深蓝主题theme-blue' );
+insert into sys_config values(1, '主框架页-默认皮肤样式名称',     'sys.index.skinName',       'skin-blue',     'Y', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '蓝色 skin-blue、绿色 skin-green、紫色 skin-purple、红色 skin-red、黄色 skin-yellow');
+insert into sys_config values(2, '用户管理-账号初始密码',         'sys.user.initPassword',    '123456',        'Y', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '初始化密码 123456');
+insert into sys_config values(3, '主框架页-侧边栏主题',           'sys.index.sideTheme',      'theme-dark',    'Y', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '深黑主题theme-dark,浅色主题theme-light,深蓝主题theme-blue');
+insert into sys_config values(4, '账号自助-是否开启用户注册功能', 'sys.account.registerUser', 'false',         'Y', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '是否开启注册用户功能');
 
 
 -- ----------------------------