|
@@ -1,38 +1,34 @@
|
|
package org.jeecg.modules.industry.controller;
|
|
package org.jeecg.modules.industry.controller;
|
|
|
|
|
|
-import java.util.*;
|
|
|
|
-import java.io.IOException;
|
|
|
|
-import java.io.UnsupportedEncodingException;
|
|
|
|
-import java.net.URLDecoder;
|
|
|
|
-import javax.servlet.http.HttpServletRequest;
|
|
|
|
-import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
+import io.swagger.annotations.Api;
|
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
import org.jeecg.common.api.vo.Result;
|
|
import org.jeecg.common.api.vo.Result;
|
|
-import org.jeecg.common.system.query.QueryGenerator;
|
|
|
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
|
|
|
+import org.jeecg.common.system.query.QueryGenerator;
|
|
import org.jeecg.common.util.oConvertUtils;
|
|
import org.jeecg.common.util.oConvertUtils;
|
|
import org.jeecg.modules.industry.entity.Industry;
|
|
import org.jeecg.modules.industry.entity.Industry;
|
|
import org.jeecg.modules.industry.model.IndustryTree;
|
|
import org.jeecg.modules.industry.model.IndustryTree;
|
|
import org.jeecg.modules.industry.service.IIndustryService;
|
|
import org.jeecg.modules.industry.service.IIndustryService;
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
-import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
-import lombok.extern.slf4j.Slf4j;
|
|
|
|
-
|
|
|
|
-import org.jeecg.modules.system.model.TreeModel;
|
|
|
|
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
|
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
|
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
|
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
|
import org.jeecgframework.poi.excel.entity.ExportParams;
|
|
import org.jeecgframework.poi.excel.entity.ExportParams;
|
|
import org.jeecgframework.poi.excel.entity.ImportParams;
|
|
import org.jeecgframework.poi.excel.entity.ImportParams;
|
|
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
|
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
|
-
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
|
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
-import com.alibaba.fastjson.JSON;
|
|
|
|
-import io.swagger.annotations.Api;
|
|
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
|
|
|
+
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
|
+import java.io.IOException;
|
|
|
|
+import java.io.UnsupportedEncodingException;
|
|
|
|
+import java.net.URLDecoder;
|
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
/**
|
|
* @Description: 行业表
|
|
* @Description: 行业表
|
|
@@ -74,7 +70,6 @@ public class IndustryController {
|
|
// 全部权限ids
|
|
// 全部权限ids
|
|
List<String> ids = new ArrayList<>();
|
|
List<String> ids = new ArrayList<>();
|
|
try {
|
|
try {
|
|
-
|
|
|
|
List<Industry> list = industryService.list();
|
|
List<Industry> list = industryService.list();
|
|
List<IndustryTree> treeList = new ArrayList<IndustryTree>();
|
|
List<IndustryTree> treeList = new ArrayList<IndustryTree>();
|
|
for (Industry industry : list) {
|
|
for (Industry industry : list) {
|
|
@@ -82,8 +77,8 @@ public class IndustryController {
|
|
}
|
|
}
|
|
getTreeList(treeList,list,null);
|
|
getTreeList(treeList,list,null);
|
|
Map<String, Object> resMap = new HashMap<String, Object>();
|
|
Map<String, Object> resMap = new HashMap<String, Object>();
|
|
- resMap.put("treeList", treeList); // 全部树节点数据
|
|
|
|
- resMap.put("ids", ids);// 全部树ids
|
|
|
|
|
|
+ resMap.put("treeList", treeList);
|
|
|
|
+ resMap.put("ids", ids);
|
|
result.setResult(resMap);
|
|
result.setResult(resMap);
|
|
result.setSuccess(true);
|
|
result.setSuccess(true);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
@@ -100,13 +95,11 @@ public class IndustryController {
|
|
if (temp == null && oConvertUtils.isEmpty(tempPid)) {
|
|
if (temp == null && oConvertUtils.isEmpty(tempPid)) {
|
|
treeList.add(tree);
|
|
treeList.add(tree);
|
|
getTreeList(treeList,metaList,tree);
|
|
getTreeList(treeList,metaList,tree);
|
|
-
|
|
|
|
} else if (temp != null && tempPid != null && tempPid.equals(temp.getId())) {
|
|
} else if (temp != null && tempPid != null && tempPid.equals(temp.getId())) {
|
|
if(temp.getChildren() == null){
|
|
if(temp.getChildren() == null){
|
|
temp.setChildren(new ArrayList<IndustryTree>());
|
|
temp.setChildren(new ArrayList<IndustryTree>());
|
|
}
|
|
}
|
|
temp.getChildren().add(tree);
|
|
temp.getChildren().add(tree);
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
@@ -147,12 +140,10 @@ public class IndustryController {
|
|
result.error500("未找到对应实体");
|
|
result.error500("未找到对应实体");
|
|
}else {
|
|
}else {
|
|
boolean ok = industryService.updateById(industry);
|
|
boolean ok = industryService.updateById(industry);
|
|
- //TODO 返回false说明什么?
|
|
|
|
if(ok) {
|
|
if(ok) {
|
|
result.success("修改成功!");
|
|
result.success("修改成功!");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -175,7 +166,6 @@ public class IndustryController {
|
|
result.success("删除成功!");
|
|
result.success("删除成功!");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -238,7 +228,6 @@ public class IndustryController {
|
|
} catch (UnsupportedEncodingException e) {
|
|
} catch (UnsupportedEncodingException e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
-
|
|
|
|
//Step.2 AutoPoi 导出Excel
|
|
//Step.2 AutoPoi 导出Excel
|
|
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
|
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
|
List<Industry> pageList = industryService.list(queryWrapper);
|
|
List<Industry> pageList = industryService.list(queryWrapper);
|
|
@@ -262,7 +251,7 @@ public class IndustryController {
|
|
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
|
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
|
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
|
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
|
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
|
|
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
|
|
- MultipartFile file = entity.getValue();// 获取上传文件对象
|
|
|
|
|
|
+ MultipartFile file = entity.getValue();
|
|
ImportParams params = new ImportParams();
|
|
ImportParams params = new ImportParams();
|
|
params.setTitleRows(2);
|
|
params.setTitleRows(2);
|
|
params.setHeadRows(1);
|
|
params.setHeadRows(1);
|