Jelajahi Sumber

mysql迁移pgsql所遇问题修改:
①类型比对不合适的sql文件修改,需要强类型转换
②伪删除标记等相关逻辑数值字段数据库未设默认值,导致逻辑报错,已修改
③部门添加bug解决
④使用ANY函数时数据类型不匹配bug解决,需强类型转换
⑤忘记密码代码逻辑错误,原逻辑将已加密MD5串再次加密,无法作密码比对,已修改
⑥整体项目功能业务逻辑测试并修改bug, 分页插件PageHandel更改Sql方言即可

1037015548@qq.com 2 tahun lalu
induk
melakukan
7b828f7289
39 mengubah file dengan 192 tambahan dan 133 penghapusan
  1. 9 3
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ForgetPasswordController.java
  2. 23 1
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
  3. 1 1
      ruoyi-admin/src/main/resources/application-test.yml
  4. 2 1
      ruoyi-admin/src/main/resources/application.yml
  5. 3 0
      ruoyi-admin/src/main/resources/templates/system/apply/add.html
  6. 2 2
      ruoyi-admin/src/main/resources/templates/system/dept/add.html
  7. 1 1
      ruoyi-admin/src/main/resources/templates/system/dept/dept.html
  8. 23 20
      ruoyi-admin/src/main/resources/templates/system/feedback/add.html
  9. 1 1
      ruoyi-admin/src/main/resources/templates/system/user/add.html
  10. 1 1
      ruoyi-admin/src/main/resources/templates/system/user/edit.html
  11. 4 4
      ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java
  12. 1 4
      ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java
  13. 8 3
      ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/service/SysPasswordService.java
  14. 5 5
      ruoyi-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml
  15. 4 4
      ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml
  16. 2 2
      ruoyi-quartz/src/main/resources/mapper/quartz/SysJobLogMapper.xml
  17. 3 3
      ruoyi-quartz/src/main/resources/mapper/quartz/SysJobMapper.xml
  18. 4 4
      ruoyi-system/src/main/java/com/ruoyi/system/domain/SysPost.java
  19. 25 4
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java
  20. 10 7
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java
  21. 2 2
      ruoyi-system/src/main/resources/mapper/system/ApplyChildMapper.xml
  22. 2 2
      ruoyi-system/src/main/resources/mapper/system/ApplyMapper.xml
  23. 2 2
      ruoyi-system/src/main/resources/mapper/system/DanganFileMapper.xml
  24. 2 2
      ruoyi-system/src/main/resources/mapper/system/DanganMapper.xml
  25. 2 2
      ruoyi-system/src/main/resources/mapper/system/FeedbackFileMapper.xml
  26. 2 2
      ruoyi-system/src/main/resources/mapper/system/FeedbackMapper.xml
  27. 2 2
      ruoyi-system/src/main/resources/mapper/system/ForgetPasswordMapper.xml
  28. 3 3
      ruoyi-system/src/main/resources/mapper/system/SysConfigMapper.xml
  29. 5 7
      ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml
  30. 3 3
      ruoyi-system/src/main/resources/mapper/system/SysDictDataMapper.xml
  31. 2 2
      ruoyi-system/src/main/resources/mapper/system/SysDictTypeMapper.xml
  32. 2 2
      ruoyi-system/src/main/resources/mapper/system/SysLogininforMapper.xml
  33. 2 2
      ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml
  34. 3 3
      ruoyi-system/src/main/resources/mapper/system/SysNoticeMapper.xml
  35. 2 2
      ruoyi-system/src/main/resources/mapper/system/SysOperLogMapper.xml
  36. 6 6
      ruoyi-system/src/main/resources/mapper/system/SysPostMapper.xml
  37. 9 9
      ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml
  38. 7 7
      ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
  39. 2 2
      ruoyi-system/src/main/resources/mapper/system/UserRelateMapper.xml

+ 9 - 3
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ForgetPasswordController.java

@@ -6,12 +6,14 @@ import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.entity.SysUser;
 import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.exception.ServiceException;
 import com.ruoyi.common.utils.ShiroUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.shiro.service.SysPasswordService;
 import com.ruoyi.system.domain.ForgetPassword;
 import com.ruoyi.system.service.IForgetPasswordService;
 import com.ruoyi.system.service.ISysUserService;
+import org.apache.commons.lang3.ObjectUtils;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
@@ -152,11 +154,15 @@ public class ForgetPasswordController extends BaseController
     {
        int result=forgetPasswordService.updateForgetPassword(forgetPassword);
        if(result>0){
-           //修改用户表密码
+           ForgetPassword trueFP = forgetPasswordService.selectForgetPasswordById(forgetPassword.getpId());
+           if(ObjectUtils.isEmpty(trueFP)){
+                return error("该用户忘记密码操作信息不存在,请重试");
+           }
+           //修改用户表密码,再不修改密码的前提下重新加密存入,新的md5串, 已修改bug LX 2月21
            //通过登录名获取用户
-          SysUser user = userService.selectUserByLoginName(forgetPassword.getLoginName());
+          SysUser user = userService.selectUserByLoginName(trueFP.getLoginName());
            user.setSalt(ShiroUtils.randomSalt());
-           user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
+           user.setPassword(passwordService.encryptPassword(user.getLoginName(), trueFP.getConfirmPassword(), user.getSalt()));
            if (userService.resetUserPwd(user) > 0)
            {
                if (ShiroUtils.getUserId().longValue() == user.getUserId().longValue())

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

@@ -3,10 +3,12 @@ package com.ruoyi.web.controller.system;
 import java.util.List;
 import java.util.stream.Collectors;
 import org.apache.commons.lang3.ArrayUtils;
+import org.apache.commons.lang3.ObjectUtils;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.ModelMap;
+import org.springframework.util.CollectionUtils;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PathVariable;
@@ -334,11 +336,31 @@ public class SysUserController extends BaseController
      * 
      * @param deptId 部门ID
      */
+
+    /**
+     * @Author Lx
+     * @Description //TODO 选择部门树 (已修改部分逻辑)
+     * @Date 17:54 2023/2/20
+     * @Param
+     * @return
+     **/
     @RequiresPermissions("system:user:list")
     @GetMapping("/selectDeptTree/{deptId}")
     public String selectDeptTree(@PathVariable("deptId") Long deptId, ModelMap mmap)
     {
-        mmap.put("dept", deptService.selectDeptById(deptId));
+        SysDept deptParent = deptService.selectDeptById(deptId);//节点信息
+        //如果节点信息不存在, 那么就默认查parentid=0的唯一根节点, 避免报错
+        if(ObjectUtils.isEmpty(deptParent)){
+            //此查询条件查询出来的数据只会有一条
+            SysDept deptQuery = new SysDept();
+            deptQuery.setParentId(0L);
+            deptQuery.setDelFlag("0");
+            List<SysDept> depts = deptService.selectDeptList(deptQuery);
+            if(!CollectionUtils.isEmpty(depts)){
+                deptParent = depts.get(0);
+            }
+        }
+        mmap.put("dept", deptParent);
         return prefix + "/deptTree";
     }
 

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

@@ -52,7 +52,7 @@ spring:
             druid:
                 # 主库数据源 stringtype=unspecified 如果stringtype设置为 unspecified,参数将作为非类型值发送到服务器,并且服务器将尝试推断适当的类型。
                 master:
-                     url: jdbc:postgresql://119.96.165.176:5432/test_lixing?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false&allowMultiQueries=true&useGeneratedKeys=true
+                     url: jdbc:postgresql://119.96.165.176:5432/test_lixing?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false&allowMultiQueries=true&zeroDateTimeBehavior=convertToNull
                      username: postgres
                      password: kpr.23417.postgres
                 # 从库数据源

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

@@ -58,7 +58,8 @@ mybatis:
 
 # PageHelper分页插件
 pagehelper: 
-  helperDialect: mysql
+#  helperDialect: mysql
+  helperDialect: postgresql
   supportMethodsArguments: true
   params: count=countSql 
 

+ 3 - 0
ruoyi-admin/src/main/resources/templates/system/apply/add.html

@@ -80,6 +80,9 @@
 
         var bool = false;
         function loadEditTable(){
+            $.modal.alertWarning("此功能暂未开放");
+            $.modal.close();//关闭当前窗口
+            return;
             $('#table1').bootstrapTable('destroy');
             $('#table1').bootstrapTable({
                 method: 'post',

+ 2 - 2
ruoyi-admin/src/main/resources/templates/system/dept/add.html

@@ -9,12 +9,12 @@
 <body class="white-bg">
 <div class="wrapper wrapper-content animated fadeInRight ibox-content">
 	<form class="form-horizontal m" id="form-dept-add">
-		<input id="treeId" name="parentId" type="hidden" th:value="${dept.deptId}"   />
+		<input id="treeId" name="parentId" type="hidden" th:value="${dept!=null?dept.deptId:''}"   />
 		<div class="form-group">
 			<label class="col-sm-2 control-label">上级机构:</label>
 			<div class="col-sm-8">
 				<div class="input-group">
-					<input class="form-control" type="text" onclick="selectDeptTree()" id="treeName" readonly="true" th:value="${dept.deptName}">
+					<input class="form-control" type="text" onclick="selectDeptTree()" id="treeName" readonly="true" th:value="${dept!=null?dept.deptName:''}">
 					<span class="input-group-addon"><i class="fa fa-search"></i></span>
 				</div>
 			</div>

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

@@ -117,7 +117,7 @@
 		            title: '操作',
 		            align: 'left',
 		            formatter: function(value, row, index) {
-		                if (row.parentId != 0) {
+		                if (row.parentId != null) {
 		                    var actions = [];
 		                    actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.deptId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
 							actions.push('<a class="btn btn-info  btn-xs ' + addFlag + '" href="javascript:void(0)" onclick="$.operate.add(\'' + row.deptId + '\')"><i class="fa fa-plus"></i>新增</a> ');

+ 23 - 20
ruoyi-admin/src/main/resources/templates/system/feedback/add.html

@@ -50,40 +50,43 @@
             focusCleanup: true
         });
 
-        function uploadFile(){
+        function uploadFile() {
             var formData = new FormData();
             if ($('#file')[0].files[0] == null) {
                 $.modal.alertWarning("请先选择文件路径");
                 return false;
             }
-            var this_1=  document.getElementById('file');
-            var files = this_1.files;
-
-            for (var i = 0, len = files.length; i < len; i++) {
-                formData.append('files', files[i]);
-            }
+            // var this_1=  document.getElementById('file');
+            // var files = this_1.files;
+            //
+            // for (var i = 0, len = files.length; i < len; i++) {
+            //     formData.append('files', files[i]);
+            // }
+            // 将文件装入FormData对象
+            formData.append("file",$('#file')[0].files[0]);
             $.ajax({
-                url: ctx + "common/uploadMultipart",
+                url: ctx + "common/upload",
                 type: 'post',
                 cache: false,
                 data: formData,
                 processData: false,
                 contentType: false,
                 dataType: "json",
-                success: function(result) {
-                    console.log(result);
-                    if(result.code == '0'){
-                        $("#fileName").val(result.fileName);
-                        $("#filePath").val(result.url);
-                        if(result.fileName != null ){
-                            let names = result.fileName.split(",");
-                            let html='';
-                            for(let i = 0 ;i<names.length;i++) {
-                                html+= "<div>"+names[i]+"</div>";
+                success: function (result) {
+                    if (result.code == '0') {
+                        $("#fileName").val(result.newFileName);
+                        $("#filePath").val(result.fileName);
+                        var fileArr = new Array();
+                        var fileNames =result.newFileName;
+                        if(null!=fileNames && fileNames.length>0){
+                            $("#fileinfo").empty();
+                            fileArr = fileNames.split(",");
+                            for(var i=0;i<fileArr.length;i++){
+                                var html = "";
+                                html = "<input type='text' value='"+fileArr[i]+"' class='form-control' style='border: none;' readonly>";
+                                $("#fileinfo").append(html);
                             }
-                            $("#fileinfo").html(html);
                         }
-
                     }
                 }
             });

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

@@ -223,7 +223,7 @@
     /* 用户管理-新增-选择机构树 */
     function selectDeptTree() {
         var treeId = $("#treeId").val();
-        var deptId = $.common.isEmpty(treeId) ? "100" : $("#treeId").val();
+        var deptId = $.common.isEmpty(treeId) ? "1" : $("#treeId").val();
         var url = ctx + "system/user/selectDeptTree/" + deptId;
         var options = {
             title: '选择机构',

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

@@ -180,7 +180,7 @@
     /* 用户管理-新增-选择机构树 */
     function selectDeptTree() {
         var treeId = $("#treeId").val();
-        var deptId = $.common.isEmpty(treeId) ? "100" : $("#treeId").val();
+        var deptId = $.common.isEmpty(treeId) ? "1" : $("#treeId").val();
         var url = ctx + "system/user/selectDeptTree/" + deptId;
         var options = {
             title: '选择机构',

+ 4 - 4
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java

@@ -29,7 +29,7 @@ public class SysMenu extends BaseEntity
     private Long parentId;
 
     /** 显示顺序 */
-    private String orderNum;
+    private Integer orderNum;
 
     /** 菜单URL */
     private String url;
@@ -97,13 +97,13 @@ public class SysMenu extends BaseEntity
         this.parentId = parentId;
     }
 
-    @NotBlank(message = "显示顺序不能为空")
-    public String getOrderNum()
+//    @NotBlank(message = "显示顺序不能为空")
+    public Integer getOrderNum()
     {
         return orderNum;
     }
 
-    public void setOrderNum(String orderNum)
+    public void setOrderNum(Integer orderNum)
     {
         this.orderNum = orderNum;
     }

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

@@ -120,11 +120,8 @@ public class DataScopeAspect
             }
             else if (DATA_SCOPE_DEPT_AND_CHILD.equals(dataScope))
             {
-//                sqlString.append(StringUtils.format(
-//                        " OR {}.dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} or find_in_set( {} , ancestors ) )",
-//                        deptAlias, user.getDeptId(), user.getDeptId()));
                   sqlString.append(StringUtils.format(
-                        " OR {}.dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} or {} = ANY (string_to_array(ancestors, ','))",
+                        " OR {}.dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} or {}::VARCHAR = ANY (string_to_array(ancestors, ','))",
                         deptAlias, user.getDeptId(), user.getDeptId()));
             }
             else if (DATA_SCOPE_SELF.equals(dataScope))

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

@@ -2,6 +2,8 @@ package com.ruoyi.framework.shiro.service;
 
 import java.util.concurrent.atomic.AtomicInteger;
 import javax.annotation.PostConstruct;
+
+import com.ruoyi.common.utils.ShiroUtils;
 import org.apache.shiro.cache.Cache;
 import org.apache.shiro.cache.CacheManager;
 import org.apache.shiro.crypto.hash.Md5Hash;
@@ -85,9 +87,12 @@ public class SysPasswordService
 
 
     public static void main(String[] args) {
-
-        String s = new Md5Hash("bbccji11a4013f-ef35-4523-9da8-6ca2b963bb03").toHex();
-        System.out.println(s);
+        SysPasswordService passwordService  = new SysPasswordService();
+        String salt = ShiroUtils.randomSalt();
+        System.out.println(salt);
+        String md5Str = passwordService.encryptPassword("testUser2", "Lx990324", "c11950");
+        System.out.println(md5Str);
+        System.out.println("e6fad733dd5713d98b5a5719bfe61c2d".equals(md5Str));
 
     }
 

+ 5 - 5
ruoyi-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml

@@ -45,7 +45,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		order by ordinal_position
 	</select>
     
-    <insert id="insertGenTableColumn" parameterType="GenTableColumn" useGeneratedKeys="true" keyProperty="columnId">
+    <insert id="insertGenTableColumn" parameterType="GenTableColumn" useGeneratedKeys="true" keyProperty="columnId" keyColumn="column_id">
         insert into gen_table_column (
 			<if test="tableId != null and tableId != ''">table_id,</if>
 			<if test="columnName != null and columnName != ''">column_name,</if>
@@ -85,7 +85,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 			<if test="dictType != null and dictType != ''">#{dictType},</if>
 			<if test="sort != null">#{sort},</if>
 			<if test="createBy != null and createBy != ''">#{createBy},</if>
-            now()
+            LOCALTIMESTAMP(0)
          )
     </insert>
 	 
@@ -105,20 +105,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             dict_type = #{dictType},
             sort = #{sort},
             update_by = #{updateBy},
-            update_time = now()
+            update_time = LOCALTIMESTAMP(0)
         </set>
         where column_id = #{columnId}
     </update>
 
     <delete id="deleteGenTableColumnByIds" parameterType="Long">
-        delete from gen_table_column where table_id in 
+        delete from gen_table_column where table_id in
         <foreach collection="array" item="tableId" open="(" separator="," close=")">
             #{tableId}
         </foreach>
     </delete>
 
     <delete id="deleteGenTableColumns">
-        delete from gen_table_column where column_id in 
+        delete from gen_table_column where column_id in
         <foreach collection="list" item="item" open="(" separator="," close=")">
             #{item.columnId}
         </foreach>

+ 4 - 4
ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml

@@ -122,7 +122,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		order by c.sort
 	</select>
 	
-	<insert id="insertGenTable" parameterType="GenTable" useGeneratedKeys="true" keyProperty="tableId">
+	<insert id="insertGenTable" parameterType="GenTable" useGeneratedKeys="true" keyProperty="tableId" keyColumn="table_id">
         insert into gen_table (
 			<if test="tableName != null">table_name,</if>
 			<if test="tableComment != null and tableComment != ''">table_comment,</if>
@@ -152,7 +152,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 			<if test="genPath != null and genPath != ''">#{genPath},</if>
 			<if test="remark != null and remark != ''">#{remark},</if>
  			<if test="createBy != null and createBy != ''">#{createBy},</if>
-			now()
+			LOCALTIMESTAMP(0)
          )
     </insert>
 
@@ -179,13 +179,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="options != null and options != ''">options = #{options},</if>
             <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
             <if test="remark != null">remark = #{remark},</if>
-            update_time = now()
+            update_time = LOCALTIMESTAMP(0)
         </set>
         where table_id = #{tableId}
     </update>
     
     <delete id="deleteGenTableByIds" parameterType="Long">
-        delete from gen_table where table_id in 
+        delete from gen_table where table_id in
         <foreach collection="array" item="tableId" open="(" separator="," close=")">
             #{tableId}
         </foreach>

+ 2 - 2
ruoyi-quartz/src/main/resources/mapper/quartz/SysJobLogMapper.xml

@@ -58,7 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  	</delete>
  	
  	<delete id="deleteJobLogByIds" parameterType="String">
- 		delete from sys_job_log where job_log_id in
+ 		delete from sys_job_log where job_log_id::VARCHAR in
  		<foreach collection="array" item="jobLogId" open="(" separator="," close=")">
  			#{jobLogId}
         </foreach> 
@@ -86,7 +86,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="jobMessage != null and jobMessage != ''">#{jobMessage},</if>
  			<if test="status != null and status != ''">#{status},</if>
  			<if test="exceptionInfo != null and exceptionInfo != ''">#{exceptionInfo},</if>
-			now()
+			LOCALTIMESTAMP(0)
  		)
 	</insert>
 

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

@@ -75,12 +75,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="status !=null">status = #{status},</if>
  			<if test="remark != null and remark != ''">remark = #{remark},</if>
  			<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
- 			update_time = now()
+ 			update_time = LOCALTIMESTAMP(0)
  		</set>
  		where job_id = #{jobId}
 	</update>
  	
- 	<insert id="insertJob" parameterType="SysJob" useGeneratedKeys="true" keyProperty="jobId">
+ 	<insert id="insertJob" parameterType="SysJob" useGeneratedKeys="true" keyProperty="jobId" keyColumn="job_id">
  		insert into sys_job(
  			<if test="jobId != null and jobId != 0">job_id,</if>
  			<if test="jobName != null and jobName != ''">job_name,</if>
@@ -104,7 +104,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="status != null and status != ''">#{status},</if>
  			<if test="remark != null and remark != ''">#{remark},</if>
  			<if test="createBy != null and createBy != ''">#{createBy},</if>
-			now()
+			LOCALTIMESTAMP(0)
  		)
 	</insert>
 

+ 4 - 4
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysPost.java

@@ -30,7 +30,7 @@ public class SysPost extends BaseEntity
 
     /** 岗位排序 */
     @Excel(name = "岗位排序", cellType = ColumnType.NUMERIC)
-    private String postSort;
+    private Integer postSort;
 
     /** 状态(0正常 1停用) */
     @Excel(name = "状态", readConverterExp = "0=正常,1=停用")
@@ -73,13 +73,13 @@ public class SysPost extends BaseEntity
         this.postName = postName;
     }
 
-    @NotBlank(message = "显示顺序不能为空")
-    public String getPostSort()
+//    @NotBlank(message = "显示顺序不能为空")
+    public Integer getPostSort()
     {
         return postSort;
     }
 
-    public void setPostSort(String postSort)
+    public void setPostSort(Integer postSort)
     {
         this.postSort = postSort;
     }

+ 25 - 4
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java

@@ -3,6 +3,7 @@ package com.ruoyi.system.service.impl;
 import java.util.ArrayList;
 import java.util.List;
 import org.apache.commons.lang3.ArrayUtils;
+import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -19,6 +20,7 @@ import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.spring.SpringUtils;
 import com.ruoyi.system.mapper.SysDeptMapper;
 import com.ruoyi.system.service.ISysDeptService;
+import org.springframework.util.CollectionUtils;
 
 /**
  * 部门管理 服务实现
@@ -191,15 +193,34 @@ public class SysDeptServiceImpl implements ISysDeptService
      * @return 结果
      */
     @Override
+    @Transactional
     public int insertDept(SysDept dept)
     {
         SysDept info = deptMapper.selectDeptById(dept.getParentId());
         // 如果父节点不为"正常"状态,则不允许新增子节点
-        if (!UserConstants.DEPT_NORMAL.equals(info.getStatus()))
-        {
-            throw new ServiceException("部门停用,不允许新增");
+        if(!ObjectUtils.isEmpty(info)) {
+            if (!UserConstants.DEPT_NORMAL.equals(info.getStatus())) {
+                throw new ServiceException("部门停用,不允许新增");
+            }
+        }else{
+            if(ObjectUtils.isEmpty(dept.getParentId())&&ObjectUtils.isEmpty(info)){
+                //说明无选择上级组织的部门
+                dept.setParentId(0L);
+                SysDept infoTip = new SysDept();
+                infoTip.setParentId(0L);
+                infoTip.setDelFlag("0");
+                List<SysDept> infoQuery = deptMapper.selectDeptList(infoTip);
+                if(!CollectionUtils.isEmpty(infoQuery)){
+                    throw new ServiceException("请选择上级机构再新增");
+                }
+            }
+        }
+        if(ObjectUtils.isEmpty(info)){
+            dept.setAncestors("0");
+        }else {
+            dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
         }
-        dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
+//        throw new ServiceException("测试");
         return deptMapper.insertDept(dept);
     }
 

+ 10 - 7
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java

@@ -20,6 +20,7 @@ import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.system.mapper.SysMenuMapper;
 import com.ruoyi.system.mapper.SysRoleMenuMapper;
 import com.ruoyi.system.service.ISysMenuService;
+import org.springframework.util.ObjectUtils;
 
 /**
  * 菜单 业务层处理
@@ -353,10 +354,11 @@ public class SysMenuServiceImpl implements ISysMenuService
         {
             SysMenu t = (SysMenu) iterator.next();
             // 一、根据传入的某个父节点ID,遍历该父节点的所有子节点
-            if (t.getParentId() == parentId)
-            {
-                recursionFn(list, t);
-                returnList.add(t);
+            if(!ObjectUtils.isEmpty(t.getParentId())) {
+                if (t.getParentId() == parentId) {
+                    recursionFn(list, t);
+                    returnList.add(t);
+                }
             }
         }
         return returnList;
@@ -392,9 +394,10 @@ public class SysMenuServiceImpl implements ISysMenuService
         while (it.hasNext())
         {
             SysMenu n = (SysMenu) it.next();
-            if (n.getParentId().longValue() == t.getMenuId().longValue())
-            {
-                tlist.add(n);
+            if(!ObjectUtils.isEmpty(n.getParentId())&&!ObjectUtils.isEmpty(t.getMenuId())) {
+                if (n.getParentId().longValue() == t.getMenuId().longValue()) {
+                    tlist.add(n);
+                }
             }
         }
         return tlist;

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

@@ -35,7 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where ac.child_id = #{childId}
     </select>
         
-    <insert id="insertApplyChild" parameterType="ApplyChild" useGeneratedKeys="true" keyProperty="childId">
+    <insert id="insertApplyChild" parameterType="ApplyChild" useGeneratedKeys="true" keyProperty="childId" keyColumn="child_id">
         insert into sys_apply_child
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="applyId != null">apply_id,</if>
@@ -70,7 +70,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteApplyChildByIds" parameterType="String">
-        delete from sys_apply_child where child_id in 
+        delete from sys_apply_child where child_id::VARCHAR in
         <foreach item="childId" collection="array" open="(" separator="," close=")">
             #{childId}
         </foreach>

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

@@ -51,7 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where a.apply_id = #{applyId}
     </select>
         
-    <insert id="insertApply" parameterType="Apply" useGeneratedKeys="true" keyProperty="applyId">
+    <insert id="insertApply" parameterType="Apply" useGeneratedKeys="true" keyProperty="applyId" keyColumn="apply_id">
         insert into sys_apply
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="userId != null">user_id,</if>
@@ -101,7 +101,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteApplyByIds" parameterType="String">
-        delete from sys_apply where apply_id in 
+        delete from sys_apply where apply_id::VARCHAR in
         <foreach item="applyId" collection="array" open="(" separator="," close=")">
             #{applyId}
         </foreach>

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

@@ -29,7 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where file_id = #{fileId}
     </select>
         
-    <insert id="insertDanganFile" parameterType="DanganFile" useGeneratedKeys="true" keyProperty="fileId">
+    <insert id="insertDanganFile" parameterType="DanganFile" useGeneratedKeys="true" keyProperty="fileId" keyColumn="file_id">
         insert into sys_dangan_file
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="fileName != null">file_name,</if>
@@ -63,7 +63,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
 
     <delete id="deleteDanganFileByIds" parameterType="String">
-        delete from sys_dangan_file where file_id in 
+        delete from sys_dangan_file where file_id::VARCHAR in
         <foreach item="fileId" collection="array" open="(" separator="," close=")">
             #{fileId}
         </foreach>

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

@@ -99,7 +99,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where dangan_id = #{danganId}
     </select>
         
-    <insert id="insertDangan" parameterType="Dangan" useGeneratedKeys="true" keyProperty="danganId">
+    <insert id="insertDangan" parameterType="Dangan" useGeneratedKeys="true" keyProperty="danganId" keyColumn="dangan_id">
         insert into sys_dangan
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="danganName != null">dangan_name,</if>
@@ -236,7 +236,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteDanganByIds" parameterType="String">
-        delete from sys_dangan where dangan_id in
+        delete from sys_dangan where dangan_id::VARCHAR in
         <foreach item="danganId" collection="array" open="(" separator="," close=")">
             #{danganId}
         </foreach>

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

@@ -29,7 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where file_id = #{fileId}
     </select>
         
-    <insert id="insertFeedbackFile" parameterType="FeedbackFile" useGeneratedKeys="true" keyProperty="fileId">
+    <insert id="insertFeedbackFile" parameterType="FeedbackFile" useGeneratedKeys="true" keyProperty="fileId" keyColumn="file_id">
         insert into sys_feedback_file
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="fileName != null">file_name,</if>
@@ -58,7 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteFeedbackFileByIds" parameterType="String">
-        delete from sys_feedback_file where file_id in 
+        delete from sys_feedback_file where file_id::VARCHAR in
         <foreach item="fileId" collection="array" open="(" separator="," close=")">
             #{fileId}
         </foreach>

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

@@ -53,7 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where f.feedback_id = #{feedbackId}
     </select>
         
-    <insert id="insertFeedback" parameterType="Feedback" useGeneratedKeys="true" keyProperty="feedbackId">
+    <insert id="insertFeedback" parameterType="Feedback" useGeneratedKeys="true" keyProperty="feedbackId" keyColumn="feedback_id">
         insert into sys_feedback
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="danganId != null">dangan_id,</if>
@@ -109,7 +109,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteFeedbackByIds" parameterType="String">
-        delete from sys_feedback where feedback_id in 
+        delete from sys_feedback where feedback_id::VARCHAR in
         <foreach item="feedbackId" collection="array" open="(" separator="," close=")">
             #{feedbackId}
         </foreach>

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

@@ -52,7 +52,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where p_id = #{pId}
     </select>
         
-    <insert id="insertForgetPassword" parameterType="ForgetPassword" useGeneratedKeys="true" keyProperty="pId">
+    <insert id="insertForgetPassword" parameterType="ForgetPassword" useGeneratedKeys="true" keyProperty="pId" keyColumn="p_id">
         insert into sys_forget_password
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="userName != null">user_name,</if>
@@ -108,7 +108,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteForgetPasswordByIds" parameterType="String">
-        delete from sys_forget_password where p_id in 
+        delete from sys_forget_password where p_id::VARCHAR in
         <foreach item="pId" collection="array" open="(" separator="," close=")">
             #{pId}
         </foreach>

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

@@ -80,7 +80,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 			<if test="configType != null and configType != ''">#{configType},</if>
 			<if test="createBy != null and createBy != ''">#{createBy},</if>
 			<if test="remark != null and remark != ''">#{remark},</if>
-			now()
+			LOCALTIMESTAMP(0)
 		)
     </insert>
 	 
@@ -93,7 +93,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="configType != null and configType != ''">config_type = #{configType},</if>
             <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
             <if test="remark != null">remark = #{remark},</if>
- 			update_time = now()
+ 			update_time = LOCALTIMESTAMP(0)
         </set>
         where config_id = #{configId}
     </update>
@@ -103,7 +103,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	</delete>
 	
     <delete id="deleteConfigByIds" parameterType="String">
-        delete from sys_config where config_id in 
+        delete from sys_config where config_id::VARCHAR in
         <foreach item="configId" collection="array" open="(" separator="," close=")">
         	#{configId}
         </foreach>

+ 5 - 7
ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml

@@ -93,13 +93,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	</select>
 
 	<select id="selectChildrenDeptById" parameterType="Long" resultMap="SysDeptResult">
-		/*select * from sys_dept where find_in_set(#{deptId}, ancestors)*/
-		select * from sys_dept where #{deptId} = ANY (string_to_array(ancestors, ','))
+		select * from sys_dept where #{deptId}::VARCHAR = ANY (string_to_array(ancestors, ','))
 	</select>
 	
 	<select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int">
-		/*select count(*) from sys_dept where status = 0 and del_flag = '0' and find_in_set(#{deptId}, ancestors)*/
-		select count(*) from sys_dept where status = '0' and del_flag = '0' and #{deptId} = ANY (string_to_array(ancestors, ','))
+		select count(*) from sys_dept where status = '0' and del_flag = '0' and #{deptId}::VARCHAR = ANY (string_to_array(ancestors, ','))
 	</select>
 	
 	<insert id="insertDept" parameterType="SysDept">
@@ -136,7 +134,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		<if test="city != null">#{city},</if>
 		<if test="town != null">#{town},</if>
 		<if test="street != null">#{street},</if>
-			now()
+			LOCALTIMESTAMP(0)
  		)
 	</insert>
 	
@@ -157,7 +155,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 			<if test="city != null">city = #{city},</if>
 			<if test="town != null">town = #{town},</if>
 			<if test="street != null">street = #{street},</if>
-			now()
+			update_time = LOCALTIMESTAMP(0)
  		</set>
  		where dept_id = #{deptId}
 	</update>
@@ -180,7 +178,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	</delete>
 	
 	<update id="updateDeptStatusNormal" parameterType="Long">
- 	    update sys_dept set status = '0' where dept_id in 
+ 	    update sys_dept set status = '0' where dept_id in
  	    <foreach collection="array" item="deptId" open="(" separator="," close=")">
         	#{deptId}
         </foreach>

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

@@ -64,7 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  	</delete>
 	
  	<delete id="deleteDictDataByIds" parameterType="String">
- 		delete from sys_dict_data where dict_code in
+ 		delete from sys_dict_data where dict_code::VARCHAR in
  		<foreach collection="array" item="dictCode" open="(" separator="," close=")">
  			#{dictCode}
         </foreach> 
@@ -83,7 +83,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="status != null">status = #{status},</if>
  			<if test="remark != null">remark = #{remark},</if>
  			<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
- 			update_time = now()
+ 			update_time = LOCALTIMESTAMP(0)
  		</set>
  		where dict_code = #{dictCode}
 	</update>
@@ -116,7 +116,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="status != null">#{status},</if>
  			<if test="remark != null and remark != ''">#{remark},</if>
  			<if test="createBy != null and createBy != ''">#{createBy},</if>
-			now()
+			LOCALTIMESTAMP(0)
  		)
 	</insert>
 	

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

@@ -79,7 +79,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="status != null">status = #{status},</if>
  			<if test="remark != null">remark = #{remark},</if>
  			<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
-			now()
+			update_time = LOCALTIMESTAMP(0)
  		</set>
  		where dict_id = #{dictId}
 	</update>
@@ -98,7 +98,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="status != null">#{status},</if>
  			<if test="remark != null and remark != ''">#{remark},</if>
  			<if test="createBy != null and createBy != ''">#{createBy},</if>
-			now()
+			LOCALTIMESTAMP(0)
  		)
 	</insert>
 	

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

@@ -18,7 +18,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
 	<insert id="insertLogininfor" parameterType="SysLogininfor">
 		insert into sys_logininfor (login_name, status, ipaddr, login_location, browser, os, msg, login_time)
-		values (#{loginName}, #{status}, #{ipaddr}, #{loginLocation}, #{browser}, #{os}, #{msg}, now())
+		values (#{loginName}, #{status}, #{ipaddr}, #{loginLocation}, #{browser}, #{os}, #{msg}, LOCALTIMESTAMP(0))
 	</insert>
 	
 	<select id="selectLogininforList" parameterType="SysLogininfor" resultMap="SysLogininforResult">
@@ -43,7 +43,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	</select>
 	
 	<delete id="deleteLogininforByIds" parameterType="String">
- 		delete from sys_logininfor where info_id in
+ 		delete from sys_logininfor where info_id::VARCHAR in
  		<foreach collection="array" item="infoId" open="(" separator="," close=")">
  			#{infoId}
         </foreach> 

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

@@ -149,7 +149,7 @@
 			<if test="icon !=null and icon != ''">icon = #{icon},</if>
 			<if test="remark != null">remark = #{remark},</if>
 			<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
-			update_time = now()
+			update_time = LOCALTIMESTAMP(0)
 		</set>
 		where menu_id = #{menuId}
 	</update>
@@ -184,7 +184,7 @@
 		<if test="icon != null and icon != ''">#{icon},</if>
 		<if test="remark != null and remark != ''">#{remark},</if>
 		<if test="createBy != null and createBy != ''">#{createBy},</if>
-		now()
+		LOCALTIMESTAMP(0)
 		)
 	</insert>
 

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

@@ -58,7 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 			<if test="status != null and status != ''">#{status}, </if>
 			<if test="remark != null and remark != ''">#{remark},</if>
  			<if test="createBy != null and createBy != ''">#{createBy},</if>
-            now()
+            LOCALTIMESTAMP(0)
 		)
     </insert>
 	 
@@ -70,13 +70,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="noticeContent != null">notice_content = #{noticeContent}, </if>
             <if test="status != null and status != ''">status = #{status}, </if>
             <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
- 			update_time = now()
+ 			update_time = LOCALTIMESTAMP(0)
         </set>
         where notice_id = #{noticeId}
     </update>
 	
     <delete id="deleteNoticeByIds" parameterType="String">
-        delete from sys_notice where notice_id in 
+        delete from sys_notice where notice_id::VARCHAR in
         <foreach item="noticeId" collection="array" open="(" separator="," close=")">
             #{noticeId}
         </foreach>

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

@@ -30,7 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     
 	<insert id="insertOperlog" parameterType="SysOperLog">
 		insert into sys_oper_log(title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, json_result, status, error_msg, oper_time)
-        values (#{title}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operLocation}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg}, now())
+        values (#{title}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operLocation}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg}, LOCALTIMESTAMP(0))
 	</insert>
 	
 	<select id="selectOperLogList" parameterType="SysOperLog" resultMap="SysOperLogResult">
@@ -64,7 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	</select>
 	
 	<delete id="deleteOperLogByIds" parameterType="String">
- 		delete from sys_oper_log where oper_id in
+ 		delete from sys_oper_log where oper_id::VARCHAR in
  		<foreach collection="array" item="operId" open="(" separator="," close=")">
  			#{operId}
         </foreach> 

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

@@ -76,21 +76,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  		<set>
  			<if test="postCode != null and postCode != ''">post_code = #{postCode},</if>
  			<if test="postName != null and postName != ''">post_name = #{postName},</if>
- 			<if test="postSort != null and postSort != ''">post_sort = #{postSort},</if>
+ 			<if test="postSort != null ">post_sort = #{postSort},</if>
  			<if test="status != null and status != ''">status = #{status},</if>
  			<if test="remark != null">remark = #{remark},</if>
  			<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
- 			update_time = now()
+ 			update_time = LOCALTIMESTAMP(0)
  		</set>
  		where post_id = #{postId}
 	</update>
  	
- 	<insert id="insertPost" parameterType="SysPost" useGeneratedKeys="true" keyProperty="postId">
+ 	<insert id="insertPost" parameterType="SysPost" useGeneratedKeys="true" keyProperty="postId" keyColumn="post_id">
  		insert into sys_post(
  			<if test="postId != null and postId != 0">post_id,</if>
  			<if test="postCode != null and postCode != ''">post_code,</if>
  			<if test="postName != null and postName != ''">post_name,</if>
- 			<if test="postSort != null and postSort != ''">post_sort,</if>
+ 			<if test="postSort != null">post_sort,</if>
  			<if test="status != null and status != ''">status,</if>
  			<if test="remark != null and remark != ''">remark,</if>
  			<if test="createBy != null and createBy != ''">create_by,</if>
@@ -99,11 +99,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="postId != null and postId != 0">#{postId},</if>
  			<if test="postCode != null and postCode != ''">#{postCode},</if>
  			<if test="postName != null and postName != ''">#{postName},</if>
- 			<if test="postSort != null and postSort != ''">#{postSort},</if>
+ 			<if test="postSort != null">#{postSort},</if>
  			<if test="status != null and status != ''">#{status},</if>
  			<if test="remark != null and remark != ''">#{remark},</if>
  			<if test="createBy != null and createBy != ''">#{createBy},</if>
-			now()
+			LOCALTIMESTAMP(0)
  		)
 	</insert>
 

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

@@ -6,9 +6,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
 	<resultMap type="SysRole" id="SysRoleResult">
 		<id     property="roleId"       column="role_id"        />
-		<result property="roleName"     column="role_name"      />
+		<result property="roleName"     column="role_name"   jdbcType="VARCHAR"   />
 		<result property="roleKey"      column="role_key"       />
-		<result property="roleSort"     column="role_sort"   javaType="java.lang.Integer" jdbcType="INTEGER"   />
+		<result property="roleSort"     column="role_sort"     />
 		<result property="dataScope"    column="data_scope"     />
 		<result property="status"       column="status"         />
 		<result property="delFlag"      column="del_flag"       />
@@ -58,7 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 			and to_date(r.create_time,'YY-MM-DD') &lt;= to_date(#{params.endTime},'YY-MM-DD')
 		</if>
 		<!-- 数据范围过滤 -->
-		${params.dataScope}
+		 ${params.dataScope}
 	</select>
 
 	<select id="selectRolesByUserId" parameterType="Long" resultMap="SysRoleResult">
@@ -97,22 +97,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  		<set>
  			<if test="roleName != null and roleName != ''">role_name = #{roleName},</if>
  			<if test="roleKey != null and roleKey != ''">role_key = #{roleKey},</if>
- 			<if test="roleSort != null and roleSort != ''">role_sort = #{roleSort},</if>
+ 			<if test="roleSort != null">role_sort = #{roleSort},</if>
  			<if test="dataScope != null and dataScope != ''">data_scope = #{dataScope},</if>
  			<if test="status != null and status != ''">status = #{status},</if>
  			<if test="remark != null">remark = #{remark},</if>
  			<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
- 			update_time = now()
+ 			update_time = LOCALTIMESTAMP(0)
  		</set>
  		where role_id = #{roleId}
 	</update>
  	
- 	<insert id="insertRole" parameterType="SysRole" useGeneratedKeys="true" keyProperty="roleId">
+ 	<insert id="insertRole" parameterType="SysRole" useGeneratedKeys="true" keyProperty="roleId" keyColumn="role_id">
  		insert into sys_role(
  			<if test="roleId != null and roleId != 0">role_id,</if>
  			<if test="roleName != null and roleName != ''">role_name,</if>
  			<if test="roleKey != null and roleKey != ''">role_key,</if>
- 			<if test="roleSort != null and roleSort != ''">role_sort,</if>
+ 			<if test="roleSort != null">role_sort,</if>
  			<if test="dataScope != null and dataScope != ''">data_scope,</if>
  			<if test="status != null and status != ''">status,</if>
  			<if test="remark != null and remark != ''">remark,</if>
@@ -122,12 +122,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="roleId != null and roleId != 0">#{roleId},</if>
  			<if test="roleName != null and roleName != ''">#{roleName},</if>
  			<if test="roleKey != null and roleKey != ''">#{roleKey},</if>
- 			<if test="roleSort != null and roleSort != ''">#{roleSort},</if>
+ 			<if test="roleSort != null">#{roleSort},</if>
  			<if test="dataScope != null and dataScope != ''">#{dataScope},</if>
  			<if test="status != null and status != ''">#{status},</if>
  			<if test="remark != null and remark != ''">#{remark},</if>
  			<if test="createBy != null and createBy != ''">#{createBy},</if>
-			now()
+			LOCALTIMESTAMP(0)
  		)
 	</insert>
 	

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

@@ -86,10 +86,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 			AND to_date(u.create_time,'YY-MM-DD') &lt;= to_date(#{params.endTime},'YY-MM-DD')
 		</if>
 		<if test="deptId != null and deptId != 0">
-			AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE FIND_IN_SET (#{deptId},ancestors) ))
+			AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE #{deptId}::VARCHAR = ANY (string_to_array(ancestors, ','))))
 		</if>
 		<!-- 数据范围过滤 -->
-		${params.dataScope}
+		 ${params.dataScope}
 	</select>
 	
 	<select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult">
@@ -192,12 +192,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 			<if test="usbkey != null">usbkey = #{usbkey},</if>
 			<if test="orderNum != null">order_num = #{orderNum},</if>
 
-			update_time = now()
+			update_time = LOCALTIMESTAMP(0)
  		</set>
  		where user_id = #{userId}
 	</update>
  	
- 	<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
+ 	<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId" keyColumn="user_id">
  		insert into sys_user(
  			<if test="userId != null and userId != 0">user_id,</if>
  			<if test="deptId != null and deptId != 0">dept_id,</if>
@@ -215,7 +215,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="createBy != null and createBy != ''">create_by,</if>
  			<if test="remark != null and remark != ''">remark,</if>
 		<if test="usbkey != null and usbkey != ''">usbkey,</if>
-		<if test="orderNum != null and orderNum != ''">order_num,</if>
+		<if test="orderNum != null">order_num,</if>
 
  			create_time
  		)values(
@@ -235,10 +235,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="createBy != null and createBy != ''">#{createBy},</if>
  			<if test="remark != null and remark != ''">#{remark},</if>
 		<if test="usbkey != null and usbkey != ''">#{usbkey},</if>
-		<if test="orderNum != null and orderNum != ''">#{orderNum},</if>
+		<if test="orderNum != null">#{orderNum},</if>
 
 
-		now()
+		LOCALTIMESTAMP(0)
  		)
 	</insert>
 	

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

@@ -69,7 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where ur.relate_id = #{relateId}
     </select>
         
-    <insert id="insertUserRelate" parameterType="UserRelate" useGeneratedKeys="true" keyProperty="relateId">
+    <insert id="insertUserRelate" parameterType="UserRelate" useGeneratedKeys="true" keyProperty="relateId" keyColumn="relate_id">
         insert into sys_user_relate
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="userId != null">user_id,</if>
@@ -128,7 +128,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteUserRelateByIds" parameterType="String">
-        delete from sys_user_relate where relate_id in 
+        delete from sys_user_relate where relate_id::VARCHAR in
         <foreach item="relateId" collection="array" open="(" separator="," close=")">
             #{relateId}
         </foreach>