| | |
| | | package com.ruoyi.warehouse.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | |
| | | import com.ruoyi.warehouse.mapper.DocumentationBorrowManagementMapper; |
| | | import com.ruoyi.warehouse.pojo.DocumentationBorrowManagement; |
| | | import com.ruoyi.warehouse.pojo.Warehouse; |
| | | import com.ruoyi.warehouse.service.DocumentationBorrowManagementService; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | |
| | | public class DocumentationBorrowManagementController extends BaseController { |
| | | @Autowired |
| | | private DocumentationBorrowManagementService documentationBorrowManagementService; |
| | | @Autowired |
| | | private DocumentationBorrowManagementMapper documentationBorrowManagementMapper; |
| | | @GetMapping("/listPage") |
| | | @ApiOperation("文档借阅管理-分页查询") |
| | | @Log(title = "文档借阅管理-分页查询", businessType = BusinessType.OTHER) |
| | | @ApiOperation("文档借阅管理-借阅分页查询") |
| | | @Log(title = "文档借阅管理-借阅分页查询", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPage(Page page, DocumentationBorrowManagement documentationBorrowManagement) { |
| | | IPage<DocumentationBorrowManagement> listPage = documentationBorrowManagementService.listPage(page, documentationBorrowManagement); |
| | | return AjaxResult.success(listPage); |
| | | return AjaxResult.success(documentationBorrowManagementService.listPage(page, documentationBorrowManagement)); |
| | | } |
| | | @PostMapping("/add") |
| | | @ApiOperation("文档借阅管理-添加") |
| | | @Log(title = "文档借阅管理-添加", businessType = BusinessType.INSERT) |
| | | @ApiOperation("文档借阅管理-借阅") |
| | | @Log(title = "文档借阅管理-借阅", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody DocumentationBorrowManagement documentationBorrowManagement) { |
| | | documentationBorrowManagementService.save(documentationBorrowManagement); |
| | | return AjaxResult.success(); |
| | | return AjaxResult.success(documentationBorrowManagementService.add(documentationBorrowManagement)); |
| | | } |
| | | @PostMapping("/update") |
| | | @PutMapping("/revent") |
| | | @ApiOperation("文档借阅管理-归还") |
| | | @Log(title = "文档借阅管理-归还", businessType = BusinessType.UPDATE) |
| | | public AjaxResult reventdbm(@RequestBody DocumentationBorrowManagement documentationBorrowManagement) { |
| | | return AjaxResult.success(documentationBorrowManagementService.reventdbm(documentationBorrowManagement)); |
| | | } |
| | | @PutMapping("/update") |
| | | @ApiOperation("文档借阅管理-更新") |
| | | @Log(title = "文档借阅管理-更新", businessType = BusinessType.UPDATE) |
| | | public AjaxResult update(@RequestBody DocumentationBorrowManagement documentationBorrowManagement) { |
| | | documentationBorrowManagementService.updateById(documentationBorrowManagement); |
| | | return AjaxResult.success(); |
| | | return AjaxResult.success(documentationBorrowManagementService.updateById(documentationBorrowManagement)); |
| | | } |
| | | @PostMapping("/delete") |
| | | @ApiOperation("文档借阅管理-删除") |
| | | @Log(title = "文档借阅管理-删除", businessType = BusinessType.DELETE) |
| | | @DeleteMapping ("/delete") |
| | | @ApiOperation("文档借阅管理-借阅删除") |
| | | @Log(title = "文档借阅管理-借阅删除", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | documentationBorrowManagementService.removeByIds(ids); |
| | | return AjaxResult.success(); |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("请传入要删除的ID"); |
| | | return AjaxResult.success(documentationBorrowManagementService.deleteByIds(ids)); |
| | | } |
| | | @DeleteMapping ("/reventDelete") |
| | | @ApiOperation("文档借阅管理-归还删除") |
| | | @Log(title = "文档借阅管理-归还删除", businessType = BusinessType.DELETE) |
| | | public AjaxResult reventdelete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("请传入要删除的ID"); |
| | | return AjaxResult.success(documentationBorrowManagementService.reventDeleteByIds(ids)); |
| | | } |
| | | @PostMapping("/export") |
| | | @ApiOperation("文档信息表-导出") |
| | | @Log(title = "文档信息表-导出", businessType = BusinessType.EXPORT) |
| | | public void export(HttpServletResponse response) { |
| | | documentationBorrowManagementService.export(response); |
| | | @ApiOperation("文档借阅管理-借阅导出") |
| | | @Log(title = "文档借阅管理-借阅导出", businessType = BusinessType.EXPORT) |
| | | public void export(HttpServletResponse response,DocumentationBorrowManagement documentationBorrowManagement) { |
| | | documentationBorrowManagementService.export(response,documentationBorrowManagement); |
| | | } |
| | | @PostMapping("/exportrevent") |
| | | @ApiOperation("文档借阅管理-归还导出") |
| | | @Log(title = "文档借阅管理-归还导出", businessType = BusinessType.EXPORT) |
| | | public void exportrevent(HttpServletResponse response,DocumentationBorrowManagement documentationBorrowManagement) { |
| | | documentationBorrowManagementService.exportrevent(response,documentationBorrowManagement); |
| | | // List<DocumentationBorrowManagement> documentationBorrowManagements = documentationBorrowManagementMapper.selectList(new LambdaQueryWrapper<DocumentationBorrowManagement>().eq(DocumentationBorrowManagement::getBorrowStatus, "归还")); |
| | | // ExcelUtil<DocumentationBorrowManagement> util = new ExcelUtil<>(DocumentationBorrowManagement.class); |
| | | // util.exportExcel(response, documentationBorrowManagements, "文档借阅-归还记录"); |
| | | } |
| | | } |