机型部件
This commit is contained in:
parent
58a3d12fce
commit
54fd6efe04
|
|
@ -111,7 +111,7 @@ public class DeviceComponentController extends ControllerBase {
|
|||
@MethodInfoMark(value = "删除部件",menuName = "机型部件")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ApiResult<Boolean> del(@RequestBody List<Integer> ids){
|
||||
if(CollUtil.isNotEmpty(ids)){
|
||||
if(CollUtil.isEmpty(ids)){
|
||||
throw new NflgException(STATE.ParamErr,"请选择要删除的部件");
|
||||
}
|
||||
deviceComponentService.batchDelComponent(ids);
|
||||
|
|
@ -134,7 +134,7 @@ public class DeviceComponentController extends ControllerBase {
|
|||
deviceComponentService.saveOrUpdateBatchComponent(Convert.toList(DeviceComponent.class, data));
|
||||
|
||||
} catch (IOException e) {
|
||||
throw new NflgException(STATE.BusinessError, "导出失败:"+e.getMessage());
|
||||
throw new NflgException(STATE.BusinessError, "导入失败:"+e.getMessage());
|
||||
}
|
||||
return ApiResult.success(true);
|
||||
}
|
||||
|
|
@ -148,10 +148,19 @@ public class DeviceComponentController extends ControllerBase {
|
|||
@GetMapping("exportData")
|
||||
@MethodInfoMark(value = "导出部件",menuName = "机型部件")
|
||||
public void exportData(HttpServletResponse response) throws IOException {
|
||||
EecExcelUtil.setResponseExcelHeader(response,"部件列表");
|
||||
List<DeviceComponent> list = deviceComponentService.list();
|
||||
if(CollUtil.isEmpty(list)) {
|
||||
throw new NflgException(STATE.BusinessError, "没有可导出的数据");
|
||||
}
|
||||
try {
|
||||
List<DevComponentExcel> excelList = Convert.toList(DevComponentExcel.class, list);
|
||||
new Workbook("部件列表", "").addSheet(new ListSheet<>("sheet1", excelList)).writeTo(response.getOutputStream());
|
||||
|
||||
new Workbook("部件列表", "")
|
||||
.addSheet(new ListSheet<>("sheet1", excelList))
|
||||
.writeTo(response.getOutputStream());
|
||||
} catch (IOException e) {
|
||||
throw new NflgException(STATE.BusinessError, "导出失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue