| | |
| | | package com.yuanchu.limslaboratory.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.yuanchu.limslaboratory.pojo.Inspection; |
| | | import com.yuanchu.limslaboratory.mapper.InspectionMapper; |
| | | import com.yuanchu.limslaboratory.pojo.InspectionMaterialList; |
| | | import com.yuanchu.limslaboratory.pojo.InspectionProductList; |
| | | import com.yuanchu.limslaboratory.pojo.dto.InspectionDto; |
| | | import com.yuanchu.limslaboratory.service.InspectionService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class InspectionServiceImpl extends ServiceImpl<InspectionMapper, Inspection> implements InspectionService { |
| | | |
| | | @Resource |
| | | private InspectionMapper inspectionMapper; |
| | | |
| | | @Override |
| | | public Inspection addInspection(String userName,int type) { |
| | | Inspection inspection = new Inspection(type, 0,1,1, userName); |
| | | System.out.println(inspection); |
| | | int judge = inspectionMapper.insert(inspection); |
| | | System.out.println(judge); |
| | | return judge>0?inspection:null; |
| | | } |
| | | |
| | | @Override |
| | | public Map selectAllInspection(int pageSize, int countSize, Integer state) { |
| | | Map map = new HashMap(); |
| | | map.put("data",inspectionMapper.selectAllInspection((pageSize - 1) * countSize,pageSize * countSize, state)); |
| | | map.put("count", inspectionMapper.selectInspectToCount(state)); |
| | | return map; |
| | | } |
| | | |
| | | @Override |
| | | public boolean delInspectionByInsId(String inspectionId) { |
| | | Inspection inspection = new Inspection(); |
| | | inspection.setState(0); |
| | | inspection.setId(inspectionId); |
| | | int judge = inspectionMapper.updateById(inspection); |
| | | return judge>0; |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public boolean subInspectionByInsId(String inspectionId) { |
| | | Inspection inspection = new Inspection(); |
| | | inspection.setState(2); |
| | | inspection.setId(inspectionId); |
| | | inspection.setInspectStartTime(LocalDateTime.now()); |
| | | int judge = inspectionMapper.updateById(inspection); |
| | | return judge>0; |
| | | } |
| | | } |