package com.sonic.bear.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sonic.bear.domain.entity.UserSession;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
 * @author coder
 */
public interface UserSessionDao extends BaseMapper<UserSession> {

    @Update("update user_session set status = 'EXPIRED' where user_id = #{userId} AND client_code= #{clientCode}  AND status= 'ENABLED' ")
    int expiredSession(@Param("userId") Long userId, @Param("clientCode") String clientCode);

    @Update("update user_session set status = 'EXPIRED' where user_id = #{userId} AND status= 'ENABLED'")
    int expiredSessionV2(@Param("userId") Long userId);

}
