zss
2023-07-26 f330903e12d38af89d61f16c96856924d241a0f2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package com.yuanchu.limslaboratory.service.impl;
 
 
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.yuanchu.limslaboratory.mapper.InspectionMaterialListMapper;
import com.yuanchu.limslaboratory.mapper.InspectionProductListMapper;
import com.yuanchu.limslaboratory.pojo.InspectionMaterialList;
import com.yuanchu.limslaboratory.pojo.InspectionProductList;
import com.yuanchu.limslaboratory.pojo.Plan;
import com.yuanchu.limslaboratory.mapper.PlanMapper;
import com.yuanchu.limslaboratory.pojo.dto.PlanDto;
import com.yuanchu.limslaboratory.service.PlanService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
 
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
 
/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author 江苏鵷雏网络科技有限公司
 * @since 2023-07-17
 */
@Service
public class PlanServiceImpl extends ServiceImpl<PlanMapper, Plan> implements PlanService {
 
    @Resource
    PlanMapper planMapper;
 
    @Resource
    InspectionProductListMapper inspectionProductListMapper;
 
    //查询所有检验计划分配
    @Override
    public Map selectAllPlan(int pageSize, int countSize, Integer state) {
        if (state == null) {
            state = 2;
        }
        return planMapper.selectAllPlan((pageSize - 1) * countSize, pageSize * countSize, state);
    }
 
    //作废检验计划
    @Override
    public boolean delPlan(Integer id) {
        Plan plan = planMapper.selectById(id);
        //状态改为作废0
        plan.setState(0);
        int judge = planMapper.updateById(plan);
        return judge > 0;
    }
 
    //根据样品id查询检验计划里面的检验项目
    @Override
    public List<InspectionProductList> selectProductById(Integer id) {
        return inspectionProductListMapper.selectByMaterId(id);
    }
 
    //修改检验计划里分配计划的信息
    @Override
    public void upPlan(InspectionProductList inspectionProductList) {
        LambdaUpdateWrapper<InspectionProductList> updateWrapper = new LambdaUpdateWrapper<>();
        updateWrapper.eq(InspectionProductList::getInspectionMaterialListId, inspectionProductList.getInspectionMaterialListId())
                .eq(InspectionProductList::getMethod, inspectionProductList.getMethod());
        inspectionProductListMapper.update(inspectionProductList, updateWrapper);
    }
 
    //查询成品检验
    @Override
    public List<PlanDto> selectInspection(int pageSize, int countSize, Integer state) {
        return planMapper.selectInspection((pageSize - 1) * countSize, pageSize * countSize, state);
    }
}