GithubHelp home page GithubHelp logo

yangbing668 / excelot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from 1428775743/excelot

0.0 0.0 0.0 32 KB

这是一个配置注解在实体类上就可以自动导出和导入util工具类,非常方便java的快速开发Excel的业务 This is a configuration annotation, which can automatically export and import the util tool class on the entity class, which is very convenient for Java to quickly develop excel business

Java 100.00%

excelot's Introduction

#快速进行excel导入导出的工具类

@Excel(
        name = "学生统计数据表",
        sheetName = "sheet1"
)
public class Student {

    private Long id;

    @CellValue(name = "名字",index = 0)
    private String name;

    @CellValue(name = "年龄",index = 1,suffix = "岁")
    private Integer age;

    @CellDate(name = "日期",index = 2,formatStr = "yyyy-MM-dd hh:mm:ss")
    private Date date;

    @CellBoolean(name = "是否删除",index = 3,tureValue = "是", falseValue = "否")
    private Boolean isDel;

    @CellDouble(name = "收入",index = 4, fixed = 2)
    private Double balance;

    @CellSelect(
            name = "选择",
            index = 5,
            keys = {"1","2","3"},
            values = {"选择1","选择2","选择3"}
    )
    private Integer select;

    @CellSelect(
            name = "选择2",
            index = 6,
            keys = {"a","b","c"},
            values = {"2选择1","2选择2","2选择3"}
    )
    private String select2;

@Excel 一定要加

sheetName 属性 excel里面可能会有很多sheet sheetName设置了就去取对应的 不设置默认取第一个

注意属性field 基本数据类型 暂时只支持包装类型

@CellValue 通用注解 底层调用toString 方法 输出按照前缀和后缀拼接

属性

name 列名
prefix 前缀
suffix 后缀
isMust 是否必须 如果对象为空会抛出异常 可以用异常捕获知道哪一行
index cell的列号
maxLen 最大长度

*这个注解的属性以下注解全都有下面的注解就省掉了

@CellBoolean 用于Boolean类型

tureValue 为true的值
falsValue 为false的值

@CellDate 用于Date

formatStr 格式化

@CellDouble 用于Double、Float

fixed 小数位后几位

@CellSelect 用于多选一的情况

keys 键 对应对应下标values的值
values 值 

@CellFormula

Formula 填excel自带的公式

excelot's People

Contributors

1428775743 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.