Authored by caoyan

尺码集合

... ... @@ -11,7 +11,7 @@ import com.yohoufo.dal.product.model.SizePoolDetail;
*/
public interface SizePoolDetailMapper {
List<SizePoolDetail> queryByProductId(@Param("productId") Integer productId);
List<SizePoolDetail> queryByProductId(@Param("productId") Integer productId, @Param("isInclude") Integer isInclude, @Param("sizePoolId") Integer sizePoolId);
List<SizePoolDetail> queryByBrandId(@Param("brandId") Integer brandId);
... ...
... ... @@ -17,14 +17,17 @@
select
<include refid="Base_Column_List" />
from size_pool_detail
where is_include=1 and item_type=2 and item_id=#{productId}
where is_include=#{isInclude} and item_type=2 and item_id=#{productId}
<if test="sizePoolId != null">
and size_pool_id = #{sizePoolId}
</if>
</select>
<select id="queryByBrandId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from size_pool_detail
where is_include=1 and item_type=1 and item_id=#{brandId}
where is_include=1 and item_type=1 and item_id=#{brandId} limit 1
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -1976,9 +1976,14 @@ public class ProductServiceImpl implements ProductService {
@Override
public SizeImageResp getSizeImage(Integer productId, Integer brandId) {
SizeImageResp resp = new SizeImageResp();
List<SizePoolDetail> list = sizePoolDetailMapper.queryByProductId(productId);
List<SizePoolDetail> list = sizePoolDetailMapper.queryByBrandId(brandId);
if(CollectionUtils.isEmpty(list)) {
list = sizePoolDetailMapper.queryByBrandId(brandId);
list = sizePoolDetailMapper.queryByProductId(productId, 1, null);//包括
}else {
List<SizePoolDetail> notIncludeList = sizePoolDetailMapper.queryByProductId(productId, 0, list.get(0).getSizePoolId());//不包括
if(!CollectionUtils.isEmpty(notIncludeList)) {
return resp;
}
}
if(CollectionUtils.isEmpty(list)) {
... ...