From 5bd5f3bcd6d2cb375feb0756505691b551339716 Mon Sep 17 00:00:00 2001 From: zhangfeng <1603559716@qq.com> Date: 星期五, 23 十二月 2022 08:55:23 +0800 Subject: [PATCH] Merge branch 'master' of https://sinanoaq.cn:8888/r/safePlatform-out into zf --- equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/impl/SafeMaterialInfoServiceImpl.java | 112 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 112 insertions(+), 0 deletions(-) diff --git a/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/impl/SafeMaterialInfoServiceImpl.java b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/impl/SafeMaterialInfoServiceImpl.java new file mode 100644 index 0000000..c77eb64 --- /dev/null +++ b/equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/baseService/impl/SafeMaterialInfoServiceImpl.java @@ -0,0 +1,112 @@ +package com.gkhy.safePlatform.equipment.service.baseService.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +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.excepiton.EquipmentException; +import com.gkhy.safePlatform.equipment.model.dto.req.SafeMaterialQuery; +import com.gkhy.safePlatform.equipment.repository.SafeMaterialInfoRepository; +import com.gkhy.safePlatform.equipment.service.baseService.SafeMaterialInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.List; + +@Service("SafeMaterialInfoService") +public class SafeMaterialInfoServiceImpl extends ServiceImpl<SafeMaterialInfoRepository, SafeMaterialInfo> implements SafeMaterialInfoService { + @Autowired + private SafeMaterialInfoRepository repository; + /** + * 获取所有数据,包括被删除的 + * @return + */ + @Override + public int getTotalCount() { + return repository.getTotalCount(); + } + + @Override + public SafeMaterialDO queryById(Long id) { + if(null == id){ + throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL); + } + return repository.queryById(id); + } + + @Override + public int deleteBatch(List<Long> ids) { + if(null == ids || ids.size() == 0){ + throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL); + } + repository.deleteBatch(ids); + return 0; + } + + @Override + public List<SafeMaterialInfo> list(){ + List<SafeMaterialInfo> safeMaterialInfos = repository.selectList(new LambdaQueryWrapper<SafeMaterialInfo>() + .eq(SafeMaterialInfo::getDelFlag, 0)); + return safeMaterialInfos; + + } + + @Override + public List<SafeMaterialDO> listByPage(Page<SafeMaterialDO> page, SafeMaterialQuery query) { + List<SafeMaterialDO> materialInfoList = repository.listByConditions(page, query); + return materialInfoList; + } + + @Override + public int getCountBySmallClassifyId(Long smallClassifyId) { + if(null == smallClassifyId){ + throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL); + } + return repository.getCountBySmallClassifyId(smallClassifyId); + } + + @Override + public boolean checkMaterial(Long smallClassifyId, Long depId, Long id) { + if(null == depId || null == smallClassifyId){ + throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL); + } + boolean flag = false; + int i = repository.checkMatrial(smallClassifyId,depId,id); + if (i>0){ + flag = true; + } + return flag; + } + + @Override + public void updateCountById(SafeMaterialBO safeMaterialBO) { + if(null == safeMaterialBO){ + throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL); + } + repository.updateCountById(safeMaterialBO); + } + + @Override + public List<SafeMaterialInfo> listByDepId(Long depId) { + if(null == depId){ + throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL); + } + List<SafeMaterialInfo> safeMaterialInfoList = repository.selectList(new LambdaQueryWrapper<SafeMaterialInfo>() + .eq(SafeMaterialInfo::getDelFlag, 0) + .eq(SafeMaterialInfo::getDepId, depId)); + return safeMaterialInfoList; + } + + @Override + public void updateStockCount(List<SafeMaterialBO> safeMaterialBOList) { + if(CollectionUtils.isEmpty(safeMaterialBOList)){ + throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL); + } + repository.updateStockCount(safeMaterialBOList); + } + + +} -- Gitblit v1.9.2