/* * (non-Javadoc) * * @see * com.legendshop.business.service.BrandService#save(com.legendshop.model * .entity.Brand) */ @Override public Long save(Brand brand) { if (!AppUtils.isBlank(brand.getBrandId())) { update(brand); return brand.getBrandId(); } return (Long) brandDao.save(brand); }
private List<KeyValueEntity> convertToEntity(List<Brand> list) { if (AppUtils.isBlank(list)) { return null; } List<KeyValueEntity> result = new ArrayList<KeyValueEntity>(list.size()); for (Brand brand : list) { KeyValueEntity entity = new KeyValueEntity(); entity.setKey(String.valueOf(brand.getBrandId())); entity.setValue(brand.getBrandName()); result.add(entity); } return result; }