package com.yssh.service; import org.springframework.core.io.ClassPathResource; import org.springframework.stereotype.Service; import java.io.IOException; /** * Excel导出服务类 * @author WWW * @author 2023-08-05 */ @Service public class XlsExportService { /** * 获取Excel模板 */ private String getXslTemplate(String type) throws IOException { ClassPathResource resource = new ClassPathResource(String.format("templates/%s.xlsx", type)); return resource.exists() ? resource.getFile().getPath() : null; } }