|
@@ -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: 行业表
|
|
@@ -81,9 +77,11 @@ public class IndustryController {
|
|
ids.add(industry.getId());
|
|
ids.add(industry.getId());
|
|
}
|
|
}
|
|
getTreeList(treeList,list,null);
|
|
getTreeList(treeList,list,null);
|
|
- Map<String, Object> resMap = new HashMap<String, Object>();
|
|
|
|
- resMap.put("treeList", treeList); // 全部树节点数据
|
|
|
|
- resMap.put("ids", ids);// 全部树ids
|
|
|
|
|
|
+ Map<String, Object> resMap = new HashMap<>();
|
|
|
|
+ // 全部树节点数据
|
|
|
|
+ resMap.put("treeList", treeList);
|
|
|
|
+ // 全部树ids
|
|
|
|
+ resMap.put("ids", ids);
|
|
result.setResult(resMap);
|
|
result.setResult(resMap);
|
|
result.setSuccess(true);
|
|
result.setSuccess(true);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
@@ -121,7 +119,7 @@ public class IndustryController {
|
|
@ApiOperation(value="行业表-添加", notes="行业表-添加")
|
|
@ApiOperation(value="行业表-添加", notes="行业表-添加")
|
|
@PostMapping(value = "/add")
|
|
@PostMapping(value = "/add")
|
|
public Result<Industry> add(@RequestBody Industry industry) {
|
|
public Result<Industry> add(@RequestBody Industry industry) {
|
|
- Result<Industry> result = new Result<Industry>();
|
|
|
|
|
|
+ Result<Industry> result = new Result<>();
|
|
try {
|
|
try {
|
|
industryService.save(industry);
|
|
industryService.save(industry);
|
|
result.success("添加成功!");
|
|
result.success("添加成功!");
|
|
@@ -141,13 +139,12 @@ public class IndustryController {
|
|
@ApiOperation(value="行业表-编辑", notes="行业表-编辑")
|
|
@ApiOperation(value="行业表-编辑", notes="行业表-编辑")
|
|
@PutMapping(value = "/edit")
|
|
@PutMapping(value = "/edit")
|
|
public Result<Industry> edit(@RequestBody Industry industry) {
|
|
public Result<Industry> edit(@RequestBody Industry industry) {
|
|
- Result<Industry> result = new Result<Industry>();
|
|
|
|
|
|
+ Result<Industry> result = new Result<>();
|
|
Industry industryEntity = industryService.getById(industry.getId());
|
|
Industry industryEntity = industryService.getById(industry.getId());
|
|
if(industryEntity==null) {
|
|
if(industryEntity==null) {
|
|
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("修改成功!");
|
|
}
|
|
}
|
|
@@ -165,7 +162,7 @@ public class IndustryController {
|
|
@ApiOperation(value="行业表-通过id删除", notes="行业表-通过id删除")
|
|
@ApiOperation(value="行业表-通过id删除", notes="行业表-通过id删除")
|
|
@DeleteMapping(value = "/delete")
|
|
@DeleteMapping(value = "/delete")
|
|
public Result<Industry> delete(@RequestParam(name="id",required=true) String id) {
|
|
public Result<Industry> delete(@RequestParam(name="id",required=true) String id) {
|
|
- Result<Industry> result = new Result<Industry>();
|
|
|
|
|
|
+ Result<Industry> result = new Result<>();
|
|
Industry industry = industryService.getById(id);
|
|
Industry industry = industryService.getById(id);
|
|
if(industry==null) {
|
|
if(industry==null) {
|
|
result.error500("未找到对应实体");
|
|
result.error500("未找到对应实体");
|
|
@@ -188,7 +185,7 @@ public class IndustryController {
|
|
@ApiOperation(value="行业表-批量删除", notes="行业表-批量删除")
|
|
@ApiOperation(value="行业表-批量删除", notes="行业表-批量删除")
|
|
@DeleteMapping(value = "/deleteBatch")
|
|
@DeleteMapping(value = "/deleteBatch")
|
|
public Result<Industry> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
|
public Result<Industry> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
|
- Result<Industry> result = new Result<Industry>();
|
|
|
|
|
|
+ Result<Industry> result = new Result<>();
|
|
if(ids==null || "".equals(ids.trim())) {
|
|
if(ids==null || "".equals(ids.trim())) {
|
|
result.error500("参数不识别!");
|
|
result.error500("参数不识别!");
|
|
}else {
|
|
}else {
|
|
@@ -207,7 +204,7 @@ public class IndustryController {
|
|
@ApiOperation(value="行业表-通过id查询", notes="行业表-通过id查询")
|
|
@ApiOperation(value="行业表-通过id查询", notes="行业表-通过id查询")
|
|
@GetMapping(value = "/queryById")
|
|
@GetMapping(value = "/queryById")
|
|
public Result<Industry> queryById(@RequestParam(name="id",required=true) String id) {
|
|
public Result<Industry> queryById(@RequestParam(name="id",required=true) String id) {
|
|
- Result<Industry> result = new Result<Industry>();
|
|
|
|
|
|
+ Result<Industry> result = new Result<>();
|
|
Industry industry = industryService.getById(id);
|
|
Industry industry = industryService.getById(id);
|
|
if(industry==null) {
|
|
if(industry==null) {
|
|
result.error500("未找到对应实体");
|
|
result.error500("未找到对应实体");
|
|
@@ -262,7 +259,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);
|
|
@@ -286,5 +283,4 @@ public class IndustryController {
|
|
}
|
|
}
|
|
return Result.ok("文件导入失败!");
|
|
return Result.ok("文件导入失败!");
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|