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