Authored by mali

详情接口性能优化

@@ -193,7 +193,7 @@ public class ProductHelpService { @@ -193,7 +193,7 @@ public class ProductHelpService {
193 /** 193 /**
194 * 商品维护设置各种库存的最低价或者最高价 194 * 商品维护设置各种库存的最低价或者最高价
195 * @param goodsSizes 195 * @param goodsSizes
196 - * @param mapper 196 + * @param mapper 获取库存类型的价格
197 * @param consumer 197 * @param consumer
198 * @return 198 * @return
199 */ 199 */
@@ -169,22 +169,15 @@ public class ProductServiceImpl implements ProductService { @@ -169,22 +169,15 @@ public class ProductServiceImpl implements ProductService {
169 @Override 169 @Override
170 public ProductDetailResp queryProductDetailById(Integer productId) { 170 public ProductDetailResp queryProductDetailById(Integer productId) {
171 ProductDetailResp productDetailResp = new ProductDetailResp(); 171 ProductDetailResp productDetailResp = new ProductDetailResp();
172 - Product product = productMapper.selectByPrimaryKey(productId); 172 + Product product = productHelpService.selectByIdCache(productId);
173 if (product != null) { 173 if (product != null) {
174 ProductInfo productInfo = new ProductInfo(); 174 ProductInfo productInfo = new ProductInfo();
175 - productInfo.setProductId(product.getId());  
176 - productInfo.setProductName(product.getProductName());  
177 - productInfo.setProductCode(product.getProductCode());  
178 - productInfo.setMaxSortId(product.getMaxSortId());  
179 - productInfo.setMaxPrice(product.getMaxPrice());  
180 - productInfo.setMinPrice(product.getMinPrice());  
181 - productInfo.setShelveStatus(product.getShelveStatus());  
182 - productInfo.setGender(productHelpService.getGenderName(product.getGender()));  
183 - productInfo.setSaleTime((product.getSaleTime() == null || product.getSaleTime().equals(0)) ? "0" : DateUtil.getDateString(product.getSaleTime(), DateUtil.YYYY_MM_DD_DOT));  
184 - productInfo.setOfferPrice(product.getOfferPrice());  
185 - setBrand(productInfo, product.getBrandId());  
186 - setSeries(productInfo, product.getSeriesId());  
187 - productInfo.setLeastPrice(null); 175 + productInfo.setProductId(product.getId()).setProductName(product.getProductName()).setProductCode(product.getProductCode())
  176 + .setMaxSortId(product.getMaxSortId()).setMaxPrice(product.getMaxPrice()).setMinPrice(product.getMinPrice()).setLeastPrice(null)
  177 + .setShelveStatus(product.getShelveStatus()).setGender(productHelpService.getGenderName(product.getGender())).setOfferPrice(product.getOfferPrice())
  178 + .setSaleTime((product.getSaleTime() == null || product.getSaleTime().equals(0)) ? "0" : DateUtil.getDateString(product.getSaleTime(), DateUtil.YYYY_MM_DD_DOT));
  179 +
  180 + productHelpService.setBrand(productInfo, product.getBrandId()).setSeries(productInfo, product.getSeriesId());
188 181
189 List<GoodsBO> goodsBOList = getGoodsList(product.getId(), product.getMinPrice(), product.getMaxPrice()); 182 List<GoodsBO> goodsBOList = getGoodsList(product.getId(), product.getMinPrice(), product.getMaxPrice());
190 if (!CollectionUtils.isEmpty(goodsBOList) && goodsBOList.get(0) != null) { 183 if (!CollectionUtils.isEmpty(goodsBOList) && goodsBOList.get(0) != null) {