@RequestMapping("/open")
public String open(ElecExportFields elecExportFields,HttpServletRequest request){
//查出设置导出表的内容
String belongTo = elecExportFields.getBelongTo();
ElecExportFields fields=eef.findById(belongTo);
//将查出的中英文字段放入map集合
Map<String,String> expMap=new HashMap<String,String>();
Map<String,String> noexpMap=new HashMap<String,String>();
//导出的中英文文字段
String expNameList = fields.getExpNameList();
String expFieldName = fields.getExpFieldName();
//将中文字段放入集合
List<String> expListArrayList=new ArrayList<>();
if(expNameList!=null&&expNameList.length()>0){
String[] split = expNameList.split("#");
for (String ss : split) {
expListArrayList.add(ss);
}
}
//将英文字段放入集合
List<String> expListArrayName=new ArrayList<>();
if(expFieldName!=null&&expFieldName.length()>0){
String[] split2 = expFieldName.split("#");
for (String ss : split2) {
expListArrayName.add(ss);
}
}
//将导出的中英文字段放入map集合
for (int i = 0; i < expListArrayName.size(); i++) {
expMap.put(expListArrayName.get(i), expListArrayList.get(i));
}
//=============================未导出的字段=========================================
//导出的中英文文字段
String noexpNameList = fields.getNoExpNameList();
String noexpFieldName = fields.getNoExpFieldName();
//将中文字段放入集合
List<String> noexpListArrayList=new ArrayList<>();
if(noexpNameList!=null&&noexpNameList.length()>0){
String[] split = noexpNameList.split("#");
for (String ss : split) {
noexpListArrayList.add(ss);
}
}
//将英文字段放入集合
List<String> noexpListArrayName=new ArrayList<>();
if(noexpFieldName!=null&&noexpFieldName.length()>0){
String[] split2 = noexpFieldName.split("#");
for (String ss : split2) {
noexpListArrayName.add(ss);
}
}
//将导出的中英文字段放入map集合
for (int i = 0; i < noexpListArrayName.size(); i++) {
noexpMap.put(noexpListArrayName.get(i), noexpListArrayList.get(i));
}
//===============将导出字段和未导出字段map放入request中===========================
request.setAttribute("noexpMap", noexpMap);
request.setAttribute("expMap", expMap);
request.setAttribute("fidlds", elecExportFields);
return "system/exportExcel";
}
public String open(ElecExportFields elecExportFields,HttpServletRequest request){
//查出设置导出表的内容
String belongTo = elecExportFields.getBelongTo();
ElecExportFields fields=eef.findById(belongTo);
//将查出的中英文字段放入map集合
Map<String,String> expMap=new HashMap<String,String>();
Map<String,String> noexpMap=new HashMap<String,String>();
//导出的中英文文字段
String expNameList = fields.getExpNameList();
String expFieldName = fields.getExpFieldName();
//将中文字段放入集合
List<String> expListArrayList=new ArrayList<>();
if(expNameList!=null&&expNameList.length()>0){
String[] split = expNameList.split("#");
for (String ss : split) {
expListArrayList.add(ss);
}
}
//将英文字段放入集合
List<String> expListArrayName=new ArrayList<>();
if(expFieldName!=null&&expFieldName.length()>0){
String[] split2 = expFieldName.split("#");
for (String ss : split2) {
expListArrayName.add(ss);
}
}
//将导出的中英文字段放入map集合
for (int i = 0; i < expListArrayName.size(); i++) {
expMap.put(expListArrayName.get(i), expListArrayList.get(i));
}
//=============================未导出的字段=========================================
//导出的中英文文字段
String noexpNameList = fields.getNoExpNameList();
String noexpFieldName = fields.getNoExpFieldName();
//将中文字段放入集合
List<String> noexpListArrayList=new ArrayList<>();
if(noexpNameList!=null&&noexpNameList.length()>0){
String[] split = noexpNameList.split("#");
for (String ss : split) {
noexpListArrayList.add(ss);
}
}
//将英文字段放入集合
List<String> noexpListArrayName=new ArrayList<>();
if(noexpFieldName!=null&&noexpFieldName.length()>0){
String[] split2 = noexpFieldName.split("#");
for (String ss : split2) {
noexpListArrayName.add(ss);
}
}
//将导出的中英文字段放入map集合
for (int i = 0; i < noexpListArrayName.size(); i++) {
noexpMap.put(noexpListArrayName.get(i), noexpListArrayList.get(i));
}
//===============将导出字段和未导出字段map放入request中===========================
request.setAttribute("noexpMap", noexpMap);
request.setAttribute("expMap", expMap);
request.setAttribute("fidlds", elecExportFields);
return "system/exportExcel";
}