Esempio n. 1
0
 @Override
 public String generateItem(ProductType productType) {
   if (productType != null) {
     Product lastProduct = productDao.getLastProduct(productType);
     if (lastProduct == null) {
       return productType.getItem() + String.format("%07d", 1);
     } else {
       String lastItem = lastProduct.getItem().substring(productType.getItem().length());
       if (StringUtils.isBlank(lastItem)) {
         lastItem = "0";
       }
       Integer newItemValue = Integer.valueOf(lastItem) + 1;
       return productType.getItem() + String.format("%07d", newItemValue);
     }
   }
   return null;
 }
Esempio n. 2
0
 /**
  * @Title:检查是否已经存在此产品
  *
  * @param t需要进行检查的实体
  * @return boolean
  */
 private boolean checkExist(Product t) {
   if (t != null) {
     return productDao.checkExist(t);
   }
   return false;
 }