|  |  | 
 |  |  |         } | 
 |  |  |         try{ | 
 |  |  |  | 
 |  |  |             flowerMapper.updateTypeRankNull(flower.getCategory(),flower.getLevel()); | 
 |  |  |  | 
 |  |  |             QueryWrapper<Flower> queryWrapper=new QueryWrapper<>(); | 
 |  |  |             queryWrapper.lambda().eq(Flower::getDeleted,false) | 
 |  |  |                     .eq(Objects.nonNull(flower.getCategory()),Flower::getCategory,flower.getCategory()) | 
 |  |  |                     .eq(StringUtils.isNotEmpty(flower.getLevel()),Flower::getLevel,flower.getLevel()) | 
 |  |  |                     .eq(Flower::getStatus,"UP") | 
 |  |  |                     .orderByAsc(Flower::getPrice); | 
 |  |  |             final List<Flower> flowerList = flowerMapper.selectList(queryWrapper); | 
 |  |  |  | 
 |  |  | 
 |  |  |         } else { | 
 |  |  |             g.setPrice(dto.getPrice()); | 
 |  |  |             g.setStock(dto.getStock()); | 
 |  |  |             g.setLimited(dto.getLimited()); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         g.update(SecurityUtils.getUserId()); | 
 |  |  | 
 |  |  |     public Long editFlowerAdmin(FlowerUpdateAdminDTO dto){ | 
 |  |  |         Flower g = flowerMapper.selectById(dto.getId()); | 
 |  |  |         g.setSales(dto.getSales()); | 
 |  |  |         if (!org.springframework.util.StringUtils.isEmpty(dto.getLimited())) { | 
 |  |  |             if (g.getStock() == 0 || org.springframework.util.StringUtils.isEmpty(g.getStock())) { | 
 |  |  |                 throw new ValidationException("库存为0或者空时不能修改限购数量"); | 
 |  |  |             } | 
 |  |  |             if(g.getStock()<dto.getLimited()){ | 
 |  |  |                 throw new ValidationException("限购数量不能大于库存"); | 
 |  |  |             } | 
 |  |  |             g.setLimited(dto.getLimited()); | 
 |  |  |         }else{ | 
 |  |  |             g.setLimited(null); | 
 |  |  |         } | 
 |  |  |         g.update(SecurityUtils.getUserId()); | 
 |  |  |         flowerMapper.updateById(g); | 
 |  |  |  | 
 |  |  | 
 |  |  |             //清除购物车商品 | 
 |  |  |             cartMapper.delete(new QueryWrapper<Cart>().eq("flower_id", id)); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         //更新排名 | 
 |  |  |         updateFlowTypeRank(null,f.getCategory(),f.getLevel()); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void deleteFlower(Long id){ | 
 |  |  | 
 |  |  |         return flowerDeleteDO; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void setFlowersLimited(FlowerLimitedDTO dto) { | 
 |  |  |         List<Long> ids = dto.getIds(); | 
 |  |  |         if (ids == null || ids.size() == 0) { | 
 |  |  |             throw new ValidationException("请选择商品"); | 
 |  |  |         } | 
 |  |  |         for (Long id : ids) { | 
 |  |  |             Flower f = flowerMapper.selectById(id); | 
 |  |  |             if (!org.springframework.util.StringUtils.isEmpty(dto.getLimited())) { | 
 |  |  |                 if (f.getStock() == 0 || org.springframework.util.StringUtils.isEmpty(f.getStock())) { | 
 |  |  |                     throw new ValidationException("商品" + f.getName() + "库存为0或者空时不能修改限购数量"); | 
 |  |  |                 } | 
 |  |  |                 if(f.getStock()<dto.getLimited()){ | 
 |  |  |                     throw new ValidationException("商品" + f.getName() + "限购数量不能大于库存"); | 
 |  |  |                 } | 
 |  |  |                 f.setLimited(dto.getLimited()); | 
 |  |  |             }else{ | 
 |  |  |                 f.setLimited(null); | 
 |  |  |             } | 
 |  |  |             flowerMapper.updateById(f); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } |