Authored by caoyan

尺码集合

@@ -11,7 +11,7 @@ import com.yohoufo.dal.product.model.SizePoolDetail; @@ -11,7 +11,7 @@ import com.yohoufo.dal.product.model.SizePoolDetail;
11 */ 11 */
12 public interface SizePoolDetailMapper { 12 public interface SizePoolDetailMapper {
13 13
14 - List<SizePoolDetail> queryByProductId(@Param("productId") Integer productId); 14 + List<SizePoolDetail> queryByProductId(@Param("productId") Integer productId, @Param("isInclude") Integer isInclude, @Param("sizePoolId") Integer sizePoolId);
15 15
16 List<SizePoolDetail> queryByBrandId(@Param("brandId") Integer brandId); 16 List<SizePoolDetail> queryByBrandId(@Param("brandId") Integer brandId);
17 17
@@ -17,14 +17,17 @@ @@ -17,14 +17,17 @@
17 select 17 select
18 <include refid="Base_Column_List" /> 18 <include refid="Base_Column_List" />
19 from size_pool_detail 19 from size_pool_detail
20 - where is_include=1 and item_type=2 and item_id=#{productId} 20 + where is_include=#{isInclude} and item_type=2 and item_id=#{productId}
  21 + <if test="sizePoolId != null">
  22 + and size_pool_id = #{sizePoolId}
  23 + </if>
21 </select> 24 </select>
22 25
23 <select id="queryByBrandId" resultMap="BaseResultMap"> 26 <select id="queryByBrandId" resultMap="BaseResultMap">
24 select 27 select
25 <include refid="Base_Column_List" /> 28 <include refid="Base_Column_List" />
26 from size_pool_detail 29 from size_pool_detail
27 - where is_include=1 and item_type=1 and item_id=#{brandId} 30 + where is_include=1 and item_type=1 and item_id=#{brandId} limit 1
28 </select> 31 </select>
29 32
30 </mapper> 33 </mapper>
@@ -1976,9 +1976,14 @@ public class ProductServiceImpl implements ProductService { @@ -1976,9 +1976,14 @@ public class ProductServiceImpl implements ProductService {
1976 @Override 1976 @Override
1977 public SizeImageResp getSizeImage(Integer productId, Integer brandId) { 1977 public SizeImageResp getSizeImage(Integer productId, Integer brandId) {
1978 SizeImageResp resp = new SizeImageResp(); 1978 SizeImageResp resp = new SizeImageResp();
1979 - List<SizePoolDetail> list = sizePoolDetailMapper.queryByProductId(productId); 1979 + List<SizePoolDetail> list = sizePoolDetailMapper.queryByBrandId(brandId);
1980 if(CollectionUtils.isEmpty(list)) { 1980 if(CollectionUtils.isEmpty(list)) {
1981 - list = sizePoolDetailMapper.queryByBrandId(brandId); 1981 + list = sizePoolDetailMapper.queryByProductId(productId, 1, null);//包括
  1982 + }else {
  1983 + List<SizePoolDetail> notIncludeList = sizePoolDetailMapper.queryByProductId(productId, 0, list.get(0).getSizePoolId());//不包括
  1984 + if(!CollectionUtils.isEmpty(notIncludeList)) {
  1985 + return resp;
  1986 + }
1982 } 1987 }
1983 1988
1984 if(CollectionUtils.isEmpty(list)) { 1989 if(CollectionUtils.isEmpty(list)) {