| | |
| | | package org.dromara.eims.controller; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import org.dromara.common.excel.core.ExcelResult; |
| | | import org.dromara.eims.domain.bo.EimsEquBo; |
| | | import org.dromara.eims.domain.vo.EimsEquImportVo; |
| | | import org.dromara.eims.domain.vo.EimsEquVo; |
| | | import org.dromara.eims.listener.EimsEquImportListener; |
| | | import org.dromara.eims.service.IEimsEquService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.constraints.*; |
| | | import cn.dev33.satoken.annotation.SaCheckPermission; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.dromara.common.idempotent.annotation.RepeatSubmit; |
| | |
| | | |
| | | |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | /** |
| | | * 【设备台账】 |
| | |
| | | @PathVariable Long[] equIds) { |
| | | return toAjax(eimsEquipmentService.deleteWithValidByIds(List.of(equIds), true)); |
| | | } |
| | | |
| | | /** |
| | | * 导入数据 |
| | | * |
| | | * @param file 导入文件 |
| | | * @param updateSupport 是否更新已存在数据 |
| | | */ |
| | | @Log(title = "设备管理", businessType = BusinessType.IMPORT) |
| | | @SaCheckPermission("eims:equ:import") |
| | | @PostMapping(value = "/importData", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) |
| | | public R<Void> importData(@RequestPart("file") MultipartFile file, boolean updateSupport) throws Exception { |
| | | ExcelResult<EimsEquImportVo> result = ExcelUtil.importExcel(file.getInputStream(), EimsEquImportVo.class, new EimsEquImportListener(updateSupport)); |
| | | return R.ok(result.getAnalysis()); |
| | | } |
| | | |
| | | /** |
| | | * 获取导入模板 |
| | | */ |
| | | @PostMapping("/importTemplate") |
| | | public void importTemplate(HttpServletResponse response) { |
| | | ExcelUtil.exportExcel(new ArrayList<>(), "设备数据", EimsEquVo.class, response); |
| | | } |
| | | } |