package com.emr.controller;

import org.apache.commons.lang3.StringUtils;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;

/**
 * @author 曾文和
 * @description: XXX类
 * @createTime 2023/6/21 16:00
 */
public class SessionContant {

    public static String setPdfUrl(String masterId, String imgStr, List<String> urlList, HttpServletRequest request) {
        String key = "";
        if (StringUtils.isNotBlank(masterId)) {
            key = masterId + "_" + imgStr;
        }else{
            key = imgStr;
        }
        request.getSession().setAttribute(key,urlList);
        return key;
    }


    public static List<String> getPdfUrl(String key, HttpServletRequest request) {
        Object attribute = request.getSession().getAttribute(key);
        if(null != attribute){
            List<String> list = (List<String>) attribute;
            return list;
        }
        return null;
    }
}
