zoujiajian il y a 2 ans
Parent
commit
ee12da27d8

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

@@ -32,11 +32,12 @@ public class YhShopGoodsView {
     private Long userId;
 
     @DbIgnore
-    private List<com.cyksj.model.views.YhShopGoodsView.YhShopGoodsSkuView> list;
+    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",
-            where = "gs.status = true ")
+    @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:",
+            where = "gs.status = true",
+            orderBy = "gs.months")
     public static class YhShopGoodsSkuView{
         @DbField("ysgs.id")
         private Long id;

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

@@ -8,7 +8,7 @@ import com.cyksj.model.entity.YhShopGoodsSku;
 import com.cyksj.model.views.YhShopGoodsRateView;
 import com.cyksj.model.views.YhShopGoodsView;
 import com.cyksj.service.shop.YhShopGoodsSkuService;
-import com.cyksj.web.util.StpUserUtil;
+import com.cyksj.web.util.StpYhShopManageUser;
 import com.ejlchina.searcher.BeanSearcher;
 import com.ejlchina.searcher.SearchResult;
 import com.ejlchina.searcher.util.MapUtils;
@@ -37,7 +37,7 @@ public class YhShopGoodsController {
 	 */
 	@PostMapping("/post")
 	public Result<Void> saveGoods(@RequestBody List<Long> goodsIds){
-		long userId = StpUserUtil.getLoginIdAsLong();
+		long userId = StpYhShopManageUser.getLoginIdAsLong();
 		yhShopGoodsSkuService.saveGoods(goodsIds, userId);
 		return GatewayResponse.SUCCESS.newBuilder().toResult();
 	}
@@ -62,8 +62,8 @@ public class YhShopGoodsController {
 	 */
 	@PutMapping("/put/goodsStatus/{goodsId}")
 	public Result<Void> updGoodsStatus(@PathVariable Long goodsId, Boolean status){
-		long userId = StpUserUtil.getLoginIdAsLong();
-		yhShopGoodsSkuService.update(Wrappers.lambdaUpdate(YhShopGoodsSku.class).eq(YhShopGoodsSku::getGoodsId, goodsId).eq(YhShopGoodsSku::getUserId, userId).set(YhShopGoodsSku::getStatus, status));
+		long userId = StpYhShopManageUser.getLoginIdAsLong();
+		yhShopGoodsSkuService.update(Wrappers.lambdaUpdate(YhShopGoodsSku.class).eq(YhShopGoodsSku::getGoodsId, goodsId).eq(YhShopGoodsSku::getDeleted, true).eq(YhShopGoodsSku::getUserId, userId).set(YhShopGoodsSku::getStatus, status));
 		return GatewayResponse.SUCCESS.newBuilder().toResult();
 	}
 
@@ -73,7 +73,7 @@ public class YhShopGoodsController {
 	 */
 	@PutMapping("/del/{goodsId}")
 	public Result<Void> updGoodsStatus(@PathVariable Long goodsId){
-		long userId = StpUserUtil.getLoginIdAsLong();
+		long userId = StpYhShopManageUser.getLoginIdAsLong();
 		yhShopGoodsSkuService.update(Wrappers.lambdaUpdate(YhShopGoodsSku.class).eq(YhShopGoodsSku::getGoodsId, goodsId).eq(YhShopGoodsSku::getUserId, userId).set(YhShopGoodsSku::getDeleted, false));
 		return GatewayResponse.SUCCESS.newBuilder().toResult();
 	}
@@ -83,8 +83,19 @@ public class YhShopGoodsController {
 	 */
 	@GetMapping("/get")
 	public Result<SearchResult<YhShopGoodsView>> goodsList(){
-		long userId = StpUserUtil.getLoginIdAsLong();
+		long userId = StpYhShopManageUser.getLoginIdAsLong();
 		SearchResult<YhShopGoodsView> search = beanSearcher.search(YhShopGoodsView.class, MapUtils.builder().field(YhShopGoodsView::getUserId, userId).build());
 		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
 	}
+
+	/**
+	 * 平台详情
+	 */
+	@GetMapping("/get/goods/detail/{goodsId}")
+	public Result<List<YhShopGoodsView.YhShopGoodsSkuView>> getGoodsDetail(@PathVariable Long goodsId) {
+		long userId = StpYhShopManageUser.getLoginIdAsLong();
+		List<YhShopGoodsView.YhShopGoodsSkuView> views = beanSearcher.searchAll(YhShopGoodsView.YhShopGoodsSkuView.class, MapUtils.builder().put("uid", String.format("and ysgs.user_id = %s", userId))
+				.field(YhShopGoodsView.YhShopGoodsSkuView::getGoodsId, goodsId).build());
+		return GatewayResponse.SUCCESS.newBuilder().toResult(views);
+	}
 }