yujian
2019-11-29 444da68b958e53c7fa122db62723fce25368ee1d
fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoServiceImpl.java
@@ -119,7 +119,8 @@
         
         BrandInfo resultObj = new BrandInfo();
         resultObj.setId(record.getId());
         resultObj.setWeight(Double.valueOf(record.getId()));
         resultObj.setOrder(Integer.valueOf(record.getId().toString()));
         resultObj.setWeight(500.00);
         brandInfoMapper.updateByPrimaryKeySelective(resultObj);
      } else {
         BrandInfo resultObj = brandInfoMapper.selectByPrimaryKey(id);
@@ -145,6 +146,7 @@
            record.setShopTotal(resultObj.getShopTotal());
         }
         
         record.setOrder(resultObj.getOrder());
         record.setWeight(resultObj.getWeight());
         record.setCreateTime(resultObj.getCreateTime());
         record.setUpdateTime(new Date());
@@ -226,18 +228,18 @@
      if (resultObj == null) 
         throw new BrandInfoException(1, "操作数据已不存在");
      
      Double oldOrder = resultObj.getWeight();
      Integer oldOrder = resultObj.getOrder();
      BrandInfo changeObj = brandInfoMapper.getByAdjoinOrder(resultObj.getBrandClass().getId(),oldOrder, moveType);
      if (changeObj == null )
         throw new BrandInfoException(1, "已经在最边缘,无可交换的位置");
      
      BrandInfo changeObj1 = new BrandInfo();
      changeObj1.setId(id);
      changeObj1.setWeight(changeObj.getWeight());
      changeObj1.setOrder(changeObj.getOrder());
      
      BrandInfo changeObj2 = new BrandInfo();
      changeObj2.setId(changeObj.getId());
      changeObj2.setWeight(oldOrder);
      changeObj2.setOrder(oldOrder);
      
      brandInfoMapper.updateByPrimaryKeySelective(changeObj1);
      brandInfoMapper.updateByPrimaryKeySelective(changeObj2);
@@ -370,6 +372,7 @@
         brandInfo.setGoodsTotal(numInfo.getGoodsTotal());
         brandInfo.setShopTotal(numInfo.getShopTotal());
         brandInfo.setUpdateTime(new Date());
         brandInfo.setWeight(Math.random() * 1000);
         brandInfoMapper.updateByPrimaryKeySelective(brandInfo);
      }
   }