Browse Source

fix: 修复不包含的商品查询

v1.0
Yen 1 year ago
parent
commit
41aa579a9b
  1. 6
      src/main/java/com/qs/serve/modules/bir/service/impl/BirCenterRateServiceImpl.java
  2. 7
      src/main/java/com/qs/serve/modules/goods/controller/GoodsSpuController.java
  3. 6
      src/main/java/com/qs/serve/modules/goods/entity/GoodsSpu.java
  4. 14
      src/main/resources/mapper/goods/GoodsSpuMapper.xml

6
src/main/java/com/qs/serve/modules/bir/service/impl/BirCenterRateServiceImpl.java

@ -245,7 +245,11 @@ public class BirCenterRateServiceImpl implements BirCenterRateService {
costApplyRateVo.setAllCostAmt(allUsedCost);
if(dispatchSumAllsAmt!=null&&dispatchSumAllsAmt.compareTo(BigDecimal.ZERO)!=0){
costApplyRateVo.setAllByRate(costApplyRateVo.getAllCostAmt().divide(costApplyRateVo.getAllDisAmt(),2,RoundingMode.DOWN));
if(costApplyRateVo.getAllCostAmt()!=null){
costApplyRateVo.setAllByRate(costApplyRateVo.getAllCostAmt().divide(costApplyRateVo.getAllDisAmt(),2,RoundingMode.DOWN));
}else {
costApplyRateVo.setAllByRate(BigDecimal.ZERO);
}
}
costApplyRateVoList.add(costApplyRateVo);

7
src/main/java/com/qs/serve/modules/goods/controller/GoodsSpuController.java

@ -37,6 +37,7 @@ import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.stream.Collectors;
@ -57,6 +58,7 @@ public class GoodsSpuController {
private GoodsSpuService goodsSpuService;
private GoodsSpuSpecService goodsSpuSpecService;
private GoodsSkuSpecValueService goodsSkuSpecValueService;
private GoodsCategoryRuleService goodsCategoryRuleService;
private TbsActivityGoodsService activityGoodsService;
private TbsBudgetConditionService budgetConditionService;
private GoodsCategoryService goodsCategoryService;
@ -116,6 +118,11 @@ public class GoodsSpuController {
*/
@GetMapping("/getSkuJoinSpuList")
public R<PageVo<GoodsSpu>> getSkuJoinSpuList(GoodsSpu param){
GoodsCategoryRule categoryRule = goodsCategoryRuleService.getById(param.getSearchCateRuleId());
if(categoryRule!=null&&categoryRule.getIgnoreBrandIds()!=null&&categoryRule.getIgnoreBrandIds().length>0){
param.setSelectNotIntCateIds(Arrays.asList(categoryRule.getIgnoreBrandIds()));
log.warn("setSelectNotIntCateIds {}",JsonUtil.objectToJson(param));
}
Long total = goodsSpuService.selectCountSkuJoinSpuList(param);
if(total<1){
return R.byEmptyList();

6
src/main/java/com/qs/serve/modules/goods/entity/GoodsSpu.java

@ -152,6 +152,9 @@ public class GoodsSpu implements Serializable {
@TableField(exist = false)
private List<Long> selectCateIds;
@TableField(exist = false)
private List<String> selectNotIntCateIds;
@TableField(exist = false)
private Integer selectSpecialFlag;
@ -196,6 +199,9 @@ public class GoodsSpu implements Serializable {
@TableField(exist = false)
private Integer skuSpecialFlag;
@TableField(exist = false)
private String searchCateRuleId;
public void toSetSkuInfo(GoodsSku goodsSku){
this.setSkuId(goodsSku.getId());
this.setSkuName(goodsSku.getSkuName());

14
src/main/resources/mapper/goods/GoodsSpuMapper.xml

@ -140,6 +140,20 @@
#{selectId}
</foreach>)
</if>
<if test="query.selectNotIntCateIds!=null and query.selectNotIntCateIds.size > 0">
and (`goods_spu`.`category_first` not in
<foreach collection="query.selectNotIntCateIds" item="selectId" index="i" open="(" close=")" separator=",">
#{selectId}
</foreach>
and `goods_spu`.`category_second` not in
<foreach collection="query.selectNotIntCateIds" item="selectId" index="i" open="(" close=")" separator=",">
#{selectId}
</foreach>
and `goods_spu`.`category_third` not in
<foreach collection="query.selectNotIntCateIds" item="selectId" index="i" open="(" close=")" separator=",">
#{selectId}
</foreach>)
</if>
</sql>
<select id="selectSpuList" parameterType="com.qs.serve.modules.goods.entity.GoodsSpu" resultMap="goodsSpuMap">

Loading…
Cancel
Save