com.ruoyi.common.annotation.Excel.Type Java Examples

The following examples show how to use com.ruoyi.common.annotation.Excel.Type. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ExcelUtil.java    From supplierShop with MIT License 5 votes vote down vote up
public void init(List<T> list, String sheetName, Type type)
{
    if (list == null)
    {
        list = new ArrayList<T>();
    }
    this.list = list;
    this.sheetName = sheetName;
    this.type = type;
    createExcelField();
    createWorkbook();
}
 
Example #2
Source File: ExcelUtil.java    From supplierShop with MIT License 5 votes vote down vote up
/**
 * 放到字段集合中
 */
private void putToField(Field field, Excel attr)
{
    if (attr != null && (attr.type() == Type.ALL || attr.type() == type))
    {
        this.fields.add(new Object[] { field, attr });
    }
}
 
Example #3
Source File: ExcelUtil.java    From ruoyiplus with MIT License 5 votes vote down vote up
public void init(List<T> list, String sheetName, Type type)
{
    if (list == null)
    {
        list = new ArrayList<T>();
    }
    this.list = list;
    this.sheetName = sheetName;
    this.type = type;
    createExcelField();
    createWorkbook();
}
 
Example #4
Source File: ExcelUtil.java    From ruoyiplus with MIT License 5 votes vote down vote up
/**
 * 得到所有定义字段
 */
private void createExcelField()
{
    this.fields = new ArrayList<Field>();
    Field[] allFields = clazz.getDeclaredFields();
    // 得到所有field并存放到一个list中.
    for (Field field : allFields)
    {
        Excel attr = field.getAnnotation(Excel.class);
        if (attr != null && (attr.type() == Type.ALL || attr.type() == type))
        {
            fields.add(field);
        }
    }
}
 
Example #5
Source File: ExcelUtil.java    From supplierShop with MIT License 2 votes vote down vote up
/**
 * 对list数据源将其里面的数据导入到excel表单
 * 
 * @param list 导出数据集合
 * @param sheetName 工作表的名称
 * @return 结果
 */
public AjaxResult exportExcel(List<T> list, String sheetName)
{
    this.init(list, sheetName, Type.EXPORT);
    return exportExcel();
}
 
Example #6
Source File: ExcelUtil.java    From supplierShop with MIT License 2 votes vote down vote up
/**
 * 对list数据源将其里面的数据导入到excel表单
 * 
 * @param sheetName 工作表的名称
 * @return 结果
 */
public AjaxResult importTemplateExcel(String sheetName)
{
    this.init(null, sheetName, Type.IMPORT);
    return exportExcel();
}
 
Example #7
Source File: ExcelUtil.java    From ruoyiplus with MIT License 2 votes vote down vote up
/**
 * 对list数据源将其里面的数据导入到excel表单
 * 
 * @param list 导出数据集合
 * @param sheetName 工作表的名称
 * @return 结果
 */
public AjaxResult exportExcel(List<T> list, String sheetName)
{
    this.init(list, sheetName, Type.EXPORT);
    return exportExcel();
}
 
Example #8
Source File: ExcelUtil.java    From ruoyiplus with MIT License 2 votes vote down vote up
/**
 * 对list数据源将其里面的数据导入到excel表单
 * 
 * @param sheetName 工作表的名称
 * @return 结果
 */
public AjaxResult importTemplateExcel(String sheetName)
{
    this.init(null, sheetName, Type.IMPORT);
    return exportExcel();
}