Authored by wangnan

修改Mapper

Showing 37 changed files with 444 additions and 90 deletions
... ... @@ -21,5 +21,4 @@ public interface ActivityProductMapper {
int updateByPrimaryKey(ActivityProduct record);
List<ProductActivity> getProductActivity(List<Integer> skns);
}
\ No newline at end of file
... ...
... ... @@ -7,6 +7,6 @@ import java.util.List;
/**
* Created by wangnan on 2016/6/30.
*/
public interface FreeSizeProductMapper {
public interface BasePinRatioMapper {
List<BasePinRatio> getBasePinRatio(List<Integer> skns);
}
... ...
... ... @@ -7,6 +7,6 @@ import java.util.List;
/**
* Created by wangnan on 2016/6/30.
*/
public interface NonfreeSizeProductMapper {
public interface BrokenCodeProductMapper {
List<BrokenCode> getBrokenCode(List<Integer> skns);
}
... ...
... ... @@ -7,6 +7,6 @@ import java.util.List;
/**
* Created by wangnan on 2016/6/30.
*/
public interface DiscountProductMapper {
public interface DiscountProductSknMapper {
List<DiscountProductSkn> getDiscountProductSkn(List<Integer> skns);
}
... ...
package com.yoho.search.dal;
import com.yoho.search.dal.model.GoodsCoverImage;
import java.util.List;
/**
* Created by wangnan on 2016/11/10.
*/
public interface GoodsCoverImageMapper {
List<GoodsCoverImage> selectGoodsCoverImage(List<Integer> Ids);
}
... ...
package com.yoho.search.dal;
import java.util.List;
import com.yoho.search.dal.model.GoodsImages;
import org.apache.ibatis.annotations.Param;
import com.yoho.search.dal.model.GoodsCoverImage;
import com.yoho.search.dal.model.GoodsImages;
import com.yoho.search.dal.model.ProductDefaultImage;
import java.util.List;
public interface GoodsImagesMapper {
int deleteByPrimaryKey(Integer id);
... ... @@ -29,7 +26,5 @@ public interface GoodsImagesMapper {
List<Integer> getGoodsImagesByGoodsId(Integer id);
List<GoodsCoverImage> selectGoodsCoverImage(List<Integer> Ids);
List<ProductDefaultImage> selectProductDefaultImage(List<Integer> Ids);
}
\ No newline at end of file
... ...
package com.yoho.search.dal;
import java.util.List;
import java.util.Map;
import com.yoho.search.dal.model.Goods;
import org.apache.ibatis.annotations.Param;
import com.yoho.search.dal.model.Goods;
import com.yoho.search.dal.model.ProductColors;
import java.util.List;
import java.util.Map;
public interface GoodsMapper {
int deleteByPrimaryKey(Integer id);
... ... @@ -27,7 +25,7 @@ public interface GoodsMapper {
List<Map<String, Object>> getGoodListByProductId(Integer productId);
List<ProductColors> getProductColors(List<Integer> ids);
List<Integer> getAllIdsPage(@Param(value="offset")Integer offset, @Param(value="pageSize")Integer pageSize);
... ...
package com.yoho.search.dal;
import com.yoho.search.dal.model.ProductActivity;
import java.util.List;
/**
* Created by wangnan on 2016/11/10.
*/
public interface ProductActivityMapper {
List<ProductActivity> getProductActivity(List<Integer> skns);
}
... ...
package com.yoho.search.dal;
import com.yoho.search.dal.model.ProductColors;
import java.util.List;
/**
* Created by wangnan on 2016/11/10.
*/
public interface ProductColorsMapper {
List<ProductColors> getProductColors(List<Integer> ids);
}
... ...
package com.yoho.search.dal;
import com.yoho.search.dal.model.ProductDefaultImage;
import java.util.List;
/**
* Created by wangnan on 2016/11/10.
*/
public interface ProductDefaultImageMapper {
List<ProductDefaultImage> selectProductDefaultImage(List<Integer> Ids);
}
... ...
package com.yoho.search.dal;
import com.yoho.search.dal.model.ProductSearchBrand;
import java.util.List;
/**
* Created by wangnan on 2016/11/10.
*/
public interface ProductSearchBrandMapper {
List<ProductSearchBrand> getProductSearchBrand(List<Integer> skns);
}
... ...
package com.yoho.search.dal;
import java.util.List;
import com.yoho.search.dal.model.ProductSearchBrand;
import com.yoho.search.dal.model.ProductSearchShop;
import com.yoho.search.dal.model.ProductSearchSort;
import com.yoho.search.dal.model.ProductSearch;
import org.apache.ibatis.annotations.Param;
import com.yoho.search.dal.model.ProductSearch;
import java.util.List;
public interface ProductSearchMapper {
int deleteByPrimaryKey(Integer id);
... ... @@ -26,11 +22,11 @@ public interface ProductSearchMapper {
List<ProductSearch> getByIds(List<Integer> skns);
List<ProductSearchSort> getProductSearchSort(List<Integer> skns);
List<ProductSearchBrand> getProductSearchBrand(List<Integer> skns);
List<ProductSearchShop> getProductSearchShop(List<Integer> skns);
int count();
}
\ No newline at end of file
... ...
package com.yoho.search.dal;
import com.yoho.search.dal.model.ProductSearchShop;
import java.util.List;
/**
* Created by wangnan on 2016/11/10.
*/
public interface ProductSearchShopMapper {
List<ProductSearchShop> getProductSearchShop(List<Integer> skns);
}
... ...
package com.yoho.search.dal;
import com.yoho.search.dal.model.ProductSearchSort;
import java.util.List;
/**
* Created by wangnan on 2016/11/10.
*/
public interface ProductSearchSortMapper {
List<ProductSearchSort> getProductSearchSort(List<Integer> skns);
}
... ...
package com.yoho.search.dal;
import com.yoho.search.dal.model.ProductSizes;
import java.util.List;
/**
* Created by wangnan on 2016/11/10.
*/
public interface ProductSizesMapper {
List<ProductSizes> getProductSizes(List<Integer> ids);
}
... ...
package com.yoho.search.dal;
import com.yoho.search.dal.model.ProductStyles;
import java.util.List;
/**
* Created by wangnan on 2016/11/10.
*/
public interface ProductStyleMapper {
List<ProductStyles> selectProductStyles();
}
... ...
package com.yoho.search.dal;
import com.yoho.search.dal.model.ProductStyleRelation;
import com.yoho.search.dal.model.ProductStyles;
import org.apache.ibatis.annotations.Param;
import java.util.List;
... ... @@ -22,8 +21,6 @@ public interface ProductStyleRelationMapper {
List<ProductStyleRelation> getPageLists(@Param(value="offset")Integer offset, @Param(value="pageSize")Integer pageSize);
List<ProductStyleRelation> getStyleListByProductId(Integer productId);
List<ProductStyles> selectProductStyles();
Integer getProductIdByRelationId(Integer id);
... ...
package com.yoho.search.dal;
import java.util.List;
import com.yoho.search.dal.model.Storage;
import org.apache.ibatis.annotations.Param;
import com.yoho.search.dal.model.ProductSizes;
import com.yoho.search.dal.model.Storage;
import java.util.List;
public interface StorageMapper {
int deleteByPrimaryKey(Integer erpSkuId);
... ... @@ -33,7 +31,6 @@ public interface StorageMapper {
// 根据productId查询 -- amos.shan add on 2016-11-02
List<Storage> getByProductIds(List<Integer> ids);
List<ProductSizes> getProductSizes(List<Integer> ids);
int count();
}
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yoho.search.dal.DiscountProductMapper">
<mapper namespace="com.yoho.search.dal.DiscountProductSknMapper">
<resultMap id="BaseResultMap" type="com.yoho.search.dal.model.DiscountProductSkn">
<result column="product_skn" property="productSkn" jdbcType="INTEGER"/>
<result column="pool_id" property="poolId" jdbcType="VARCHAR"/>
... ...
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yoho.search.dal.FreeSizeProductMapper">
<mapper namespace="com.yoho.search.dal.BasePinRatioMapper">
<resultMap id="BaseResultMap" type="com.yoho.search.dal.model.BasePinRatio">
<result column="product_skn" property="productSkn" jdbcType="INTEGER"/>
<result column="base_pin_ratio" property="basePinRatio" jdbcType="INTEGER"/>
... ...
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yoho.search.dal.GoodsCoverImageMapper">
<resultMap id="GoodsCoverImage" type="com.yoho.search.dal.model.GoodsCoverImage">
<id column="id" property="id" jdbcType="INTEGER"/>
<result column="goods_id" property="goodsId" jdbcType="INTEGER"/>
<result column="cover_1" property="cover_1" jdbcType="VARCHAR"/>
<result column="cover_2" property="cover_2" jdbcType="VARCHAR"/>
</resultMap>
<select id="selectGoodsCoverImage" resultMap="GoodsCoverImage">
<![CDATA[
SELECT
`a`.`id` AS `id`,
`a`.`goods_id` AS `goods_id`,
(
CASE `a`.`gender_cover`
WHEN 1 THEN
`a`.`image_url`
END
) AS `cover_1`,
(
CASE `a`.`gender_cover`
WHEN 2 THEN
`a`.`image_url`
END
) AS `cover_2`
FROM
`goods_images` `a`
where
(`a`.`gender_cover` <> 0)
AND goods_id in]]>
<foreach item="item" index="index" collection="list"
open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yoho.search.dal.NonfreeSizeProductMapper">
<mapper namespace="com.yoho.search.dal.BrokenCodeProductMapper">
<resultMap id="BaseResultMap" type="com.yoho.search.dal.model.BrokenCode">
<result column="product_skn" property="productSkn" jdbcType="INTEGER"/>
<result column="breaking_rate" property="breakingRate" jdbcType="DOUBLE"/>
... ...
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yoho.search.dal.ProductActivityMapper">
<resultMap id="ProductActivity" type="com.yoho.search.dal.model.ProductActivity">
<result column="product_skn" property="productSkn" jdbcType="INTEGER"/>
<result column="activity" property="activity" jdbcType="VARCHAR"/>
</resultMap>
<select id="getProductActivity" resultMap="ProductActivity">
<![CDATA[
SELECT
`ap`.`product_skn` AS `product_skn`,
concat(
'{"activity_id":',
`ap`.`id`,
',"template_id":',
`ap`.`template_id`,
',"order_by":',
`ap`.`order_by`,
',"is_recommend":',
`ap`.`is_recommend`,
',"status":',
`ap`.`status`,
'}'
) AS `activity`
FROM
`activity_product` `ap`
where product_skn in]]>
<foreach item="item" index="index" collection="list"
open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yoho.search.dal.ProductDefaultImageMapper">
<resultMap id="ProductDefaultImage" type="com.yoho.search.dal.model.ProductDefaultImage">
<result column="product_id" property="productId" jdbcType="INTEGER"/>
<result column="default_images" property="defaultImage" jdbcType="VARCHAR"/>
</resultMap>
<select id="selectProductDefaultImage" resultMap="ProductDefaultImage">
<![CDATA[
SELECT
`t`.`product_id` AS `product_id`,
`t`.`image_url` AS `default_images`
FROM
`goods_images` `t`
WHERE
(`t`.`is_default` = 'Y')
AND product_id in]]>
<foreach item="item" index="index" collection="list"
open="(" separator="," close=")">
#{item}
</foreach>
GROUP BY
`t`.`product_id`
</select>
</mapper>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yoho.search.dal.ProductSearchBrandMapper">
<resultMap id="ProductSearchBrand" type="com.yoho.search.dal.model.ProductSearchBrand">
<id column="id" property="id" jdbcType="INTEGER"/>
<result column="product_skn" property="productSkn" jdbcType="INTEGER"/>
<result column="brand_weight_id" property="brandWeightId" jdbcType="INTEGER"/>
</resultMap>
<select id="getProductSearchBrand" resultMap="ProductSearchBrand">
<![CDATA[
SELECT
`product_search`.`product_skn` AS `product_skn`,
max(`product_search`.`id`) AS `brand_weight_id`
FROM
`product_search`
WHERE
(
(
`product_search`.`model_id` = 1
)
AND (
`product_search`.`project_id` = 1
)
)AND
product_skn
in]]>
<foreach item="item" index="index" collection="list"
open="(" separator="," close=")">
#{item}
</foreach>
GROUP BY
`product_search`.`product_skn`
</select>
</mapper>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yoho.search.dal.ProductSearchShopMapper">
<resultMap id="ProductSearchShop" type="com.yoho.search.dal.model.ProductSearchShop">
<id column="id" property="id" jdbcType="INTEGER" />
<result column="product_skn" property="productSkn" jdbcType="INTEGER" />
<result column="shop_weight_id" property="shopWeightId" jdbcType="INTEGER" />
</resultMap>
<select id="getProductSearchShop" resultMap="ProductSearchShop">
<![CDATA[
SELECT
`product_search`.`product_skn` AS `product_skn`,
max(`product_search`.`id`) AS `shop_weight_id`
FROM
`product_search`
WHERE
(
(
`product_search`.`model_id` = 1
)
AND (
`product_search`.`project_id` = 5
)
)AND
product_skn
in]]>
<foreach item="item" index="index" collection="list"
open="(" separator="," close=")">
#{item}
</foreach>
GROUP BY
`product_search`.`product_skn`
</select>
</mapper>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yoho.search.dal.ProductSearchSortMapper">
<resultMap id="ProductSearchSort" type="com.yoho.search.dal.model.ProductSearchSort">
<result column="product_skn" property="productSkn" jdbcType="INTEGER"/>
<result column="sort_weight_id" property="sortWeightId" jdbcType="INTEGER"/>
</resultMap>
<select id="getProductSearchSort" resultMap="ProductSearchSort">
<![CDATA[
SELECT
`product_search`.`product_skn` AS `product_skn`,
max(`product_search`.`id`) AS `sort_weight_id`
FROM
`product_search`
WHERE
`product_search`.`model_id` = 1
AND
`product_search`.`project_id` = 4
AND
product_skn
in]]>
<foreach item="item" index="index" collection="list"
open="(" separator="," close=")">
#{item}
</foreach>
GROUP BY
`product_search`.`product_skn`
</select>
</mapper>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yoho.search.dal.ProductSizesMapper">
<resultMap id="ProductSizes" type="com.yoho.search.dal.model.ProductSizes">
<result column="product_id" property="productId" jdbcType="INTEGER"/>
<result column="size_ids" property="sizeIds" jdbcType="VARCHAR"/>
<result column="sales_num" property="salesNum" jdbcType="INTEGER"/>
<result column="storage_num" property="storageNum" jdbcType="INTEGER"/>
</resultMap>
<select id="getProductSizes" resultMap="ProductSizes"
parameterType="java.lang.Integer" timeout="20000">
<![CDATA[
SELECT
`t`.`product_id` AS `product_id`,
group_concat(
DISTINCT `t`.`goods_dimension_id` SEPARATOR ','
) AS `size_ids`,
sum(`t`.`storage_num`) AS `storage_num`
FROM
`storage` `t`
WHERE
`t`.`erp_sku_id` in]]>
<foreach item="item" index="index" collection="list"
open="(" separator="," close=")">
#{item}
</foreach>
GROUP BY
`t`.`product_id`
</select>
</mapper>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yoho.search.dal.ProductStyleMapper">
<resultMap id="ProductStyles" type="com.yoho.search.dal.model.ProductStyles">
<result column="product_id" property="productId" jdbcType="INTEGER" />
<result column="style_ids" property="styleIds" jdbcType="VARCHAR" />
</resultMap>
<select id="selectProductStyles" resultMap="ProductStyles">
<![CDATA[
SELECT
`a`.`product_id` AS `product_id`,
group_concat(`a`.`style_id` SEPARATOR ',') AS `style_ids`
FROM
`product_style_relation` `a`
GROUP BY
`a`.`product_id`]]>
</select>
</mapper>
\ No newline at end of file
... ...
package com.yoho.search.consumer.service.logic;
import com.yoho.search.dal.ActivityProductMapper;
import com.yoho.search.consumer.service.bo.ProductActivitiesBO;
import com.yoho.search.dal.ProductActivityMapper;
import com.yoho.search.dal.model.ProductActivity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
... ... @@ -18,17 +18,17 @@ import java.util.Map;
public class ProductActivitiesLogicService {
@Autowired
private ActivityProductMapper activityProductMapper;
private ProductActivityMapper productActivityMapper;
public List<ProductActivitiesBO> getData(List<Integer> skns) {
//构建ProductActivity 视图
List<ProductActivity> productActivities = activityProductMapper.getProductActivity(skns);
List<ProductActivity> productActivities = productActivityMapper.getProductActivity(skns);
//构建ProductActivities视图
//group by product_skn
Map<Integer, String> productActivitiesMap = new HashMap<>();
for (ProductActivity p : productActivities) {
if (productActivitiesMap.containsKey(p.getProductSkn())) {
productActivitiesMap.put(p.getProductSkn(), productActivitiesMap.get(p.getProductSkn()) +","+ p.getActivity());
productActivitiesMap.put(p.getProductSkn(), productActivitiesMap.get(p.getProductSkn()) + "," + p.getActivity());
} else {
productActivitiesMap.put(p.getProductSkn(), p.getActivity());
}
... ...
... ... @@ -4,10 +4,13 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yoho.search.consumer.service.bo.ProductGoodBO;
import com.yoho.search.consumer.service.bo.ProductGoodsBO;
import com.yoho.search.dal.GoodsCoverImageMapper;
import com.yoho.search.dal.GoodsImagesMapper;
import com.yoho.search.dal.GoodsMapper;
import com.yoho.search.dal.ProductColorMapper;
import com.yoho.search.dal.model.*;
import com.yoho.search.dal.model.Goods;
import com.yoho.search.dal.model.GoodsCoverImage;
import com.yoho.search.dal.model.ProductColor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
... ... @@ -31,6 +34,8 @@ public class ProductGoodsLogicService {
private ProductColorMapper productColorMapper;
@Autowired
private GoodsImagesMapper goodsImagesMapper;
@Autowired
private GoodsCoverImageMapper goodsCoverImageMapper;
/**
* @return
... ... @@ -50,7 +55,7 @@ public class ProductGoodsLogicService {
List<Integer> goodsIds = goodsMapper.getIdByProductIds(productIds);
List<GoodsCoverImage> goodsCoverImages = new ArrayList<GoodsCoverImage>();
if (goodsIds != null && !goodsIds.isEmpty()) {
goodsCoverImages = goodsImagesMapper.selectGoodsCoverImage(goodsIds);
goodsCoverImages = goodsCoverImageMapper.selectGoodsCoverImage(goodsIds);
}
Map<Integer, GoodsCoverImage> goodsCoverImagesMap = new HashMap<>();
... ...
... ... @@ -7,7 +7,6 @@ import com.yoho.search.consumer.service.base.ProductActivitiesLinkService;
import com.yoho.search.consumer.service.bo.*;
import com.yoho.search.dal.*;
import com.yoho.search.dal.model.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -34,9 +33,9 @@ public class ProductIndexLogicService {
@Autowired
private ProductStyleRelationMapper productStyleRelationMapper;
@Autowired
private FreeSizeProductMapper freeSizeProductMapper;
private BasePinRatioMapper basePinRatioMapper;
@Autowired
private NonfreeSizeProductMapper nonfreeSizeProductMapper;
private BrokenCodeProductMapper brokenCodeProductMapper;
@Autowired
private ProductILogicService productILogicService;
@Autowired
... ... @@ -56,7 +55,7 @@ public class ProductIndexLogicService {
@Autowired
private ProductActivitiesLinkService productActivitiesLinkService;
@Autowired
private DiscountProductMapper discountProductMapper;
private DiscountProductSknMapper discountProductSknMapper;
@Autowired
private GoodsImagesMapper goodsImagesMapper;
@Autowired
... ... @@ -77,6 +76,12 @@ public class ProductIndexLogicService {
private Product15DaySalesNumService product15DaySalesNumService;
@Autowired
private ProductPoolLogicService productPoolLogicService;
@Autowired
private ProductColorsMapper productColorsMapper;
@Autowired
private ProductDefaultImageMapper productDefaultImageMapper;
@Autowired
private ProductStyleMapper productStyleMapper;
/**
* 获取ProductIndex列表,用于取代视图。
... ... @@ -788,7 +793,7 @@ public class ProductIndexLogicService {
* @return
*/
public Map<Integer, ProductColors> getProductColorsesMap(List<Integer> ids) {
List<ProductColors> productColorses = goodsMapper.getProductColors(ids);
List<ProductColors> productColorses = productColorsMapper.getProductColors(ids);
return productColorses.stream().parallel().collect(Collectors.toMap(ProductColors::getProductId, (p) -> p));
}
... ... @@ -821,7 +826,7 @@ public class ProductIndexLogicService {
* @return
*/
private Map<Integer, ProductStyles> getProductStylesMap(List<Integer> ids) {
List<ProductStyles> productStyles = productStyleRelationMapper.selectProductStyles();
List<ProductStyles> productStyles = productStyleMapper.selectProductStyles();
return productStyles.stream().parallel().collect(Collectors.toMap(ProductStyles::getProductId, (p) -> p));
}
... ... @@ -843,7 +848,7 @@ public class ProductIndexLogicService {
* @return
*/
private Map<Integer, ProductDefaultImage> getProductDefaultImagesMap(List<Integer> ids) {
List<ProductDefaultImage> productDefaultImages = goodsImagesMapper.selectProductDefaultImage(ids);
List<ProductDefaultImage> productDefaultImages = productDefaultImageMapper.selectProductDefaultImage(ids);
return productDefaultImages.stream().parallel().collect(Collectors.toMap(ProductDefaultImage::getProductId, (p) -> p));
}
... ... @@ -899,7 +904,7 @@ public class ProductIndexLogicService {
*/
private Map<Integer, BasePinRatio> getBasePinRatiosMap(List<Integer> skns) {
List<BasePinRatio> basePinRatios = freeSizeProductMapper.getBasePinRatio(skns);
List<BasePinRatio> basePinRatios = basePinRatioMapper.getBasePinRatio(skns);
return basePinRatios.stream().parallel().collect(Collectors.toMap(BasePinRatio::getProductSkn, (p) -> p));
}
... ... @@ -911,7 +916,7 @@ public class ProductIndexLogicService {
*/
private Map<Integer, BrokenCode> getBrokenCodesMap(List<Integer> skns) {
List<BrokenCode> brokenCodes = nonfreeSizeProductMapper.getBrokenCode(skns);
List<BrokenCode> brokenCodes = brokenCodeProductMapper.getBrokenCode(skns);
return brokenCodes.stream().parallel().collect(Collectors.toMap(BrokenCode::getProductSkn, (p) -> p));
}
... ... @@ -922,7 +927,7 @@ public class ProductIndexLogicService {
* @return
*/
private Map<Integer, DiscountProductSkn> getDiscountProductSknsMap(List<Integer> skns) {
List<DiscountProductSkn> discountProductSkns = discountProductMapper.getDiscountProductSkn(skns);
List<DiscountProductSkn> discountProductSkns = discountProductSknMapper.getDiscountProductSkn(skns);
return discountProductSkns.stream().parallel().collect(Collectors.toMap(DiscountProductSkn::getProductSkn, (p) -> p));
}
... ...
package com.yoho.search.consumer.service.logic;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.yoho.search.consumer.service.bo.ProductSearchBrandWeightBO;
import com.yoho.search.dal.ProductSearchBrandMapper;
import com.yoho.search.dal.ProductSearchMapper;
import com.yoho.search.dal.model.ProductSearch;
import com.yoho.search.dal.model.ProductSearchBrand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.yoho.search.dal.ProductSearchMapper;
import com.yoho.search.dal.model.ProductSearch;
import com.yoho.search.consumer.service.bo.ProductSearchBrandWeightBO;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* Created by wangnan on 2016/6/30.
... ... @@ -23,9 +23,12 @@ public class ProductSearchBrandWeightLogicService {
@Autowired
private ProductSearchMapper productSearchMapper;
@Autowired
private ProductSearchBrandMapper productSearchBrandMapper;
public List<ProductSearchBrandWeightBO> getData(List<Integer> skns) {
//构建ProductSearchBrand 视图
List<ProductSearchBrand> productSearchBrands = productSearchMapper.getProductSearchBrand(skns);
List<ProductSearchBrand> productSearchBrands = productSearchBrandMapper.getProductSearchBrand(skns);
//构建ProductSearchBrandWeight 视图
//获取ProductSearch数据
... ...
package com.yoho.search.consumer.service.logic;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.yoho.search.consumer.service.bo.ProductSearchShopWeightBO;
import com.yoho.search.dal.ProductSearchMapper;
import com.yoho.search.dal.ProductSearchShopMapper;
import com.yoho.search.dal.model.ProductSearch;
import com.yoho.search.dal.model.ProductSearchShop;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.yoho.search.dal.ProductSearchMapper;
import com.yoho.search.dal.model.ProductSearch;
import com.yoho.search.consumer.service.bo.ProductSearchShopWeightBO;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Component
public class ProductSearchShopWeightLogicService {
... ... @@ -19,9 +19,12 @@ public class ProductSearchShopWeightLogicService {
@Autowired
private ProductSearchMapper productSearchMapper;
@Autowired
private ProductSearchShopMapper productSearchShopMapper;
public List<ProductSearchShopWeightBO> getData(List<Integer> skns) {
//构建ProductSearchBrand 视图
List<ProductSearchShop> productSearchBrands = productSearchMapper.getProductSearchShop(skns);
List<ProductSearchShop> productSearchBrands = productSearchShopMapper.getProductSearchShop(skns);
//构建ProductSearchBrandWeight 视图
//获取ProductSearch数据
... ...
package com.yoho.search.consumer.service.logic;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.yoho.search.consumer.service.bo.ProductSearchSortWeightBO;
import com.yoho.search.dal.ProductSearchMapper;
import com.yoho.search.dal.ProductSearchSortMapper;
import com.yoho.search.dal.model.ProductSearch;
import com.yoho.search.dal.model.ProductSearchSort;
import com.yoho.search.consumer.service.bo.ProductSearchSortWeightBO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* Created by wangnan on 2016/6/30.
*/
... ... @@ -21,9 +22,12 @@ public class ProductSearchSortWeightLogicService {
@Autowired
private ProductSearchMapper productSearchMapper;
@Autowired
private ProductSearchSortMapper productSearchSortMapper;
public List<ProductSearchSortWeightBO> getData(List<Integer> skns) {
// 构建ProductSearchSort 视图
List<ProductSearchSort> productSearchSorts = productSearchMapper.getProductSearchSort(skns);
List<ProductSearchSort> productSearchSorts = productSearchSortMapper.getProductSearchSort(skns);
// 构建ProductSearchSortWeight 视图
// 获取ProductSearch数据
... ...
package com.yoho.search.consumer.service.logic;
import com.yoho.search.dal.GoodsMapper;
import com.yoho.search.dal.ProductSizesMapper;
import com.yoho.search.dal.SizeMapper;
import com.yoho.search.dal.StorageMapper;
import com.yoho.search.dal.model.Goods;
... ... @@ -31,6 +32,9 @@ public class ProductSizesLogicService {
@Autowired
private SizeMapper sizeMapper;
@Autowired
private ProductSizesMapper productSizesMapper;
/**
* 获取ProductSizes列表
* @return
... ... @@ -60,7 +64,7 @@ public class ProductSizesLogicService {
return new ArrayList<ProductSizes>();
}
List<ProductSizes> productSizess = storageMapper.getProductSizes(ids_);
List<ProductSizes> productSizess = productSizesMapper.getProductSizes(ids_);
if (CollectionUtils.isNotEmpty(productSizess)) {
List<Integer> sizeIds = new ArrayList<>();
for (ProductSizes ps : productSizess) {
... ...
... ... @@ -7,6 +7,7 @@ import java.util.Map;
import java.util.stream.Collectors;
import com.yoho.search.consumer.service.bo.StorageSkuBO;
import com.yoho.search.dal.*;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
... ... @@ -14,11 +15,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.yoho.search.consumer.service.base.Product15DaySalesNumService;
import com.yoho.search.dal.FreeSizeProductMapper;
import com.yoho.search.dal.GoodsMapper;
import com.yoho.search.dal.NonfreeSizeProductMapper;
import com.yoho.search.dal.ProductMapper;
import com.yoho.search.dal.StorageMapper;
import com.yoho.search.dal.model.BasePinRatio;
import com.yoho.search.dal.model.BrokenCode;
import com.yoho.search.dal.model.Goods;
... ... @@ -51,9 +47,11 @@ public class StorageSkuLogicService {
@Autowired
private Product15DaySalesNumService product15DaySalesNumService;
@Autowired
private FreeSizeProductMapper freeSizeProductMapper;
private BasePinRatioMapper basePinRatioMapper;
@Autowired
private NonfreeSizeProductMapper nonfreeSizeProductMapper;
private BrokenCodeProductMapper brokenCodeProductMapper;
@Autowired
private ProductColorsMapper productColorsMapper;
public List<StorageSkuBO> getStorageSkuIndex(int offset, int limit) {
logger.info("===========构建StorageSkuIndex开始==========");
... ... @@ -141,7 +139,7 @@ public class StorageSkuLogicService {
if(productSkns==null || productSkns.isEmpty()){
return new HashMap<Integer, BrokenCode>();
}
List<BrokenCode> brokenCodes = nonfreeSizeProductMapper.getBrokenCode(productSkns);
List<BrokenCode> brokenCodes = brokenCodeProductMapper.getBrokenCode(productSkns);
Map<Integer, BrokenCode> brokenCodesMap = brokenCodes.stream().parallel().collect(Collectors.toMap(BrokenCode::getProductSkn, (p) -> p));
return brokenCodesMap;
}
... ... @@ -158,7 +156,7 @@ public class StorageSkuLogicService {
if(productSkns==null || productSkns.isEmpty()){
return new HashMap<Integer, BasePinRatio>();
}
List<BasePinRatio> basePinRatios = freeSizeProductMapper.getBasePinRatio(productSkns);
List<BasePinRatio> basePinRatios = basePinRatioMapper.getBasePinRatio(productSkns);
Map<Integer, BasePinRatio> basePinRatioMap = basePinRatios.stream().parallel().collect(Collectors.toMap(BasePinRatio::getProductSkn, (p) -> p));
return basePinRatioMap;
}
... ... @@ -210,7 +208,7 @@ public class StorageSkuLogicService {
if(productIds==null || productIds.isEmpty()){
return new HashMap<Integer, ProductColors>();
}
List<ProductColors> productColorses = goodsMapper.getProductColors(productIds);
List<ProductColors> productColorses = productColorsMapper.getProductColors(productIds);
Map<Integer, ProductColors> productColorsMap = productColorses.stream().parallel().collect(Collectors.toMap(ProductColors::getProductId, (p) -> p));
return productColorsMap;
}
... ...