|  |  |  | 
|---|
|  |  |  | package com.ruoyi.system.service.impl; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | 
|---|
|  |  |  | import com.ruoyi.common.basic.PageInfo; | 
|---|
|  |  |  | import com.ruoyi.common.utils.StringUtils; | 
|---|
|  |  |  | import com.ruoyi.system.model.TErpGoodsType; | 
|---|
|  |  |  | import com.ruoyi.system.model.TErpGoodsUnit; | 
|---|
|  |  |  | import com.ruoyi.system.mapper.TErpGoodsUnitMapper; | 
|---|
|  |  |  | import com.ruoyi.system.query.TErpGoodsTypeQuery; | 
|---|
|  |  |  | import com.ruoyi.system.query.TErpGoodsUnitQuery; | 
|---|
|  |  |  | import com.ruoyi.system.service.TErpGoodsUnitService; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * <p> | 
|---|
|  |  |  | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Service | 
|---|
|  |  |  | public class TErpGoodsUnitServiceImpl extends ServiceImpl<TErpGoodsUnitMapper, TErpGoodsUnit> implements TErpGoodsUnitService { | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public boolean isExit(TErpGoodsUnit dto) { | 
|---|
|  |  |  | if(StringUtils.isNotEmpty(dto.getId())){ | 
|---|
|  |  |  | // 修改 | 
|---|
|  |  |  | return this.count(Wrappers.lambdaQuery(TErpGoodsUnit.class).ne(TErpGoodsUnit::getId, dto.getId()).eq(TErpGoodsUnit::getUnitName, dto.getUnitName())) > 0; | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | // 新增 | 
|---|
|  |  |  | return this.count(Wrappers.lambdaQuery(TErpGoodsUnit.class).eq(TErpGoodsUnit::getUnitName, dto.getUnitName())) > 0; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public PageInfo<TErpGoodsUnit> pageList(TErpGoodsUnitQuery query) { | 
|---|
|  |  |  | PageInfo<TErpGoodsUnit> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); | 
|---|
|  |  |  | List<TErpGoodsUnit> list = this.baseMapper.pageList(query,pageInfo); | 
|---|
|  |  |  | pageInfo.setRecords(list); | 
|---|
|  |  |  | return pageInfo; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|