package com.doumee.core.annotation.excel;
|
|
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
import org.apache.poi.ss.usermodel.IndexedColors;
|
|
import java.lang.annotation.*;
|
|
/**
|
* 标记为Excel列
|
* @author Eva.Caesar Liu
|
* @date 2023/02/14 11:14
|
*/
|
@Inherited
|
//@Target(ElementType.FIELD)
|
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.TYPE})
|
@Retention(RetentionPolicy.RUNTIME)
|
public @interface ExcelColumn {
|
/**
|
* 导出字段名(默认调用当前字段的“get”方法,如指定导出字段为对象,请填写“对象名.对象属性”,例:“area.name”、“office.name”)
|
*/
|
String value() default "";
|
/**
|
* 字段类型(0:导出导入;1:仅导出;2:仅导入)
|
*/
|
int type() default 0;
|
/**
|
* 列名
|
*/
|
String name();
|
|
/**
|
* 列宽(单位为字符),-1自动计算
|
*/
|
int width() default -1;
|
|
/**
|
* 排序,值越小越靠前,-1按字段反射顺序排序
|
*/
|
int index() default -1;
|
|
/**
|
* 对齐方式
|
*/
|
HorizontalAlignment align() default HorizontalAlignment.LEFT;
|
|
/**
|
* 列背景色
|
*/
|
IndexedColors backgroundColor() default IndexedColors.GREY_25_PERCENT;
|
|
/**
|
* 列数据单元格背景色
|
*/
|
IndexedColors dataBackgroundColor() default IndexedColors.WHITE;
|
|
/**
|
* 字体颜色
|
*/
|
IndexedColors color () default IndexedColors.BLACK;
|
|
/**
|
* 字体大小(像素)
|
*/
|
short fontSize () default 12;
|
|
/**
|
* 粗体
|
*/
|
boolean bold () default false;
|
|
/**
|
* 斜体
|
*/
|
boolean italic () default false;
|
|
/**
|
* 值映射,如0=女;1=男
|
*/
|
String valueMapping() default "";
|
|
/**
|
* 数据前缀
|
*/
|
String prefix() default "";
|
|
/**
|
* 数据后缀
|
*/
|
String suffix() default "";
|
|
/**
|
* 日期格式
|
*/
|
String dateFormat() default "yyyy-MM-dd";
|
|
/**
|
* 自定义数据处理器
|
*/
|
Class handler() default ExcelDataHandlerAdapter.class;
|
|
/**
|
* 自定义数据处理器参数
|
*/
|
String[] args() default {};
|
|
/**
|
* 反射类型
|
*/
|
Class<?> fieldType() default Class.class;
|
|
/**
|
* 字段归属组(根据分组导出导入)
|
*/
|
int[] groups() default {};
|
}
|