From 97b1216bd4bd05352f9f7720833283ada4edf912 Mon Sep 17 00:00:00 2001 From: xuhy <3313886187@qq.com> Date: 星期四, 04 九月 2025 20:46:22 +0800 Subject: [PATCH] crm用户 --- ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpGoodsServiceImpl.java | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 46 insertions(+), 0 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpGoodsServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpGoodsServiceImpl.java index 90a53c9..aebdb89 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpGoodsServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpGoodsServiceImpl.java @@ -1,10 +1,24 @@ package com.ruoyi.system.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.basic.PageInfo; +import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.system.mapper.TErpGoodsMapper; +import com.ruoyi.system.mapper.TErpGoodsTypeMapper; +import com.ruoyi.system.mapper.TErpSupplierInventoryMapper; +import com.ruoyi.system.mapper.TErpSupplierWarehousingMapper; import com.ruoyi.system.model.TErpGoods; +import com.ruoyi.system.model.TErpGoodsType; +import com.ruoyi.system.model.TSysBanner; +import com.ruoyi.system.query.TErpGoodsQuery; import com.ruoyi.system.service.TErpGoodsService; +import com.ruoyi.system.vo.TErpGoodsVO; import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; +import java.util.stream.Collectors; /** * <p> @@ -17,4 +31,36 @@ @Service public class TErpGoodsServiceImpl extends ServiceImpl<TErpGoodsMapper, TErpGoods> implements TErpGoodsService { + @Resource + private TErpGoodsTypeMapper erpGoodsTypeMapper; + + + @Override + public PageInfo<TErpGoodsVO> pageList(TErpGoodsQuery query, SysUser user) { + PageInfo<TErpGoodsVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); + List<TErpGoodsVO> list = this.baseMapper.pageList(query,pageInfo,user); + if(list.isEmpty()){ + return pageInfo; + } + List<String> typeIds = list.stream().map(TErpGoods::getTypeId).collect(Collectors.toList()); + if(!typeIds.isEmpty()){ + List<TErpGoodsType> typeList = erpGoodsTypeMapper.selectBatchIds(typeIds); + for (TErpGoodsVO tErpGoodsVO : list) { + typeList.stream().filter(t -> t.getId().equals(tErpGoodsVO.getTypeId())).findFirst().ifPresent(t -> tErpGoodsVO.setTypeName(t.getTypeName())); + tErpGoodsVO.setTypeName(tErpGoodsVO.getTypeName()); + } + } + pageInfo.setRecords(list); + return pageInfo; + } + + @Override + public boolean isExit(String goodsIdCode,String quasiNumber) { + Long size = this.baseMapper.selectCount(new LambdaQueryWrapper<>(TErpGoods.class).eq(TErpGoods::getGoodsIdCode, goodsIdCode).or().eq(TErpGoods::getQuasiNumber, quasiNumber)); + if(size>0){ + return true; + } + + return false; + } } -- Gitblit v1.7.1