小程序主页接口修改

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

View File

@ -1,5 +1,6 @@
package com.czg.product.vo; package com.czg.product.vo;
import com.mybatisflex.annotation.Column;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -61,5 +62,6 @@ public class RecommendProVO {
* 折扣 * 折扣
*/ */
private float discount; private float discount;
@Column(ignore = true)
private Long endTime = 1741391999999L; 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); 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); 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()); homeUpVO.setFreeBannerList(bannerVoRandom());
// 销量榜 // 销量榜
List<Product> productList = productMapper.selectCouponProBySaleNum(); List<RecommendProVO> productList = productMapper.selectCouponProBySaleNum();
HotRankingVO hotRankingVO = new HotRankingVO(); HotRankingVO hotRankingVO = new HotRankingVO();
hotRankingVO.setHotList(productList); hotRankingVO.setHotList(productList);
homeUpVO.setHotRanking(hotRankingVO); homeUpVO.setHotRanking(hotRankingVO);

View File

@ -152,13 +152,15 @@
</where> </where>
</select> </select>
<select id="selectCouponProBySaleNum" resultType="com.czg.product.entity.Product"> <select id="selectCouponProBySaleNum" resultType="com.czg.product.vo.RecommendProVO">
SELECT a.* 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 FROM tb_product AS a
LEFT JOIN tb_prod_sku AS b ON a.id = b.product_id LEFT JOIN tb_prod_sku AS b ON a.id = b.product_id
WHERE a.type = 'coupon' WHERE a.type = 'coupon'
ORDER BY b.real_sales_number ORDER BY b.real_sales_number
LIMIT 2 LIMIT 2
</select> </select>
<select id="selectRecommendProductList" resultType="com.czg.product.vo.RecommendProVO"> <select id="selectRecommendProductList" resultType="com.czg.product.vo.RecommendProVO">
select ROUND( select ROUND(