Procházet zdrojové kódy

mysql-pgsql 迁移

1037015548@qq.com před 2 roky
rodič
revize
2aea1fc20e

+ 2 - 1
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserOnlineMapper.java

@@ -1,5 +1,6 @@
 package com.ruoyi.system.mapper;
 
+import java.sql.Timestamp;
 import java.util.List;
 import com.ruoyi.system.domain.SysUserOnline;
 
@@ -48,5 +49,5 @@ public interface SysUserOnlineMapper
      * @param lastAccessTime 过期时间
      * @return 会话集合
      */
-    public List<SysUserOnline> selectOnlineByExpired(String lastAccessTime);
+    public List<SysUserOnline> selectOnlineByExpired(Timestamp lastAccessTime);
 }

+ 2 - 1
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserOnlineServiceImpl.java

@@ -1,6 +1,7 @@
 package com.ruoyi.system.service.impl;
 
 import java.io.Serializable;
+import java.sql.Timestamp;
 import java.util.Date;
 import java.util.Deque;
 import java.util.List;
@@ -136,6 +137,6 @@ public class SysUserOnlineServiceImpl implements ISysUserOnlineService
     public List<SysUserOnline> selectOnlineByExpired(Date expiredDate)
     {
         String lastAccessTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, expiredDate);
-        return userOnlineDao.selectOnlineByExpired(lastAccessTime);
+        return userOnlineDao.selectOnlineByExpired(Timestamp.valueOf(lastAccessTime));
     }
 }

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

@@ -38,10 +38,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="dealStatus != null  and dealStatus != ''"> and a.deal_status = #{dealStatus}</if>
             <if test="status != null  and status != ''"> and a.status = #{status}</if>
             <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
-                AND date_format(a.apply_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
+                AND to_date(a.apply_time,'YY-MM-DD') &gt;= to_date(#{params.beginTime},'YY-MM-DD')
             </if>
             <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
-                AND date_format(a.apply_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
+                AND to_date(a.apply_time,'YY-MM-DD') &lt;= to_date(#{params.endTime},'YY-MM-DD')
             </if>
         </where>
     </select>

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

@@ -40,10 +40,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="feedbackTime != null "> and f.feedback_time = #{feedbackTime}</if>
             <if test="status != null  and status != ''"> and f.status = #{status}</if>
             <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
-                AND date_format(f.feedback_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
+                AND to_date(f.feedback_time,'YY-MM-DD') &gt;= to_date(#{params.beginTime},'YY-MM-DD')
             </if>
             <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
-                AND date_format(f.feedback_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
+                AND to_date(f.feedback_time,'YY-MM-DD') &lt;= to_date(#{params.endTime},'YY-MM-DD')
             </if>
         </where>
     </select>

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

@@ -39,10 +39,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="applyTime != null "> and p.apply_time = #{applyTime}</if>
             <if test="status != null  and status != ''"> and p.status = #{status}</if>
             <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
-                AND date_format(p.apply_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
+                AND to_date(p.apply_time,'YY-MM-DD') &gt;= to_date(#{params.beginTime},'YY-MM-DD')
             </if>
             <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
-                AND date_format(p.apply_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
+                AND to_date(p.apply_time,'YY-MM-DD') &lt;= to_date(#{params.endTime},'YY-MM-DD')
             </if>
         </where>
     </select>

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

@@ -51,10 +51,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 				AND config_key like concat('%', #{configKey}, '%')
 			</if>
 			<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
-				and date_format(create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
+				and to_date(create_time,'YY-MM-DD') &gt;= to_date(#{params.beginTime},'YY-MM-DD')
 			</if>
 			<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
-				and date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
+				and to_date(create_time,'YY-MM-DD') &lt;= to_date(#{params.endTime},'YY-MM-DD')
 			</if>
 		</where>
     </select>
@@ -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>
- 			sysdate()
+			now()
 		)
     </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 = sysdate()
+ 			update_time = now()
         </set>
         where config_id = #{configId}
     </update>

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

@@ -93,11 +93,13 @@ 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 find_in_set(#{deptId}, ancestors)*/
+		select * from sys_dept where #{deptId} = 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 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>
 	
 	<insert id="insertDept" parameterType="SysDept">
@@ -134,7 +136,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>
- 			sysdate()
+			now()
  		)
 	</insert>
 	
@@ -155,7 +157,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>
- 			update_time = sysdate()
+			now()
  		</set>
  		where dept_id = #{deptId}
 	</update>

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

@@ -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 = sysdate()
+ 			update_time = now()
  		</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>
- 			sysdate()
+			now()
  		)
 	</insert>
 	

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

@@ -33,10 +33,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 				AND dict_type like concat('%', #{dictType}, '%')
 			</if>
 			<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
-				and date_format(create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
+				and to_date(create_time,'YY-MM-DD') &gt;= to_date(#{params.beginTime},'YY-MM-DD')
 			</if>
 			<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
-				and date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
+				and to_date(create_time,'YY-MM-DD') &lt;= to_date(#{params.endTime},'YY-MM-DD')
 			</if>
 	    </where>
 	</select>
@@ -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>
- 			update_time = sysdate()
+			now()
  		</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>
- 			sysdate()
+			now()
  		)
 	</insert>
 	

+ 3 - 3
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}, sysdate())
+		values (#{loginName}, #{status}, #{ipaddr}, #{loginLocation}, #{browser}, #{os}, #{msg}, now())
 	</insert>
 	
 	<select id="selectLogininforList" parameterType="SysLogininfor" resultMap="SysLogininforResult">
@@ -34,10 +34,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 				AND login_name like concat('%', #{loginName}, '%')
 			</if>
 			<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
-				and date_format(login_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
+				and to_date(login_time,'YY-MM-DD') &gt;= to_date(#{params.beginTime},'YY-MM-DD')
 			</if>
 			<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
-				and date_format(login_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
+				and to_date(login_time,'YY-MM-DD') &lt;= to_date(#{params.endTime},'YY-MM-DD')
 			</if>
 		</where>
 	</select>

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

@@ -25,24 +25,24 @@
 	</resultMap>
 
 	<sql id="selectMenuVo">
-        select menu_id, menu_name, parent_id, order_num, url, target, menu_type, visible, is_refresh, ifnull(perms,'') as perms, icon, create_by, create_time 
+        select menu_id, menu_name, parent_id, order_num, url, target, menu_type, visible, is_refresh, COALESCE(perms,'') as perms, icon, create_by, create_time
 		from sys_menu
     </sql>
 
 	<select id="selectMenusByUserId" parameterType="Long" resultMap="SysMenuResult">
-		select distinct m.menu_id, m.parent_id, m.menu_name, m.url, m.visible, m.is_refresh, ifnull(m.perms,'') as perms, m.target, m.menu_type, m.icon, m.order_num, m.create_time
+		select distinct m.menu_id, m.parent_id, m.menu_name, m.url, m.visible, m.is_refresh, COALESCE(m.perms,'') as perms, m.target, m.menu_type, m.icon, m.order_num, m.create_time
 		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
 			 LEFT JOIN sys_role ro on ur.role_id = ro.role_id
-		where ur.user_id = #{userId} and m.menu_type in ('M', 'C') and m.visible = 0  AND ro.status = 0
+		where ur.user_id = #{userId} and m.menu_type in ('M', 'C') and m.visible = '0'  AND ro.status = '0'
 		order by m.parent_id, m.order_num
 	</select>
 
 	<select id="selectMenuNormalAll" resultMap="SysMenuResult">
-		select distinct m.menu_id, m.parent_id, m.menu_name, m.url, m.visible, m.is_refresh, ifnull(m.perms,'') as perms, m.target, m.menu_type, m.icon, m.order_num, m.create_time
+		select distinct m.menu_id, m.parent_id, m.menu_name, m.url, m.visible, m.is_refresh, COALESCE(m.perms,'') as perms, m.target, m.menu_type, m.icon, m.order_num, m.create_time
 		from sys_menu m
-		where m.menu_type in ('M', 'C') and m.visible = 0
+		where m.menu_type in ('M', 'C') and m.visible = '0'
 		order by m.parent_id, m.order_num
 	</select>
 
@@ -52,7 +52,7 @@
 	</select>
 
 	<select id="selectMenuAllByUserId" parameterType="Long" resultMap="SysMenuResult">
-		select distinct m.menu_id, m.parent_id, m.menu_name, m.url, m.visible, m.is_refresh, ifnull(m.perms,'') as perms, m.target, m.menu_type, m.icon, m.order_num, m.create_time
+		select distinct m.menu_id, m.parent_id, m.menu_name, m.url, m.visible, m.is_refresh, COALESCE(m.perms,'') as perms, m.target, m.menu_type, m.icon, m.order_num, m.create_time
 		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
@@ -78,7 +78,7 @@
 	</select>
 
 	<select id="selectMenuTree" parameterType="Long" resultType="String">
-		select concat(m.menu_id, ifnull(m.perms,'')) as perms
+		select concat(m.menu_id, COALESCE(m.perms,'')) as perms
 		from sys_menu m
 			left join sys_role_menu rm on m.menu_id = rm.menu_id
 		where rm.role_id = #{roleId}
@@ -99,7 +99,7 @@
 	</select>
 
 	<select id="selectMenuListByUserId" parameterType="SysMenu" resultMap="SysMenuResult">
-		select distinct m.menu_id, m.parent_id, m.menu_name, m.url, m.visible, m.is_refresh, ifnull(m.perms,'') as perms, m.target, m.menu_type, m.icon, m.order_num, m.create_time
+		select distinct m.menu_id, m.parent_id, m.menu_name, m.url, m.visible, m.is_refresh, COALESCE(m.perms,'') as perms, m.target, m.menu_type, m.icon, m.order_num, m.create_time
 		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
@@ -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 = sysdate()
+			update_time = now()
 		</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>
-		sysdate()
+		now()
 		)
 	</insert>
 

+ 2 - 2
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>
- 			sysdate()
+            now()
 		)
     </insert>
 	 
@@ -70,7 +70,7 @@ 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 = sysdate()
+ 			update_time = now()
         </set>
         where notice_id = #{noticeId}
     </update>

+ 3 - 3
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}, sysdate())
+        values (#{title}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operLocation}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg}, now())
 	</insert>
 	
 	<select id="selectOperLogList" parameterType="SysOperLog" resultMap="SysOperLogResult">
@@ -55,10 +55,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 				AND oper_name like concat('%', #{operName}, '%')
 			</if>
 			<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
-				and date_format(oper_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
+				and to_date(oper_time,'YY-MM-DD') &gt;= to_date(#{params.beginTime},'YY-MM-DD')
 			</if>
 			<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
-				and date_format(oper_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
+				and to_date(oper_time,'YY-MM-DD') &lt;= to_date(#{params.endTime},'YY-MM-DD')
 			</if>
 		</where>
 	</select>

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

@@ -80,7 +80,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<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 = sysdate()
+ 			update_time = now()
  		</set>
  		where post_id = #{postId}
 	</update>
@@ -103,7 +103,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>
- 			sysdate()
+			now()
  		)
 	</insert>
 

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

@@ -52,10 +52,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 			AND r.data_scope = #{dataScope}
 		</if>
 		<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
-			and date_format(r.create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
+			and to_date(r.create_time,'YY-MM-DD') &gt;= to_date(#{params.beginTime},'YY-MM-DD')
 		</if>
 		<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
-			and date_format(r.create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
+			and to_date(r.create_time,'YY-MM-DD') &lt;= to_date(#{params.endTime},'YY-MM-DD')
 		</if>
 		<!-- 数据范围过滤 -->
 		${params.dataScope}
@@ -102,7 +102,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<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 = sysdate()
+ 			update_time = now()
  		</set>
  		where role_id = #{roleId}
 	</update>
@@ -127,7 +127,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>
- 			sysdate()
+			now()
  		)
 	</insert>
 	

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

@@ -80,10 +80,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 			AND u.phonenumber like concat('%', #{phonenumber}, '%')
 		</if>
 		<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
-			AND date_format(u.create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
+			AND to_date(u.create_time,'YY-MM-DD') &gt;= to_date(#{params.beginTime},'YY-MM-DD')
 		</if>
 		<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
-			AND date_format(u.create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
+			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) ))
@@ -192,7 +192,7 @@ 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 = sysdate()
+			update_time = now()
  		</set>
  		where user_id = #{userId}
 	</update>
@@ -238,7 +238,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		<if test="orderNum != null and orderNum != ''">#{orderNum},</if>
 
 
-		sysdate()
+		now()
  		)
 	</insert>
 	

+ 10 - 8
ruoyi-system/src/main/resources/mapper/system/SysUserOnlineMapper.xml

@@ -5,7 +5,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 <mapper namespace="com.ruoyi.system.mapper.SysUserOnlineMapper">
 
 	<resultMap type="SysUserOnline" id="SysUserOnlineResult">
-		<id     property="sessionId"         column="sessionId"         />
+		<id     property="sessionId"         column="session_id"         />
 		<result property="loginName"         column="login_name"        />
 		<result property="deptName"          column="dept_name"         />
 		<result property="ipaddr"            column="ipaddr"            />
@@ -19,22 +19,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	</resultMap>
 	
 	<sql id="selectOnlineVo">
-       select sessionId, login_name, dept_name, ipaddr, login_location, browser, os, status, start_timestamp, last_access_time, expire_time 
+       select session_id, login_name, dept_name, ipaddr, login_location, browser, os, status, start_timestamp, last_access_time, expire_time
 	   from sys_user_online
     </sql>
     
 	<select id="selectOnlineById" parameterType="String" resultMap="SysUserOnlineResult">
 		<include refid="selectOnlineVo"/>
-		where sessionId = #{sessionId}
+		where session_id = #{sessionId}
 	</select>
 
 	<insert id="saveOnline" parameterType="SysUserOnline">
-		replace into sys_user_online(sessionId, login_name, dept_name, ipaddr, login_location, browser, os, status, start_timestamp, last_access_time, expire_time)
+        INSERT into sys_user_online(session_id, login_name, dept_name, ipaddr, login_location, browser, os, status, start_timestamp, last_access_time, expire_time)
         values (#{sessionId}, #{loginName}, #{deptName}, #{ipaddr}, #{loginLocation}, #{browser}, #{os}, #{status}, #{startTimestamp}, #{lastAccessTime}, #{expireTime})
+		ON conflict(session_id)
+		DO nothing;
 	</insert>
 	
  	<delete id="deleteOnlineById" parameterType="String">
- 		delete from sys_user_online where sessionId = #{sessionId}
+ 		delete from sys_user_online where session_id = #{sessionId}
  	</delete>
  	
  	<select id="selectUserOnlineList" parameterType="SysUserOnline" resultMap="SysUserOnlineResult">
@@ -49,9 +51,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		</where>
 	</select>
 	
-	<select id="selectOnlineByExpired" parameterType="String" resultMap="SysUserOnlineResult">
-		<include refid="selectOnlineVo"/> o 
+	<select id="selectOnlineByExpired" parameterType="java.sql.Timestamp" resultMap="SysUserOnlineResult">
+		<include refid="selectOnlineVo"/> o
 		WHERE o.last_access_time <![CDATA[ <= ]]> #{lastAccessTime} ORDER BY o.last_access_time ASC
 	</select>
 
-</mapper> 
+</mapper>

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

@@ -56,10 +56,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="status != null  and status != ''"> and ur.status = #{status}</if>
             <if test="relateTime != null "> and ur.relate_time = #{relateTime}</if>
             <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
-                AND date_format(ur.relate_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
+                AND to_date(ur.relate_time,'YY-MM-DD') &gt;= to_date(#{params.beginTime},'YY-MM-DD')
             </if>
             <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
-                AND date_format(ur.relate_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
+                AND to_date(ur.relate_time,'YY-MM-DD') &lt;= to_date(#{params.endTime},'YY-MM-DD')
             </if>
         </where>
     </select>