package com.xmomen.module.core.web.controller;

import com.xmomen.module.base.constant.AppConstants;
import org.apache.shiro.SecurityUtils;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class DmsBaseController {

    // 获取当前用户ID
    protected Integer getCurrentUserId(){
        // 从SecurityUtils中获取当前用户的Session
        Integer userId = (Integer) SecurityUtils.getSubject().getSession().getAttribute(AppConstants.SESSION_USER_ID_KEY);
        // 返回当前用户ID
        return userId;
    }
}
