¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.warehouse.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | 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.dto.DocumentationDto; |
| | | import com.ruoyi.warehouse.pojo.Documentation; |
| | | import com.ruoyi.warehouse.pojo.Warehouse; |
| | | import com.ruoyi.warehouse.service.DocumentationService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | 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") |
| | | @Api(tags = "ææ¡£ä¿¡æ¯è¡¨") |
| | | public class DocumentationController extends BaseController { |
| | | @Autowired |
| | | private DocumentationService documentationService; |
| | | @GetMapping("/listPage") |
| | | @ApiOperation("ææ¡£ä¿¡æ¯è¡¨-å页æ¥è¯¢") |
| | | @Log(title = "ææ¡£ä¿¡æ¯è¡¨-å页æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPage(Page page, Documentation documentation) { |
| | | IPage<DocumentationDto> list = documentationService.listPage(page, documentation); |
| | | return AjaxResult.success(list); |
| | | } |
| | | @GetMapping("/list") |
| | | @ApiOperation("ææ¡£ä¿¡æ¯è¡¨æ¥è¯¢") |
| | | @Log(title = "ææ¡£ä¿¡æ¯è¡¨æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | public AjaxResult list() { |
| | | List<DocumentationDto> list = documentationService.listAll(); |
| | | return AjaxResult.success(list); |
| | | } |
| | | @PostMapping("/add") |
| | | @ApiOperation("ææ¡£ä¿¡æ¯è¡¨-æ·»å ") |
| | | @Log(title = "ææ¡£ä¿¡æ¯è¡¨-æ·»å ", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody Documentation documentation) { |
| | | return AjaxResult.success(documentationService.save(documentation)); |
| | | } |
| | | @PutMapping("/update") |
| | | @ApiOperation("ææ¡£ä¿¡æ¯è¡¨-æ´æ°") |
| | | @Log(title = "ææ¡£ä¿¡æ¯è¡¨-æ´æ°", businessType = BusinessType.UPDATE) |
| | | public AjaxResult update(@RequestBody Documentation documentation) { |
| | | return AjaxResult.success(documentationService.updateById(documentation)); |
| | | } |
| | | @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.deleteByIds(ids)); |
| | | } |
| | | |
| | | @PostMapping("/export") |
| | | @ApiOperation("ææ¡£ä¿¡æ¯è¡¨-导åº") |
| | | @Log(title = "ææ¡£ä¿¡æ¯è¡¨-导åº", businessType = BusinessType.EXPORT) |
| | | 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()); |
| | | } |
| | | } |