|  |  | 
 |  |  |             Matnr matnr1 = matnrService.getById(matnr.getId()); | 
 |  |  |             if (!Objects.isNull(matnr1.getFieldsIndex())) { | 
 |  |  |                 params.put("fieldsIndex", matnr1.getFieldsIndex()); | 
 |  |  |             } else { | 
 |  |  |                 String uuid16 = CommonUtil.randomUUID16(); | 
 |  |  |                 params.put("index", uuid16); | 
 |  |  |                 matnr.setFieldsIndex(uuid16); | 
 |  |  |             } | 
 |  |  |             FieldsUtils.updateFieldsValue(params); | 
 |  |  |         } | 
 |  |  | 
 |  |  |         if (!Objects.isNull(map.get("ids"))) { | 
 |  |  |             matnrs = matnrService.list(new LambdaQueryWrapper<Matnr>().in(Matnr::getId, map.get("ids")).eq(Matnr::getStatus, 1)); | 
 |  |  |         } else { | 
 |  |  |             matnrs = matnrService.list(new LambdaQueryWrapper<Matnr>().last("limit 1")); | 
 |  |  |             matnrs = matnrService.list(); | 
 |  |  |         } | 
 |  |  |         ExcelUtil.build(ExcelUtil.create(null, MatnrsTemplate.class, true), response); | 
 |  |  |         ExcelUtil.build(ExcelUtil.create(matnrs, Matnr.class, false), response); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @PreAuthorize("hasAuthority('manager:matnr:list')") | 
 |  |  |     @ApiOperation("下载物料模板") | 
 |  |  |     @PostMapping("/matnr/template/download") | 
 |  |  |     public void download(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { | 
 |  |  |         ExcelUtil.build(ExcelUtil.create(null, MatnrsTemplate.class, true), response); | 
 |  |  |         ExcelUtil.build(ExcelUtil.create(null, MatnrsTemplate.class), response); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  |