| | |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.mom.annotation.ValueAuth; |
| | | import com.yuanchu.mom.pojo.DeviceBorrow; |
| | | import com.yuanchu.mom.service.DeviceBorrowService; |
| | | import com.yuanchu.mom.utils.JackSonUtil; |
| | |
| | | |
| | | //分页 |
| | | @PostMapping("/deviceBorrowPage") |
| | | @ValueAuth |
| | | public Result deviceBorrowPage(@RequestBody Map<String, Object> data) throws Exception { |
| | | Page page = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("page")), Page.class); |
| | | DeviceBorrow deviceBorrow = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), DeviceBorrow.class); |
| | |
| | | |
| | | //查询 |
| | | @GetMapping("/getDeviceBorrow") |
| | | @ValueAuth |
| | | public Result getDeviceBorrow(Integer id) { |
| | | return Result.success(deviceBorrowService.getDeviceBorrow(id)); |
| | | } |
| | | |
| | | //新增 |
| | | @PostMapping("/saveDeviceBorrow") |
| | | @ValueAuth |
| | | public Result saveDeviceBorrow(@RequestBody DeviceBorrow deviceBorrow) { |
| | | return Result.success(deviceBorrowService.saveDeviceBorrow(deviceBorrow)); |
| | | } |
| | | |
| | | //删除 |
| | | @PostMapping("/deleteDeviceBorrow") |
| | | @ValueAuth |
| | | public Result deleteDeviceBorrow(Integer id) { |
| | | return Result.success(deviceBorrowService.removeById(id)); |
| | | } |
| | | |
| | | //导出 |
| | | @PostMapping("/deviceBorrowExport") |
| | | @ValueAuth |
| | | public Result deviceBorrowExport(@RequestParam("deviceId") Integer deviceId, HttpServletResponse response) throws Exception { |
| | | List<DeviceBorrow> deviceBorrows = deviceBorrowService.getDeviceBorrowBydeviceId(deviceId); |
| | | response.setHeader("requestType", "excel"); |