小程序主页接口修改

This commit is contained in:
张松 2025-03-10 17:45:17 +08:00
parent 9893d5ecb0
commit 643cbccae9
5 changed files with 10 additions and 5 deletions

View File

@ -1,6 +1,7 @@
package com.czg.account.vo.home;
import com.czg.product.entity.Product;
import com.czg.product.vo.RecommendProVO;
import lombok.Data;
import java.util.List;
@ -15,6 +16,6 @@ public class HotRankingVO {
*/
private String name = "飙升热榜";
private String date = "8点更新";
List<Product> hotList;
List<RecommendProVO> hotList;
}

View File

@ -1,5 +1,6 @@
package com.czg.product.vo;
import com.mybatisflex.annotation.Column;
import lombok.Data;
import java.math.BigDecimal;
@ -61,5 +62,6 @@ public class RecommendProVO {
* 折扣
*/
private float discount;
@Column(ignore = true)
private Long endTime = 1741391999999L;
}

View File

@ -35,7 +35,7 @@ public interface ProductMapper extends BaseMapper<Product> {
ShopProductInfoVo selectOneProductInfo(@Param("id") Long id, @Param("shopId") Long shopId);
List<Product> selectCouponProBySaleNum();
List<RecommendProVO> selectCouponProBySaleNum();
void updateProductStockNum(@Param("id") Long id, @Param("shopId") Long shopId, @Param("type") String type, @Param("num") BigDecimal num);

View File

@ -88,7 +88,7 @@ public class HomePageServiceImpl implements HomePageService {
homeUpVO.setFreeBannerList(bannerVoRandom());
// 销量榜
List<Product> productList = productMapper.selectCouponProBySaleNum();
List<RecommendProVO> productList = productMapper.selectCouponProBySaleNum();
HotRankingVO hotRankingVO = new HotRankingVO();
hotRankingVO.setHotList(productList);
homeUpVO.setHotRanking(hotRankingVO);

View File

@ -152,13 +152,15 @@
</where>
</select>
<select id="selectCouponProBySaleNum" resultType="com.czg.product.entity.Product">
SELECT a.*
<select id="selectCouponProBySaleNum" resultType="com.czg.product.vo.RecommendProVO">
SELECT a.name, b.origin_price, b.sale_price, a.cover_img, a.id,
b.real_sales_number saleNum, round(b.sale_price / b.origin_price, 2) discount
FROM tb_product AS a
LEFT JOIN tb_prod_sku AS b ON a.id = b.product_id
WHERE a.type = 'coupon'
ORDER BY b.real_sales_number
LIMIT 2
</select>
<select id="selectRecommendProductList" resultType="com.czg.product.vo.RecommendProVO">
select ROUND(