Search in sources :

Example 1 with TableInfo

use of com.xiaocai.demo.excel.oracle.vo.TableInfo in project springboot-demo by small-rose.

the class SelectController method tableinfos.

@ApiOperation(value = "查表和表注释", response = Map.class)
@GetMapping("/tableinfos")
public Map tableinfos(String schema) {
    if (StringUtils.isEmpty(schema)) {
        schema = "PAYMT";
    }
    List<TableInfo> allTables = oracleSelectService.getAllTables(schema);
    Map map = new HashMap(2);
    map.put("code", "200");
    map.put("data", allTables);
    return map;
}
Also used : HashMap(java.util.HashMap) TableInfo(com.xiaocai.demo.excel.oracle.vo.TableInfo) HashMap(java.util.HashMap) Map(java.util.Map) GetMapping(org.springframework.web.bind.annotation.GetMapping) ApiOperation(io.swagger.annotations.ApiOperation)

Example 2 with TableInfo

use of com.xiaocai.demo.excel.oracle.vo.TableInfo in project springboot-demo by small-rose.

the class ExcelFacadeService method addColumnInfos.

private void addColumnInfos(String schema, String fileName, List<TableInfo> allTables) {
    if (allTables.isEmpty()) {
        log.info(" allTables size is 0 ");
    }
    int index = 2;
    for (TableInfo tableInfo : allTables) {
        if (index == 4) {
            break;
        }
        ExcelWriter excelWriter = EasyExcel.write(fileName, TableColumn.class).build();
        List<TableColumn> columnInfos = oracleSelectService.getColumnInfo(schema, tableInfo.getTableName());
        WriteSheet writeSheet = EasyExcel.writerSheet(index, tableInfo.getTableName()).head(TableColumn.class).build();
        excelWriter.write(columnInfos, writeSheet);
        excelWriter.finish();
        index++;
    }
    System.out.println("=====执行完成=====");
}
Also used : ExcelWriter(com.alibaba.excel.ExcelWriter) WriteSheet(com.alibaba.excel.write.metadata.WriteSheet) TableInfo(com.xiaocai.demo.excel.oracle.vo.TableInfo) TableColumn(com.xiaocai.demo.excel.oracle.vo.TableColumn)

Aggregations

TableInfo (com.xiaocai.demo.excel.oracle.vo.TableInfo)2 ExcelWriter (com.alibaba.excel.ExcelWriter)1 WriteSheet (com.alibaba.excel.write.metadata.WriteSheet)1 TableColumn (com.xiaocai.demo.excel.oracle.vo.TableColumn)1 ApiOperation (io.swagger.annotations.ApiOperation)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 GetMapping (org.springframework.web.bind.annotation.GetMapping)1