复读列表按365天价格排序取第一个

This commit is contained in:
wuchunlei
2025-04-22 13:47:15 +08:00
parent 5bc1200388
commit bf1dd7dbb9

View File

@@ -108,10 +108,10 @@ public class CourseRelearnController {
wrapper.selectAll(ShopProduct.class); wrapper.selectAll(ShopProduct.class);
wrapper.eq(ShopProductCourseEntity::getCatalogueId,params.get("catalogueId")); wrapper.eq(ShopProductCourseEntity::getCatalogueId,params.get("catalogueId"));
wrapper.eq(ShopProductCourseEntity::getDays,365); wrapper.eq(ShopProductCourseEntity::getDays,365);
ShopProduct shopProduct = shopProductService.getOne(wrapper); wrapper.orderByAsc(ShopProduct::getPrice);
if (shopProduct == null) { List<ShopProduct> shopProducts = shopProductService.list(wrapper);
return R.error("未找到一年期商品"); if (shopProducts.size()>0) {
}else { ShopProduct shopProduct = shopProducts.get(0);
ShopProduct sp1 = new ShopProduct(); ShopProduct sp1 = new ShopProduct();
sp1.setProductId(shopProduct.getProductId()); sp1.setProductId(shopProduct.getProductId());
sp1.setProductName(shopProduct.getProductName().replace("一年","一月")); sp1.setProductName(shopProduct.getProductName().replace("一年","一月"));
@@ -132,6 +132,8 @@ public class CourseRelearnController {
res.add(sp1); res.add(sp1);
res.add(sp2); res.add(sp2);
return R.ok().put("productList",res); return R.ok().put("productList",res);
}else {
return R.error("未找到一年期商品");
} }
} }