Export Excel data annotations

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface Excel {

    /** * Export the name to Excel. */
    public String name(a) default "";

    /**
     * 日期格式, 如: yyyy-MM-dd
     */
    public String dateFormat(a) default "";

    /** * read the contents of the expression (e.g., 0= male,1= female,2= unknown) */
    public String convertExp(a) default "";

    /** * Export type (0 digit 1 string) */
    public ColumnType cellType(a) default ColumnType.STRING;

    /** * The height of each column in Excel when exported is expressed in characters */
    public double height(a) default 14;

    /** * The width of each column in Excel when exported is in units of characters */
    public double width(a) default 16;

    /** * text suffix, e.g. % 90 becomes 90% */
    public String suffix(a) default "";

    /** * The default value of the field */ when the value is null
    public String defaultValue(a) default "";

    /** * Message */
    public String prompt(a) default "";

    /** * set only columns that cannot be entered. */
    public String[] combo() default {};

    /** * Whether to export data to meet the demand: sometimes we need to export a template, this is the title needs but the content needs to be manually filled by the user. */
    public boolean isExport(a) default true;

    /** * The name of an attribute in another class that supports multiple levels of fetching, separated by decimal points */
    public String targetAttr(a) default "";

    /** * field type (0: export import; 1: export only. 2: Import only) */
    Type type(a) default Type.ALL;

    public enum Type {
        ALL(0), EXPORT(1), IMPORT(2);
        private final int value;

        Type(int value) {
            this.value = value;
        }

        public int value(a) {
            return this.value; }}public enum ColumnType {
        NUMERIC(0), STRING(1);
        private final int value;

        ColumnType(int value) {
            this.value = value;
        }

        public int value(a) {
            return this.value; }}}Copy the code

Excel annotation set

@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface Excels {
    Excel[] value();
}
Copy the code