zhangfeng
2022-11-21 99968f83982943669af3829ea6bc3bbe745cada4
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/impl/SafeMaterialClassifyInfoServiceImpl.java
@@ -4,15 +4,18 @@
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.SafeMaterialClassifyInfo;
import com.gkhy.safePlatform.equipment.entity.SafeMaterialInfo;
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")
@@ -47,17 +50,55 @@
        return repository.queryById(id);
    }
    @Override
    public List<SafeMaterialClassifyInfo> listByCondition(SafeMaterialClassifyQuery query){
    public List<SafeMaterialClassifyInfo> list(){
        List<SafeMaterialClassifyInfo> list = repository.selectList(new LambdaQueryWrapper<SafeMaterialClassifyInfo>()
                .eq(SafeMaterialClassifyInfo::getDelFlag, 0)
                .like(StringUtils.isNotBlank(query.getMaterialClassifyName()), SafeMaterialClassifyInfo::getMaterialClassifyName, query.getMaterialClassifyName())
        );
        return list;
    }
    @Override
    public List<SafeMaterialClassifyInfo> getList(){
        List<SafeMaterialClassifyInfo> list = repository.selectList(new LambdaQueryWrapper<SafeMaterialClassifyInfo>());
        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);
    }
}