一、接口
@RequestMapping("/export")
public void exportPdf(@RequestParam String tId, HttpServletResponse response) throws Exception {
System.out.println("==================开始导出======================");
ByteArrayOutputStream baos = null;
OutputStream out = null;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
try {
// 模板中的数据,实际运用从数据库中查询
Map<String, Object> data = new HashMap<>();
//查询人才信息 并且添加到集合中
List<RlTalentEntity> talentEntityList = rlTalentService.list(new QueryWrapper<RlTalentEntity>().eq("t_id", tId));
List<Map<String, String>> mapListTalent = new ArrayList<>();
Map<String, String> mapTalent;
for (RlTalentEntity dict : talentEntityList) {
String gender = dict.getGender();
if (gender.equals("44")) {
gender = "男";
} else if (gender.equals("45")) {
gender = "女";
} else {
gender = "保密";
}
// 转换日期格式
String bornDate = sdf.format(dict.getBornDate());
mapTalent = new HashMap<>();
mapTalent.put("name", dict.getName());
mapTalent.put("Contact", dict.getContact());
mapTalent.put("EmailAddress", dict.getEmailAddress());
mapTalent.put("Gender", gender);
mapTalent.put("BornDate", bornDate);
mapTalent.put("WorkExperience", dict.getWorkExperience());
mapTalent.put("ExpectedPosition&