fix:会话信息

kingbase
wangxy 10 months ago
parent 1720b3914f
commit a9dcb6cf7c

@ -34,6 +34,16 @@ public interface SysUserOnlineMapper
*/
public int saveOnline(SysUserOnline online);
/**
*
*
* @param online
* @return int
*/
public int updateOnline(SysUserOnline online);
/**
*
*

@ -82,9 +82,16 @@ public class SysUserOnlineServiceImpl implements ISysUserOnlineService
@Override
public void saveOnline(SysUserOnline online)
{
SysUserOnline sysUserOnline = userOnlineDao.selectOnlineById(online.getSessionId());
if(StringUtils.isNull(sysUserOnline)){
userOnlineDao.saveOnline(online);
}else{
userOnlineDao.updateOnline(online);
}
}
/**
*
*

@ -29,10 +29,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</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(sessionId, 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})
</insert>
<update id="updateOnline" parameterType="SysUserOnline">
update sys_user_online
<set>
<if test="loginName != null ">login_name = #{loginName},</if>
<if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
<if test="ipaddr != null and ipaddr != ''">ipaddr = #{ipaddr},</if>
<if test="loginLocation != null and loginLocation != ''">login_location = #{loginLocation},</if>
<if test="browser != null and browser != ''">browser = #{browser},</if>
<if test="os != null and os != ''">os = #{os},</if>
<if test="status != null">status = #{status},</if>
<if test="startTimestamp != null ">start_timestamp = #{startTimestamp},</if>
<if test="lastAccessTime != null ">last_access_time = #{lastAccessTime},</if>
<if test="expireTime != null ">expire_time = #{expireTime},</if>
</set>
where sessionId = #{sessionId}
</update>
<delete id="deleteOnlineById" parameterType="String">
delete from sys_user_online where sessionId = #{sessionId}
</delete>

Loading…
Cancel
Save