package com.codvision.auth.support.excel;

import cn.hutool.core.util.ArrayUtil;
import cn.hutool.extra.spring.SpringUtil;
import com.codvision.base.config.excel.select.ExcelDynamicSelect;
import com.codvision.base.entity.SysDictItem;
import com.codvision.base.service.ISysDictItemService;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author KX
 * @date 2023/5/17 16:45
 */
public class EducationDynamicSelect implements ExcelDynamicSelect {

    @Override
    public String[] getSource() {
        ISysDictItemService itemService = SpringUtil.getBean(ISysDictItemService.class);
        List<String> sourceList = new ArrayList<>();
        Map<String, Object> paraMap = new HashMap<>(16);
        SysDictItem queryBean = new SysDictItem();
        queryBean.setDictType("EDUCATION");
        for (SysDictItem sysDictItem : itemService.getItemList(queryBean)) {
            sourceList.add(sysDictItem.getLabel());
        }
        return ArrayUtil.toArray(sourceList, String.class);
    }
}
