| | |
| | | package com.sinata.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.sinata.common.entity.PageDTO; |
| | | import com.sinata.system.domain.MwCollectRecord; |
| | | import com.sinata.system.domain.SysDepartment; |
| | | import com.sinata.system.domain.dto.MwCollectRecordDTO; |
| | | import com.sinata.system.domain.query.MwCollectRecordQuery; |
| | | import com.sinata.system.domain.vo.MedicalWasteProcessVO; |
| | | import com.sinata.system.domain.vo.MwCollectRecordVO; |
| | | import com.sinata.system.mapper.MwCollectRecordMapper; |
| | | import com.sinata.system.service.MwCollectRecordService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.sinata.system.service.SysDepartmentService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @since 2024-12-02 |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class MwCollectRecordServiceImpl extends ServiceImpl<MwCollectRecordMapper, MwCollectRecord> implements MwCollectRecordService { |
| | | private final SysDepartmentService sysDepartmentService; |
| | | |
| | | /** |
| | | * 医废追溯分页列表 |
| | | * |
| | | * @param query |
| | | * @return |
| | | */ |
| | | @Override |
| | | public PageDTO<MwCollectRecordVO> pageList(MwCollectRecordQuery query) { |
| | | String treeCode = ""; |
| | | if (Objects.isNull(query.getDepartmentId())) { |
| | | SysDepartment myDepartment = sysDepartmentService.getMyDepartment(); |
| | | if (Objects.isNull(myDepartment)) { |
| | | return PageDTO.empty(0L, 0L); |
| | | } |
| | | treeCode = myDepartment.getTreeCode(); |
| | | } |
| | | Page<MwCollectRecordVO> page = baseMapper.pageList(new Page<>(query.getPageCurr(), query.getPageSize()), query, treeCode); |
| | | return PageDTO.of(page); |
| | | } |
| | | |
| | | /** |
| | | * 医废追溯详情 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @Override |
| | | public MwCollectRecordVO detail(Long id) { |
| | | return baseMapper.detail(id); |
| | | } |
| | | |
| | | /** |
| | | * 编辑 |
| | | * |
| | | * @param dto |
| | | */ |
| | | @Override |
| | | public void edit(MwCollectRecordDTO dto) { |
| | | MwCollectRecord collectRecord = getById(dto.getId()); |
| | | if (Objects.nonNull(collectRecord)) { |
| | | collectRecord.setWeight(dto.getWeight()); |
| | | updateById(collectRecord); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 流转过程 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @Override |
| | | public MedicalWasteProcessVO getProcess(Long id) { |
| | | return baseMapper.getProcess(id); |
| | | } |
| | | } |