Explorar o código

fix 店铺插入最新规格;过滤未配置比例的平台规格

zoujiajian %!s(int64=2) %!d(string=hai) anos
pai
achega
0be0b1f1e1

+ 4 - 4
netflix-dao/src/main/java/com/cyksj/model/views/YhShopGoodsView.java

@@ -17,7 +17,7 @@ import java.util.List;
 @SearchBean(tables = "yh_shop_goods_sku ysgs left join goods_don g on g.id = ysgs.goods_id" +
         " left join goods_don_sku sku on sku.id = ysgs.sku_id",
         where = "ysgs.deleted is true and g.status is true and g.deleted is true and sku.status is true and g.is_distribute is true"
-        , groupBy = "g.id,g.title,g.category,ysgs.status,ysgs.user_id,ysgs.created_time,ysgs.update_time")
+        , groupBy = "g.id,g.title,g.category,ysgs.status,ysgs.user_id")
 public class YhShopGoodsView {
     @DbField("g.id")
     private Long goodsId;
@@ -37,17 +37,17 @@ public class YhShopGoodsView {
     @DbField("group_concat(sku.spec_val,cast((ysgs.price/100) as decimal(10,2)),'元')")
     private String skuDetail;
 
-    @DbField("ysgs.created_time")
+    @DbField("any_value(ysgs.created_time)")
     private Date createdTime;
 
-    @DbField("ysgs.update_time")
+    @DbField("any_value(ysgs.update_time)")
     private Date updateTime;
 
     @DbIgnore
     private List<YhShopGoodsSkuView> list;
 
     @Data
-    @SearchBean(tables = "goods_don_sku gs left join yh_shop_goods_rate ysgr on gs.id = ysgr.sku_id left join yh_shop_goods_sku ysgs on gs.id = ysgs.sku_id and ysgs.deleted is true :uid:",
+    @SearchBean(tables = "goods_don_sku gs inner join yh_shop_goods_rate ysgr on gs.id = ysgr.sku_id left join yh_shop_goods_sku ysgs on gs.id = ysgs.sku_id and ysgs.deleted is true :uid:",
             where = "gs.status = true",
             orderBy = "gs.months")
     public static class YhShopGoodsSkuView{

+ 3 - 2
netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/shop/YhShopGoodsController.java

@@ -60,15 +60,16 @@ public class YhShopGoodsController {
 	@PutMapping("/put")
 	public Result<Void> updShopGoodsRate(@RequestBody List<YhShopGoodsSku> goodsSkus){
 		long userId = StpYhShopManageUser.getLoginIdAsLong();
+		YhShop yhShop = yhShopMapper.selectOne(Wrappers.lambdaQuery(YhShop.class)
+				.eq(YhShop::getUserId, userId).last("limit 1"));
 		goodsSkus.forEach(sku -> {
 			YhShopGoodsRateView.YhShopGoodsSkuRateView yhShopGoodsSkuRateView = beanSearcher.searchFirst(YhShopGoodsRateView.YhShopGoodsSkuRateView.class, MapUtils.builder().field(YhShopGoodsRateView.YhShopGoodsSkuRateView::getSkuId,sku.getSkuId()).build());
 			if (sku.getPrice().compareTo(yhShopGoodsSkuRateView.getMaxPrice()) > 0 || sku.getPrice().compareTo(yhShopGoodsSkuRateView.getMinPrice()) < 0){
 				throw BusinessRuntimeException.getInstance("价格不能超出区间范围");
 			}
 			sku.setUserId(userId);
+			sku.setYhsId(yhShop.getId());
 		});
-		YhShop yhShop = yhShopMapper.selectOne(Wrappers.lambdaQuery(YhShop.class)
-				.eq(YhShop::getUserId, userId).last("limit 1"));
 		String yhShopCacheKey = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "yhShop:" + yhShop.getId();
 		redisService.del(yhShopCacheKey);
 		yhShopGoodsSkuService.saveOrUpdateBatch(goodsSkus);