ProductEntryServiceImpl.java 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package jnpf.service.impl;
  2. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  3. import com.baomidou.mybatisplus.core.metadata.IPage;
  4. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  5. import jnpf.base.Pagination;
  6. import jnpf.base.service.SuperServiceImpl;
  7. import jnpf.entity.ProductEntryEntity;
  8. import jnpf.mapper.ProductEntryMapper;
  9. import jnpf.service.ProductEntryService;
  10. import jnpf.util.StringUtil;
  11. import org.springframework.stereotype.Service;
  12. import java.util.List;
  13. /**
  14. * 销售订单明细
  15. * 版本: V3.1.0
  16. * 版权: 引迈信息技术有限公司(https://www.jnpfsoft.com)
  17. * 作者: JNPF开发平台组
  18. * 日期: 2021-07-10 10:40:59
  19. */
  20. @Service
  21. public class ProductEntryServiceImpl extends SuperServiceImpl<ProductEntryMapper, ProductEntryEntity> implements ProductEntryService {
  22. @Override
  23. public List<ProductEntryEntity> getProductentryEntityList(String id) {
  24. QueryWrapper<ProductEntryEntity> queryWrapper = new QueryWrapper<>();
  25. queryWrapper.lambda().eq(ProductEntryEntity::getProductId, id);
  26. return this.list(queryWrapper);
  27. }
  28. @Override
  29. public List<ProductEntryEntity> getProductentryEntityList(Pagination pagination) {
  30. QueryWrapper<ProductEntryEntity> queryWrapper = new QueryWrapper<>();
  31. if(StringUtil.isNotEmpty(pagination.getKeyword())){
  32. queryWrapper.lambda().and(
  33. t->t.like(ProductEntryEntity::getProductName, pagination.getKeyword())
  34. .or().like(ProductEntryEntity::getProductCode, pagination.getKeyword())
  35. .or().like(ProductEntryEntity::getProductSpecification, pagination.getKeyword())
  36. );
  37. }
  38. Page<ProductEntryEntity> page = new Page<>(pagination.getCurrentPage(), pagination.getPageSize());
  39. IPage<ProductEntryEntity> userIPage = this.page(page, queryWrapper);
  40. return pagination.setData(userIPage.getRecords(), userIPage.getTotal());
  41. }
  42. }