All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.kangaroohy.plugin.excel.vo.ExcelSelectorResolver Maven / Gradle / Ivy

There is a newer version: 3.1.3
Show newest version
package com.kangaroohy.plugin.excel.vo;

import com.kangaroohy.plugin.excel.annotation.ExcelSelector;
import com.kangaroohy.plugin.excel.service.ExcelSelectorService;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.util.StringUtils;

/**
 * 类 ExcelSelectorResolve 功能描述:
* * @author hy * @version 0.0.1 * @date 2023/8/21 21:57 */ @Data @Slf4j public class ExcelSelectorResolver { /** * 下拉选起始行 */ private int startRow = 0; /** * 下拉选结束行 */ private int endRow = 500; /** * 下拉数据集 */ private String[] selectorData; /** * 解决Excel注解的下拉选数据获取 * * @param excelSelector Excel下拉选 * @return java.lang.String[] * @date 2022/9/20 16:58 */ public String[] resolveExcelSelector(ExcelSelector excelSelector) { if (excelSelector == null) { return new String[0]; } String[] fixedSelector = excelSelector.value(); if (fixedSelector.length > 0) { return fixedSelector; } String[] selectorData = null; Class[] serviceClass = excelSelector.serviceClass(); if (serviceClass.length > 0) { ExcelSelectorService excelSelectorService = BeanUtils.instantiateClass(serviceClass[0]); if (!StringUtils.hasText(excelSelector.dictKeyValue())) { selectorData = excelSelectorService.getSelectorData(); } else { selectorData = excelSelectorService.getSelectorData(excelSelector.dictKeyValue()); } } return selectorData; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy