Browse Source

商家端新增优惠商品选择添加商品搜索业务功能

multiwx
dy-hu 10 months ago
parent
commit
0fe49dfd8e
  1. 3
      cereshop-business/src/main/java/com/shop/cereshop/business/dao/tool/CereShopCouponDAO.java
  2. 6
      cereshop-business/src/main/java/com/shop/cereshop/business/page/tool/ToolProduct.java
  3. 2
      cereshop-business/src/main/java/com/shop/cereshop/business/param/tool/ToolProductNewParam.java
  4. 14
      cereshop-business/src/main/java/com/shop/cereshop/business/service/tool/impl/CereShopCouponServiceImpl.java
  5. 6
      cereshop-business/src/main/resources/mybatis/mapper/tool/CereShopCouponDAO.xml

3
cereshop-business/src/main/java/com/shop/cereshop/business/dao/tool/CereShopCouponDAO.java

@ -76,7 +76,8 @@ public interface CereShopCouponDAO extends BaseMapper<CereShopCoupon> {
List<ToolProduct> getProductsNew(@Param("businessId") Long businessId,
@Param("shopCouponId") Long shopCouponId,
@Param("queryType") Integer queryType);
@Param("queryType") Integer queryType,
@Param("searchContent") String searchContent);
List<CerePlatformShop> getShops(@Param("businessId") Long businessId);
}

6
cereshop-business/src/main/java/com/shop/cereshop/business/page/tool/ToolProduct.java

@ -22,6 +22,12 @@ public class ToolProduct {
private Long shopId;
/**
* 店铺名称
*/
@ApiModelProperty(value = "店铺名称")
private String shopName;
/**
* 商品id
*/
@ApiModelProperty(value = "商品id")

2
cereshop-business/src/main/java/com/shop/cereshop/business/param/tool/ToolProductNewParam.java

@ -37,5 +37,7 @@ public class ToolProductNewParam extends PageParam {
@ApiModelProperty(value = "查询类型")
private Integer queryType;
@ApiModelProperty(value = "商品查询内容")
private String searchContent;
}

14
cereshop-business/src/main/java/com/shop/cereshop/business/service/tool/impl/CereShopCouponServiceImpl.java

@ -417,7 +417,17 @@ public class CereShopCouponServiceImpl implements CereShopCouponService {
@Override
public Page getProducts(ToolProductNewParam param) throws CoBusinessException {
PageHelper.startPage(param.getPage(),param.getPageSize());
List<ToolProduct> list=cereShopCouponDAO.getProductsNew(param.getBusinessId(), param.getActivityId(), param.getQueryType());
List<ToolProduct> list=cereShopCouponDAO.getProductsNew(param.getBusinessId(), param.getActivityId(), param.getQueryType(), param.getSearchContent());
list.forEach(prod -> {
try {
CerePlatformShop platformShop = platformShopService.getById(prod.getShopId());
if (ObjectUtils.isNotEmpty(platformShop)){
prod.setShopName(platformShop.getShopName());
}
} catch (CoBusinessException e) {
e.printStackTrace();
}
});
PageInfo<ToolProduct> pageInfo=new PageInfo<>(list);
Page page=new Page(pageInfo.getList(),pageInfo.getTotal());
return page;
@ -556,7 +566,7 @@ public class CereShopCouponServiceImpl implements CereShopCouponService {
List<CerePlatformShop> list;
if (ObjectUtils.isNotEmpty(param.getActivityId())){
//查看店铺获取全部已设置优惠券的商品过滤商品的店铺id去获取店铺信息
List<ToolProduct> prodList = cereShopCouponDAO.getProductsNew(param.getBusinessId(), param.getActivityId(), param.getQueryType());
List<ToolProduct> prodList = cereShopCouponDAO.getProductsNew(param.getBusinessId(), param.getActivityId(), param.getQueryType(), null);
//去重获取店铺id
List<Long> shopIds = prodList.stream().map(ToolProduct::getShopId).distinct().collect(Collectors.toList());
list = platformShopService.getByIdList(shopIds);

6
cereshop-business/src/main/resources/mybatis/mapper/tool/CereShopCouponDAO.xml

@ -224,6 +224,12 @@
<if test="shopCouponId != null and queryType == 3">
and csce.shop_coupon_id = #{shopCouponId}
</if>
<if test="shopCouponId != null and queryType == 3">
and csce.shop_coupon_id = #{shopCouponId}
</if>
<if test="searchContent != null">
and a.product_name like concat('%',#{searchContent},'%')
</if>
</select>
<select id="findCouponName" parameterType="java.lang.Object" resultType="java.lang.String">

Loading…
Cancel
Save