¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.warehouse.service.impl; |
| | | |
| | | 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.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.warehouse.dto.DocumentationDto; |
| | | import com.ruoyi.warehouse.pojo.Documentation; |
| | | import com.ruoyi.warehouse.pojo.DocumentationBorrowManagement; |
| | | import com.ruoyi.warehouse.service.DocumentationService; |
| | | import com.ruoyi.warehouse.mapper.DocumentationMapper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author 86151 |
| | | * @description é对表ãdocumentation(ææ¡£ä¿¡æ¯è¡¨)ãçæ°æ®åºæä½Serviceå®ç° |
| | | * @createDate 2025-08-14 14:05:49 |
| | | */ |
| | | @Service |
| | | public class DocumentationServiceImpl extends ServiceImpl<DocumentationMapper, Documentation> |
| | | implements DocumentationService{ |
| | | @Autowired |
| | | private DocumentationMapper documentationMapper; |
| | | @Override |
| | | public IPage<DocumentationDto> listPage(Page page, Documentation documentation) { |
| | | return documentationMapper.listPage(page, documentation); |
| | | } |
| | | |
| | | @Override |
| | | public void export(HttpServletResponse response,Documentation documentation) { |
| | | IPage<DocumentationDto> list = documentationMapper.listPage(null, documentation); |
| | | ExcelUtil<DocumentationDto> util = new ExcelUtil<>(DocumentationDto.class); |
| | | util.exportExcel(response, list.getRecords(), "ææ¡£ä¿¡æ¯è¡¨"); |
| | | } |
| | | |
| | | @Override |
| | | public boolean deleteByIds(List<Long> ids) { |
| | | List<Documentation> documentationList = documentationMapper.selectList(new LambdaQueryWrapper<Documentation>().in(Documentation::getId, ids)); |
| | | for (Documentation documentation : documentationList) { |
| | | //å¦æææ¡£ç¶ææ¯å·²ååºï¼ä¸è½å é¤ |
| | | if ("ååº".equals(documentation.getDocStatus()) || "ä½åº".equals(documentation.getDocStatus())) { |
| | | throw new RuntimeException("å½åææ¡£ç¶æä¸º " + documentation.getDocStatus() + "ï¼ä¸æ¯æå é¤"); |
| | | } |
| | | documentationMapper.deleteById(documentation.getId()); |
| | | } |
| | | return true; |
| | | } |
| | | /** |
| | | * åè¡¨ææææ¡£ |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<DocumentationDto> listAll() { |
| | | List<DocumentationDto> list = documentationMapper.list().stream().filter(documentationDto -> "æ£å¸¸".equals(documentationDto.getDocStatus())).collect(Collectors.toList()); |
| | | return list; |
| | | } |
| | | /** |
| | | * è·åææ¡£æ»æ° |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Integer getTotalDocsCount() { |
| | | return documentationMapper.countTotalDocs(); |
| | | } |
| | | /** |
| | | * è·åææ¡£åç±»æ»æ° |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Integer getCategoryNumCount() { |
| | | return documentationMapper.countCategoryNum(); |
| | | } |
| | | /** |
| | | * è·åå·²ååºææ¡£æ»æ° |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Integer getBorrowedDocsCount() { |
| | | return documentationMapper.countBorrowedDocs(); |
| | | } |
| | | /** |
| | | * è·åæ¯ææ°å¢ææ¡£æ»æ° |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Integer getMonthlyAddedDocsCount() { |
| | | return documentationMapper.countMonthlyAddedDocs(); |
| | | } |
| | | /** |
| | | * è·åææ¡£åç±»åå¸ |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> getCategoryDistribution() { |
| | | return documentationMapper.countCategoryDistribution(); |
| | | } |
| | | /** |
| | | * è·åææ¡£ç¶æåå¸ |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> getStatusDistribution() { |
| | | return documentationMapper.countStatusDistribution(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |