|  |  | 
 |  |  |  | 
 |  |  |     @Transactional(rollbackFor = {Exception.class,BusinessException.class}) | 
 |  |  |     @Override | 
 |  |  |     public void updateStatusByIds(List<Integer> idList, Integer status) { | 
 |  |  |         if (CollectionUtils.isEmpty(idList)){ | 
 |  |  |             throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"商品状态不能为空"); | 
 |  |  |     public void updateStatusByIds(BaseGoods param) { | 
 |  |  |         if (CollectionUtils.isEmpty(param.getIdList()) | 
 |  |  |                 || param.getStatus() == null | 
 |  |  |                || !(Constants.equalsInteger(param.getStatus(), Constants.ONE)||Constants.equalsInteger(param.getStatus()  ,Constants.ZERO))){ | 
 |  |  |             throw new BusinessException(ResponseStatus.BAD_REQUEST); | 
 |  |  |         } | 
 |  |  |         idList.forEach(s->updateStatusById(s,status)); | 
 |  |  |  | 
 |  |  |         param.getIdList().forEach(s->updateStatusById(s,param.getStatus())); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Transactional(rollbackFor = {Exception.class,BusinessException.class}) | 
 |  |  |     @Override | 
 |  |  |     public void updateStatusById(Integer id, Integer status) { | 
 |  |  |  | 
 |  |  |         LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); | 
 |  |  |         if (Objects.isNull(status)){ | 
 |  |  |             throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"商品状态不能为空"); | 
 |  |  |         } | 
 |  |  |         if (Constants.equalsInteger(status,Constants.ZERO)){ | 
 |  |  |             //如果启用 | 
 |  |  |             BaseGoods baseGoods = new BaseGoods(); | 
 |  |  |             baseGoods.setId(id); | 
 |  |  |             baseGoods.setEditDate(new Date()); | 
 |  |  |             baseGoods.setEditor(user.getId()); | 
 |  |  |             baseGoods.setStatus(status); | 
 |  |  |             baseGoodsMapper.updateById(baseGoods); | 
 |  |  |         }else if (Constants.equalsInteger(status,Constants.ONE)){ | 
 |  |  |             //如果禁用 | 
 |  |  |             BaseGoods baseGoods = new BaseGoods(); | 
 |  |  |             baseGoods.setId(id); | 
 |  |  |             baseGoods.setEditDate(new Date()); | 
 |  |  |             baseGoods.setEditor(user.getId()); | 
 |  |  |             baseGoods.setStatus(status); | 
 |  |  |             baseGoodsMapper.updateById(baseGoods); | 
 |  |  |  | 
 |  |  | 
 |  |  |             goodsUpdate.lambda() | 
 |  |  |                         .eq(Goods::getType,Constants.ONE) | 
 |  |  |                         .eq(Goods::getGoodsId,id) | 
 |  |  |                         .set(Goods::getStatus,Constants.ONE); | 
 |  |  |                         .set(Goods::getStatus,Constants.ONE) | 
 |  |  |                         .set(Goods::getEditor,user.getId()) | 
 |  |  |                         .set(Goods::getEditDate,new Date()); | 
 |  |  |             goodsMapper.update(null,goodsUpdate); | 
 |  |  |         } | 
 |  |  |     } |