zhangfeng
2022-11-21 99968f83982943669af3829ea6bc3bbe745cada4
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
package com.gkhy.safePlatform.equipment.service.baseService.impl;
 
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gkhy.safePlatform.commons.enums.ResultCodes;
import com.gkhy.safePlatform.commons.utils.StringUtils;
import com.gkhy.safePlatform.equipment.entity.*;
import com.gkhy.safePlatform.equipment.enums.IssueReceiptEnum;
import com.gkhy.safePlatform.equipment.enums.ValidStatusEnum;
import com.gkhy.safePlatform.equipment.excepiton.EquipmentException;
import com.gkhy.safePlatform.equipment.model.dto.req.SafeMaterialClassifyQuery;
import com.gkhy.safePlatform.equipment.repository.SafeMaterialClassifyInfoRepository;
import com.gkhy.safePlatform.equipment.service.baseService.SafeMaterialClassifyInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
 
import java.io.InputStream;
import java.util.List;
 
@Service("SafeMaterialClassifyInfoService")
public class SafeMaterialClassifyInfoServiceImpl extends ServiceImpl<SafeMaterialClassifyInfoRepository, SafeMaterialClassifyInfo> implements SafeMaterialClassifyInfoService {
   @Autowired
   private SafeMaterialClassifyInfoRepository repository;
   @Override
   public boolean save(SafeMaterialClassifyInfo classifyInfo) {
       boolean flag = true;
       int i = repository.save(classifyInfo);
       if(i == 0){
           flag = false;
       }
        return flag;
   }
 
    //@Override
    public int update(SafeMaterialClassifyInfo classifyInfo) {
       if(classifyInfo.getId() == null){
           throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL);
       }
        int i = repository.update(classifyInfo);
        return i;
    }
 
 
    @Override
    public SafeMaterialClassifyInfo queryById(Long id) {
       if(id == null){
           throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL);
       }
        return repository.queryById(id);
    }
    @Override
    public List<SafeMaterialClassifyInfo> list(){
        List<SafeMaterialClassifyInfo> list = repository.selectList(new LambdaQueryWrapper<SafeMaterialClassifyInfo>()
                .eq(SafeMaterialClassifyInfo::getDelFlag, 0)
        );
        return list;
    }
 
    @Override
    public List<SafeMaterialClassifyInfo> getList(){
        List<SafeMaterialClassifyInfo> list = repository.selectList(new LambdaQueryWrapper<SafeMaterialClassifyInfo>()
                .eq(SafeMaterialClassifyInfo::getDelFlag,0)
                .eq(SafeMaterialClassifyInfo::getParentId,0l));
        return list;
    }
 
    @Override
    public List<SafeMaterialClassifyInfo> getListByParentId(Long parentId) {
       if(null == parentId){
           throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL);
       }
        return repository.getListByParentId(parentId);
    }
 
    @Override
    public SafeMaterialClassifyDO getBigAndSmallClassify(Long smallClassifyId) {
        if(null == smallClassifyId){
            throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL);
        }
        return repository.getBigAndSmallClassify(smallClassifyId);
    }
 
    @Override
    public List<SafeMaterialClassifyInfo> getClassifyListByIds(List<Long> ids) {
       if(CollectionUtils.isEmpty(ids)){
           throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL);
       }
        return repository.selectList(new LambdaQueryWrapper<SafeMaterialClassifyInfo>()
                .eq(SafeMaterialClassifyInfo::getDelFlag,0)
                .in(SafeMaterialClassifyInfo::getId,ids)
        );
    }
 
    @Override
    public List<SafeMaterialClassifyDO> getTraceabilityClassifyList(List<Long> smallClassifyIds) {
       if(CollectionUtils.isEmpty(smallClassifyIds)){
           throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL);
        }
        return repository.getTraceabilityClassifyList(smallClassifyIds);
    }
 
 
}