| | |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.warehouse.dto.DocumentationDto; |
| | | import com.ruoyi.warehouse.pojo.Documentation; |
| | | import com.ruoyi.warehouse.pojo.Warehouse; |
| | | import com.ruoyi.warehouse.service.DocumentationService; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @RestController |
| | | @RequestMapping("/documentation") |
| | |
| | | @ApiOperation("文档信息表-分页查询") |
| | | @Log(title = "文档信息表-分页查询", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPage(Page page, Documentation documentation) { |
| | | IPage<Documentation> listPage = documentationService.listPage(page, documentation); |
| | | return AjaxResult.success(listPage); |
| | | IPage<DocumentationDto> list = documentationService.listPage(page, documentation); |
| | | return AjaxResult.success(list); |
| | | } |
| | | @GetMapping("/list") |
| | | @ApiOperation("文档信息表") |
| | | @Log(title = "文档信息表", businessType = BusinessType.OTHER) |
| | | @ApiOperation("文档信息表查询") |
| | | @Log(title = "文档信息表查询", businessType = BusinessType.OTHER) |
| | | public AjaxResult list() { |
| | | List<Documentation> list = documentationService.list(); |
| | | List<DocumentationDto> list = documentationService.listAll(); |
| | | return AjaxResult.success(list); |
| | | } |
| | | @PostMapping("/add") |
| | |
| | | public AjaxResult add(@RequestBody Documentation documentation) { |
| | | return AjaxResult.success(documentationService.save(documentation)); |
| | | } |
| | | @PostMapping("/update") |
| | | @PutMapping("/update") |
| | | @ApiOperation("文档信息表-更新") |
| | | @Log(title = "文档信息表-更新", businessType = BusinessType.UPDATE) |
| | | public AjaxResult update(@RequestBody Documentation documentation) { |
| | | return AjaxResult.success(documentationService.updateById(documentation)); |
| | | } |
| | | @PostMapping("/delete") |
| | | @DeleteMapping("/delete") |
| | | @ApiOperation("文档信息表-删除") |
| | | @Log(title = "文档信息表-删除", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("请传入要删除的ID"); |
| | | return AjaxResult.success(documentationService.removeBatchByIds(ids)); |
| | | return AjaxResult.success(documentationService.deleteByIds(ids)); |
| | | } |
| | | |
| | | @PostMapping("/export") |
| | | @ApiOperation("文档信息表-导出") |
| | | @Log(title = "文档信息表-导出", businessType = BusinessType.EXPORT) |
| | | public void export(HttpServletResponse response) { |
| | | documentationService.export(response); |
| | | public void export(HttpServletResponse response,Documentation documentation ) { |
| | | documentationService.export(response,documentation); |
| | | } |
| | | @ApiOperation("文档信息表-统计") |
| | | @GetMapping("/overview") |
| | | public AjaxResult getOverviewStatistics() { |
| | | Map<String, Object> result = new HashMap<>(); |
| | | result.put("totalDocsCount", documentationService.getTotalDocsCount()); |
| | | result.put("categoryNumCount", documentationService.getCategoryNumCount()); |
| | | result.put("borrowedDocsCount", documentationService.getBorrowedDocsCount()); |
| | | result.put("monthlyAddedDocsCount", documentationService.getMonthlyAddedDocsCount()); |
| | | return AjaxResult.success(result); |
| | | } |
| | | @ApiOperation("文档信息表-分类统计") |
| | | @GetMapping("/category") |
| | | public AjaxResult getCategoryDistribution() { |
| | | return AjaxResult.success(documentationService.getCategoryDistribution()); |
| | | } |
| | | @ApiOperation("文档信息表-状态统计") |
| | | @GetMapping("/status") |
| | | public AjaxResult getStatusDistribution() { |
| | | return AjaxResult.success(documentationService.getStatusDistribution()); |
| | | } |
| | | } |