lzp 1 year ago
parent 9f6498b585
commit 56da04fa6a

@ -0,0 +1,53 @@
package com.zlsl.excel;
import com.zlsl.dao.impl.*;
import com.zlsl.javaBean.*;
import jxl.Workbook;
import jxl.format.Colour;
import jxl.write.*;
import java.io.File;
import java.util.List;
import com.zlsl.dao.impl.AccidentsssImpl;
import com.zlsl.javaBean.Accidentsss;
public class AccidentExcelsss {
public static void excelExport() throws Exception {
File file = new File("D:\\accident.xls");
if (!file.exists()) {//如果不存在则创建该文件
file.getParentFile().mkdirs();
}
WritableWorkbook wb = Workbook.createWorkbook(file);//创建新工作簿
WritableSheet wsheet = wb.createSheet("事故记录", 0);// 创建sheet表
//设置表头
String[] columnNames = {"id", "发生时间", "发生地点", "事故类型","严重等级","负责人工号","车辆ID"};
WritableFont wFontTitle = new WritableFont(WritableFont.createFont("宋体"), 14);
WritableCellFormat fontTitle = new WritableCellFormat(wFontTitle);
fontTitle.setBackground(Colour.SKY_BLUE);//设置单元格背景色
for (int i = 0; i < columnNames.length; i++) {
wsheet.addCell(new Label(i, 0, columnNames[i], fontTitle));
}
//字体
WritableFont wFont = new WritableFont(WritableFont.createFont("宋体"), 14);
WritableCellFormat font = new WritableCellFormat(wFont);
List<Accidentsss> accidentList =AccidentsssImpl.selectAll();
// 把数据写入工作部中
for (int i = 0; i < accidentList.size(); i++) {
wsheet.addCell(new Label(0, i + 1, accidentList.get(i).getId()+"", font));
wsheet.addCell(new Label(1, i + 1, accidentList.get(i).getDate_time(), font));
wsheet.addCell(new Label(2, i + 1, accidentList.get(i).getLocation(), font));
wsheet.addCell(new Label(3, i + 1, accidentList.get(i).getAccident_type() , font));
wsheet.addCell(new Label(4, i + 1, accidentList.get(i).getAccident_level() + "", font));
}
wb.write();
wb.close();
System.out.println("输出完成!");
}
}

@ -0,0 +1,52 @@
package com.zlsl.excel;
import com.zlsl.dao.impl.*;
import com.zlsl.javaBean.*;
import jxl.Workbook;
import jxl.format.Colour;
import jxl.write.*;
import java.io.File;
import java.util.List;
public class CallExcelsss {
public static void excelExport() throws Exception {
File file = new File("D:\\Call.xls");
if (!file.exists()) {//如果不存在则创建该文件
file.getParentFile().mkdirs();
}
WritableWorkbook wb = Workbook.createWorkbook(file);//创建新工作簿
WritableSheet wsheet = wb.createSheet("车辆调用信息", 0);// 创建sheet表
//设置表头
String[] columnNames = {"id", "调用人工号", "调用车辆id", "调用时间", "是否归还"};
WritableFont wFontTitle = new WritableFont(WritableFont.createFont("宋体"), 14);
WritableCellFormat fontTitle = new WritableCellFormat(wFontTitle);
fontTitle.setBackground(Colour.SKY_BLUE);//设置单元格背景色
for (int i = 0; i < columnNames.length; i++) {
wsheet.addCell(new Label(i, 0, columnNames[i], fontTitle));
}
//字体
WritableFont wFont = new WritableFont(WritableFont.createFont("宋体"), 14);
WritableCellFormat font = new WritableCellFormat(wFont);
List<Callsss> callList = CallsssImpl.selectAll();
// 把数据写入工作部中
for (int i = 0; i < callList.size(); i++) {
wsheet.addCell(new Label(0, i + 1, callList.get(i).getId()+"", font));
wsheet.addCell(new Label(1, i + 1, callList.get(i).getResponsible(), font));
wsheet.addCell(new Label(2, i + 1, callList.get(i).getCar_id()+ "", font));
wsheet.addCell(new Label(3, i + 1, callList.get(i).getDate_time() + "", font));
wsheet.addCell(new Label(4, i + 1, callList.get(i).getIs_return(), font));
}
wb.write();
wb.close();
System.out.println("输出完成!");
}
}

@ -0,0 +1,51 @@
package com.zlsl.excel;
import com.zlsl.dao.impl.*;
import com.zlsl.javaBean.*;
import jxl.write.*;
import jxl.Workbook;
import jxl.format.Colour;
import jxl.write.*;
import java.io.File;
import java.util.List;
public class CarExcelldy {
public static void excelExport() throws Exception {
File file = new File("D:\\car.xls");
if (!file.exists()) {//如果不存在则创建该文件
file.getParentFile().mkdirs();
}
WritableWorkbook wb = Workbook.createWorkbook(file);//创建新工作簿
WritableSheet wsheet = wb.createSheet("车辆信息", 0);// 创建sheet表
//设置表头
String[] columnNames = {"id", "车牌号", "车型", "车龄", "颜色", "是否闲置"};
WritableFont wFontTitle = new WritableFont(WritableFont.createFont("宋体"), 14);
WritableCellFormat fontTitle = new WritableCellFormat(wFontTitle);
fontTitle.setBackground(Colour.SKY_BLUE);//设置单元格背景色
for (int i = 0; i < columnNames.length; i++) {
wsheet.addCell(new Label(i, 0, columnNames[i], fontTitle));
}
//字体
WritableFont wFont = new WritableFont(WritableFont.createFont("宋体"), 14);
WritableCellFormat font = new WritableCellFormat(wFont);
List<Carldy> carList = CarldyImpl.selectAll();
// 把数据写入工作部中
for (int i = 0; i < carList.size(); i++) {
wsheet.addCell(new Label(0, i + 1, carList.get(i).getId()+"", font));
wsheet.addCell(new Label(1, i + 1, carList.get(i).getCar_number(), font));
wsheet.addCell(new Label(2, i + 1, carList.get(i).getModel(), font));
wsheet.addCell(new Label(3, i + 1, carList.get(i).getCar_age() + "", font));
wsheet.addCell(new Label(4, i + 1, carList.get(i).getColor(), font));
wsheet.addCell(new Label(5, i + 1, carList.get(i).getIs_unused()+"", font));
}
wb.write();
wb.close();
System.out.println("输出完成!");
}
}

@ -0,0 +1,51 @@
package com.zlsl.excel;
import com.zlsl.dao.impl.*;
import com.zlsl.javaBean.*;
import jxl.Workbook;
import jxl.format.Colour;
import jxl.write.*;
import java.io.File;
import java.util.List;
import com.zlsl.dao.impl.DepartmentldyImpl;
import com.zlsl.javaBean.Departmentldy;
public class DepartmentExcelldy {
public static void excelExport() throws Exception {
File file = new File("D:\\department.xls");
if (!file.exists()) {//如果不存在则创建该文件
file.getParentFile().mkdirs();
}
WritableWorkbook wb = Workbook.createWorkbook(file);//创建新工作簿
WritableSheet wsheet = wb.createSheet("部门信息", 0);// 创建sheet表
//设置表头
String[] columnNames = {"id", "部门名称", "主管人工号", "部门电话"};
WritableFont wFontTitle = new WritableFont(WritableFont.createFont("宋体"), 14);
WritableCellFormat fontTitle = new WritableCellFormat(wFontTitle);
fontTitle.setBackground(Colour.SKY_BLUE);//设置单元格背景色
for (int i = 0; i < columnNames.length; i++) {
wsheet.addCell(new Label(i, 0, columnNames[i], fontTitle));
}
//字体
WritableFont wFont = new WritableFont(WritableFont.createFont("宋体"), 14);
WritableCellFormat font = new WritableCellFormat(wFont);
List<Departmentldy> departmentList =DepartmentldyImpl.selectAll();
// 把数据写入工作部中
for (int i = 0; i < departmentList.size(); i++) {
wsheet.addCell(new Label(0, i + 1, departmentList.get(i).getId()+"", font));
wsheet.addCell(new Label(1, i + 1, departmentList.get(i).getName(), font));
wsheet.addCell(new Label(2, i + 1, departmentList.get(i).getManager_num(), font));
wsheet.addCell(new Label(3, i + 1, departmentList.get(i).getTelephone() + "", font));
}
wb.write();
wb.close();
System.out.println("输出完成!");
}
}

@ -0,0 +1,52 @@
package com.zlsl.excel;
import com.zlsl.dao.*;
import com.zlsl.dao.impl.EmployeeImpllzp;
import com.zlsl.javaBean.*;
import jxl.Workbook;
import jxl.format.Colour;
import jxl.write.*;
import java.io.File;
import java.util.List;
public class EmployeeExcellzp {
public static void excelExport() throws Exception {
File file = new File("D:\\employee.xls");
if (!file.exists()) {//如果不存在则创建该文件
file.getParentFile().mkdirs();
}
WritableWorkbook wb = Workbook.createWorkbook(file);//创建新工作簿
WritableSheet wsheet = wb.createSheet("员工信息", 0);// 创建sheet表
//设置表头
String[] columnNames = {"id", "员工姓名", "身份证号", "电话号码", "职位", "工龄","部门id"};
WritableFont wFontTitle = new WritableFont(WritableFont.createFont("宋体"), 14);
WritableCellFormat fontTitle = new WritableCellFormat(wFontTitle);
fontTitle.setBackground(Colour.SKY_BLUE);//设置单元格背景色
for (int i = 0; i < columnNames.length; i++) {
wsheet.addCell(new Label(i, 0, columnNames[i], fontTitle));
}
//字体
WritableFont wFont = new WritableFont(WritableFont.createFont("宋体"), 14);
WritableCellFormat font = new WritableCellFormat(wFont);
List<Temployeelzp> employeeList = EmployeeImpllzp.selectAll();
// 把数据写入工作部中
for (int i = 0; i < employeeList.size(); i++) {
wsheet.addCell(new Label(0, i + 1, employeeList.get(i).getNumber(), font));
wsheet.addCell(new Label(1, i + 1, employeeList.get(i).getName(), font));
wsheet.addCell(new Label(2, i + 1, employeeList.get(i).getIDCard(), font));
wsheet.addCell(new Label(3, i + 1, employeeList.get(i).getPhone() + "", font));
wsheet.addCell(new Label(4, i + 1, employeeList.get(i).getPosition(), font));
wsheet.addCell(new Label(5, i + 1, employeeList.get(i).getSeniority(), font));
wsheet.addCell(new Label(6, i + 1, employeeList.get(i).getDep_id()+"", font));
}
wb.write();
wb.close();
System.out.println("输出完成!");
}
}

@ -0,0 +1,55 @@
package com.zlsl.excel;
import com.zlsl.dao.*;
import com.zlsl.dao.impl.EmployeeImpllzp;
import com.zlsl.dao.impl.RepairImpllzp;
import com.zlsl.javaBean.*;
import jxl.Workbook;
import jxl.format.Colour;
import jxl.write.*;
import java.io.File;
import java.util.List;
/**
*
*/
public class RepairExcellzp {
public static void excelExport() throws Exception {
File file = new File("D:\\repair.xls");
if (!file.exists()) {//如果不存在则创建该文件
file.getParentFile().mkdirs();
}
WritableWorkbook wb = Workbook.createWorkbook(file);//创建新工作簿
WritableSheet wsheet = wb.createSheet("维修信息", 0);// 创建sheet表
//设置表头
String[] columnNames = {"id", "时间", "维修地址", "维修项目", "费用", "负责人工号","车辆ID"};
WritableFont wFontTitle = new WritableFont(WritableFont.createFont("宋体"), 14);
WritableCellFormat fontTitle = new WritableCellFormat(wFontTitle);
fontTitle.setBackground(Colour.SKY_BLUE);//设置单元格背景色
for (int i = 0; i < columnNames.length; i++) {
wsheet.addCell(new Label(i, 0, columnNames[i], fontTitle));
}
//字体
WritableFont wFont = new WritableFont(WritableFont.createFont("宋体"), 14);
WritableCellFormat font = new WritableCellFormat(wFont);
List<Repairlzp> repairList = RepairImpllzp.selectAll();
// 把数据写入工作部中
for (int i = 0; i < repairList.size(); i++) {
wsheet.addCell(new Label(0, i + 1, repairList.get(i).getId() +"", font));
wsheet.addCell(new Label(1, i + 1, repairList.get(i).getDate_time(), font));
wsheet.addCell(new Label(2, i + 1, repairList.get(i).getRepair_address(), font));
wsheet.addCell(new Label(3, i + 1, repairList.get(i).getRepair_project() + "", font));
wsheet.addCell(new Label(4, i + 1, repairList.get(i).getCost() +"",font));
wsheet.addCell(new Label(5, i + 1, repairList.get(i).getResponsible(), font));
wsheet.addCell(new Label(6, i + 1, repairList.get(i).getCar_id()+"", font));
}
wb.write();
wb.close();
System.out.println("输出完成!");
}
}
Loading…
Cancel
Save