use of com.rebuild.core.support.general.DataListBuilderImpl in project rebuild by getrebuild.
the class GeneralListController method dataList.
@PostMapping("data-list")
public JSON dataList(@PathVariable String entity, HttpServletRequest request) {
JSONObject query = (JSONObject) ServletUtils.getRequestJson(request);
DataListBuilder builder = new DataListBuilderImpl(query, getRequestUser(request));
return builder.getJSONResult();
}
use of com.rebuild.core.support.general.DataListBuilderImpl in project rebuild by getrebuild.
the class DataExporter method exportCsv.
/**
* 导出到指定文件
*
* @param dest
*/
protected void exportCsv(File dest) {
DataListBuilderImpl control = new DataListBuilderImpl(queryData, getUser());
List<String> head = this.buildHead(control);
try (FileOutputStream fos = new FileOutputStream(dest, true)) {
try (OutputStreamWriter osw = new OutputStreamWriter(fos, StandardCharsets.UTF_8)) {
try (BufferedWriter writer = new BufferedWriter(osw)) {
writer.write("\ufeff");
writer.write(mergeLine(head));
for (List<String> row : this.buildData(control)) {
writer.newLine();
writer.write(mergeLine(row));
count++;
}
writer.flush();
}
}
} catch (IOException e) {
throw new RebuildException("Cannot write .csv file", e);
}
}
Aggregations