Kaynağa Gözat

修改内广批量逻辑代码

syh 5 yıl önce
ebeveyn
işleme
32f6b154a9

+ 16 - 27
jeecg-boot-module-system/src/main/java/org/jeecg/modules/industry/controller/IndustryController.java

@@ -1,38 +1,34 @@
 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.system.query.QueryGenerator;
 import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.industry.entity.Industry;
 import org.jeecg.modules.industry.model.IndustryTree;
 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.def.NormalExcelConstants;
 import org.jeecgframework.poi.excel.entity.ExportParams;
 import org.jeecgframework.poi.excel.entity.ImportParams;
 import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
-
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartHttpServletRequest;
 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: 行业表
@@ -74,7 +70,6 @@ public class IndustryController {
 		 // 全部权限ids
 		 List<String> ids = new ArrayList<>();
 		 try {
-
 			 List<Industry> list = industryService.list();
 			 List<IndustryTree> treeList = new ArrayList<IndustryTree>();
 			 for (Industry industry : list) {
@@ -82,8 +77,8 @@ public class IndustryController {
 			 }
 			 getTreeList(treeList,list,null);
 			 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.setSuccess(true);
 		 } catch (Exception e) {
@@ -100,13 +95,11 @@ public class IndustryController {
 			 if (temp == null && oConvertUtils.isEmpty(tempPid)) {
 				 treeList.add(tree);
 				 getTreeList(treeList,metaList,tree);
-
 			 } else if (temp != null && tempPid != null && tempPid.equals(temp.getId())) {
 			 	if(temp.getChildren() == null){
 					temp.setChildren(new ArrayList<IndustryTree>());
 				}
 				 temp.getChildren().add(tree);
-
 			 }
 
 		 }
@@ -147,12 +140,10 @@ public class IndustryController {
 			result.error500("未找到对应实体");
 		}else {
 			boolean ok = industryService.updateById(industry);
-			//TODO 返回false说明什么?
 			if(ok) {
 				result.success("修改成功!");
 			}
 		}
-
         return result;
 	}
 
@@ -175,7 +166,6 @@ public class IndustryController {
 				result.success("删除成功!");
 			}
 		}
-
         return result;
 	}
 
@@ -238,7 +228,6 @@ public class IndustryController {
       } catch (UnsupportedEncodingException e) {
           e.printStackTrace();
       }
-
       //Step.2 AutoPoi 导出Excel
       ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
       List<Industry> pageList = industryService.list(queryWrapper);
@@ -262,7 +251,7 @@ public class IndustryController {
       MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
       Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
       for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-          MultipartFile file = entity.getValue();// 获取上传文件对象
+          MultipartFile file = entity.getValue();
           ImportParams params = new ImportParams();
           params.setTitleRows(2);
           params.setHeadRows(1);