| | |
| | | import com.ruoyi.common.annotation.Excel.Type; |
| | | import com.ruoyi.common.annotation.Excels; |
| | | import com.ruoyi.common.config.RuoYiConfig; |
| | | import com.ruoyi.common.core.domain.Result; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.text.Convert; |
| | | import com.ruoyi.common.exception.UtilException; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | |
| | | * @param sheetName 工作表的名称 |
| | | * @return 结果 |
| | | */ |
| | | public Result exportExcel(List<T> list, String sheetName) |
| | | public AjaxResult exportExcel(List<T> list, String sheetName) |
| | | { |
| | | return exportExcel(list, sheetName, StringUtils.EMPTY); |
| | | } |
| | |
| | | * @param title 标题 |
| | | * @return 结果 |
| | | */ |
| | | public Result exportExcel(List<T> list, String sheetName, String title) |
| | | public AjaxResult exportExcel(List<T> list, String sheetName, String title) |
| | | { |
| | | this.init(list, sheetName, title, Type.EXPORT); |
| | | return exportExcel(); |
| | |
| | | * @param sheetName 工作表的名称 |
| | | * @return 结果 |
| | | */ |
| | | public Result importTemplateExcel(String sheetName) |
| | | public AjaxResult importTemplateExcel(String sheetName) |
| | | { |
| | | return importTemplateExcel(sheetName, StringUtils.EMPTY); |
| | | } |
| | |
| | | * @param title 标题 |
| | | * @return 结果 |
| | | */ |
| | | public Result importTemplateExcel(String sheetName, String title) |
| | | public AjaxResult importTemplateExcel(String sheetName, String title) |
| | | { |
| | | this.init(null, sheetName, title, Type.IMPORT); |
| | | return exportExcel(); |
| | |
| | | * |
| | | * @return 结果 |
| | | */ |
| | | public Result exportExcel() |
| | | public AjaxResult exportExcel() |
| | | { |
| | | OutputStream out = null; |
| | | try |
| | |
| | | String filename = encodingFilename(sheetName); |
| | | out = new FileOutputStream(getAbsoluteFile(filename)); |
| | | wb.write(out); |
| | | return Result.success(filename); |
| | | return AjaxResult.success(filename); |
| | | } |
| | | catch (Exception e) |
| | | { |