Authored by Lixiaodi
Committed by mali

fixBug:重复尺码

@@ -39,4 +39,6 @@ public interface StorageMapper { @@ -39,4 +39,6 @@ public interface StorageMapper {
39 int updateDeleteSuggestPrice(); 39 int updateDeleteSuggestPrice();
40 40
41 int updateSkuStatus(@Param("storageId")Integer storageId, @Param("status")Integer status); 41 int updateSkuStatus(@Param("storageId")Integer storageId, @Param("status")Integer status);
  42 +
  43 + Storage selectBySize(@Param("productId")Integer productId, @Param("sizeId")Integer sizeId);
42 } 44 }
@@ -113,4 +113,8 @@ @@ -113,4 +113,8 @@
113 <update id="updateSkuStatus"> 113 <update id="updateSkuStatus">
114 UPDATE storage s set s.status = #{status, jdbcType=INTEGER} where s.id = #{storageId, jdbcType=INTEGER} 114 UPDATE storage s set s.status = #{status, jdbcType=INTEGER} where s.id = #{storageId, jdbcType=INTEGER}
115 </update> 115 </update>
  116 + <select id="selectBySize" resultMap="BaseResultMap">
  117 + select id, product_id, goods_id, size_id, storage_num, update_time, create_time, suggest_low_price, suggest_high_price
  118 + from storage where product_id=#{productId} and size_id=#{sizeId}
  119 + </select>
116 </mapper> 120 </mapper>
@@ -211,6 +211,9 @@ public class SelfSizeServiceImpl implements ISelfSizeService { @@ -211,6 +211,9 @@ public class SelfSizeServiceImpl implements ISelfSizeService {
211 if(null == selfSize) { 211 if(null == selfSize) {
212 throw new PlatformException("记录不存在", 400); 212 throw new PlatformException("记录不存在", 400);
213 } 213 }
  214 + if (storageMapper.selectBySize(selfSize.getProductId(), selfSize.getSizeId()) != null) {
  215 + throw new PlatformException("该尺码已存在", 400);
  216 + }
214 UserHelper userInfo = new UserHelper(); 217 UserHelper userInfo = new UserHelper();
215 int num = selfSizeMapper.upadteAuditResult(req.getId(), req.getStatus(), userInfo.getUserId()); 218 int num = selfSizeMapper.upadteAuditResult(req.getId(), req.getStatus(), userInfo.getUserId());
216 //清商品详情缓存 219 //清商品详情缓存