package tools; import org.apache.shiro.SecurityUtils; import com.agent.entity.system.UserEntity; public class Tools { public static Long getUserId(){ UserEntity ue = (UserEntity)SecurityUtils.getSubject().getSession().getAttribute("user"); Long user_id = null; if(ue != null){ user_id = ue.getId(); } return user_id; } public static UserEntity getUserEntity(){ UserEntity ue = (UserEntity)SecurityUtils.getSubject().getSession().getAttribute("user"); return ue; } }