| | |
| | | import com.ruoyi.device.service.IDeviceLedgerService; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Anonymous; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.sales.pojo.CommonFile; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | @DeleteMapping("/{ids}") |
| | | @ApiOperation("删除设备台账") |
| | | public AjaxResult delete(@PathVariable("ids") ArrayList<Long> ids) { |
| | | boolean b = deviceLedgerService.removeBatchByIds(ids); |
| | | boolean b = deviceLedgerService.deleteLedgerAndFiles(ids); |
| | | if (!b) { |
| | | return AjaxResult.error("删除失败"); |
| | | } |
| | |
| | | deviceLedger.setCreateTime(deviceLedger.getUpdateTime().plusMonths(1));//下次维护时间 |
| | | return AjaxResult.success(deviceLedger); |
| | | } |
| | | @PostMapping("/uploadFile") |
| | | @ApiOperation("设备台账-附件上传") |
| | | public AjaxResult uploadFile(MultipartFile file, Long deviceLedgerId, Integer fileType) { |
| | | deviceLedgerService.uploadFile(file, deviceLedgerId, fileType); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @GetMapping("/file/{deviceLedgerId}") |
| | | @ApiOperation("设备台账-文件列表") |
| | | public AjaxResult getFiles(@PathVariable("deviceLedgerId") Long deviceLedgerId) { |
| | | java.util.List<CommonFile> list = deviceLedgerService.getFiles(deviceLedgerId); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | @DeleteMapping("/file/{fileId}") |
| | | @ApiOperation("设备台账-删除文件") |
| | | public AjaxResult deleteFile(@PathVariable("fileId") Long fileId) { |
| | | deviceLedgerService.deleteFile(fileId); |
| | | return AjaxResult.success(); |
| | | } |
| | | } |