|
|
@@ -4,17 +4,20 @@ import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.cyksj.common.annotation.Log;
|
|
|
import com.cyksj.common.exception.BusinessRuntimeException;
|
|
|
import com.cyksj.common.util.Jsons;
|
|
|
import com.cyksj.dto.Result;
|
|
|
import com.cyksj.enums.BusinessType;
|
|
|
import com.cyksj.enums.GatewayResponse;
|
|
|
+import com.cyksj.mapper.GoodsDonSkuMapper;
|
|
|
import com.cyksj.model.entity.GoodsDon;
|
|
|
import com.cyksj.model.entity.GoodsDonCategory;
|
|
|
import com.cyksj.model.entity.GoodsDonSku;
|
|
|
import com.cyksj.model.manage.request.ReqGoodsSpuInsert;
|
|
|
import com.cyksj.model.manage.views.GoodsDonViewer;
|
|
|
+import com.cyksj.model.views.GoodsDetailView;
|
|
|
import com.cyksj.model.views.GoodsDonCategoryDetailView;
|
|
|
import com.cyksj.service.mange.CmsGoodsDonService;
|
|
|
import com.cyksj.service.mange.GoodsDonCategoryService;
|
|
|
@@ -56,6 +59,8 @@ public class CmsGoodsDonController {
|
|
|
|
|
|
private final GoodsDonCategoryService goodsDonCategoryService;
|
|
|
|
|
|
+ private final GoodsDonSkuMapper skuMapper;
|
|
|
+
|
|
|
@GetMapping("/get")
|
|
|
public Result<SearchResult<GoodsDonCategoryDetailView>> get(){
|
|
|
SearchResult<GoodsDonCategoryDetailView> search = beanSearcher.search(GoodsDonCategoryDetailView.class, MapUtils.flatBuilder(request.getParameterMap())
|
|
|
@@ -224,4 +229,36 @@ public class CmsGoodsDonController {
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(goodsDon);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取所有平台以及其规格
|
|
|
+ */
|
|
|
+ @GetMapping("/get/all/goods/sku")
|
|
|
+ public Result<List<GoodsDetailView>> getAllGoodsDetail(Boolean isNoBuyout) {
|
|
|
+ MapBuilder mapBuilder = MapUtils.flatBuilder(request.getParameterMap());
|
|
|
+ //过滤买断制 平台
|
|
|
+ String conditionSql;
|
|
|
+ if (isNoBuyout != null && isNoBuyout) {
|
|
|
+ mapBuilder.field(GoodsDon::getSpecialType).op(Operator.IsNull);
|
|
|
+ conditionSql = "(select count(*) from goods_don_sku sku where sku.goods_id = g.id and sku.months = 300) = 0";
|
|
|
+ } else {
|
|
|
+ conditionSql = "(special_type is null or special_type != 'giftCard')";
|
|
|
+ }
|
|
|
+ conditionSql += " and exists (select id from goods_don_sku sku where sku.goods_id = g.id limit 1)";
|
|
|
+
|
|
|
+ List<GoodsDetailView> goodsDons = beanSearcher.searchAll(GoodsDetailView.class, mapBuilder
|
|
|
+ .put("condition", conditionSql)
|
|
|
+ .field(GoodsDetailView::getType, 1)
|
|
|
+ .field(GoodsDetailView::getStatus, 1)
|
|
|
+ .field(GoodsDetailView::getDeleted, true)
|
|
|
+ .onlySelect(GoodsDetailView::getId, GoodsDetailView::getTitle)
|
|
|
+ .build());
|
|
|
+ goodsDons.forEach(e->{
|
|
|
+ List<GoodsDonSku> donSkus = skuMapper.selectList(Wrappers.lambdaQuery(GoodsDonSku.class)
|
|
|
+ .eq(GoodsDonSku::getGoodsId, e.getId())
|
|
|
+ .eq(GoodsDonSku::getStatus, 1).select(GoodsDonSku::getId, GoodsDonSku::getSpecVal));
|
|
|
+ e.setSkuList(donSkus);
|
|
|
+ });
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult(goodsDons);
|
|
|
+ }
|
|
|
+
|
|
|
}
|