管理后台商品数量去除已删除商品

This commit is contained in:
lifenlong 2021-05-20 11:35:54 +08:00
parent 9bd1e6344a
commit d50388001f

View File

@ -55,9 +55,6 @@ import java.util.List;
@Transactional @Transactional
public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements GoodsService { public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements GoodsService {
//商品
@Autowired
private GoodsMapper goodsMapper;
//商品属性 //商品属性
@Autowired @Autowired
private GoodsParamsService goodsParamsService; private GoodsParamsService goodsParamsService;
@ -85,7 +82,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
@Override @Override
public void underStoreGoods(String storeId) { public void underStoreGoods(String storeId) {
this.goodsMapper.underStoreGoods(storeId); this.baseMapper.underStoreGoods(storeId);
} }
@Override @Override
@ -237,15 +234,10 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
public Integer goodsNum(GoodsStatusEnum goodsStatusEnum, GoodsAuthEnum goodsAuthEnum) { public Integer goodsNum(GoodsStatusEnum goodsStatusEnum, GoodsAuthEnum goodsAuthEnum) {
LambdaQueryWrapper<Goods> queryWrapper = Wrappers.lambdaQuery(); LambdaQueryWrapper<Goods> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(Goods::getDeleteFlag,false); queryWrapper.eq(Goods::getDeleteFlag,false)
.eq(goodsStatusEnum != null,Goods::getMarketEnable, goodsStatusEnum.name())
if (goodsStatusEnum != null) { .eq(goodsAuthEnum != null,Goods::getIsAuth, goodsAuthEnum.name())
queryWrapper.eq(Goods::getMarketEnable, goodsStatusEnum.name()); .eq(StringUtils.equals(UserContext.getCurrentUser().getRole().name(), UserEnums.STORE.name()),
}
if (goodsAuthEnum != null) {
queryWrapper.eq(Goods::getIsAuth, goodsAuthEnum.name());
}
queryWrapper.eq(StringUtils.equals(UserContext.getCurrentUser().getRole().name(), UserEnums.STORE.name()),
Goods::getStoreId, UserContext.getCurrentUser().getStoreId()); Goods::getStoreId, UserContext.getCurrentUser().getStoreId());
return this.count(queryWrapper); return this.count(queryWrapper);