diff --git a/zsw-bxg/src/main/java/co/yixiang/app/modules/hotList/rest/AppStoreHotListController.java b/zsw-bxg/src/main/java/co/yixiang/app/modules/hotList/rest/AppStoreHotListController.java index d9e318f3..6ea86d8d 100644 --- a/zsw-bxg/src/main/java/co/yixiang/app/modules/hotList/rest/AppStoreHotListController.java +++ b/zsw-bxg/src/main/java/co/yixiang/app/modules/hotList/rest/AppStoreHotListController.java @@ -13,6 +13,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RestController; import java.util.List; @@ -40,6 +41,18 @@ public class AppStoreHotListController { @GetMapping("/hotList") @ApiOperation(value = "热门榜单列表",notes = "热门榜单") public ApiResult> getYxStoreHotList(){ + return ApiResult.ok(yxStoreHotListService.getList()); } + + /** + * 热门榜单列表 + */ + @AnonymousAccess + @GetMapping("/hotList/{mouth}") + @ApiOperation(value = "根据年月查询热门榜单列表",notes = "热门榜单") + public ApiResult> getYxStoreHotList(@PathVariable String mouth){ + + return ApiResult.ok(yxStoreHotListService.getList(mouth)); + } } diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/hotList/domain/YxStoreHotList.java b/zsw-bxg/src/main/java/co/yixiang/modules/hotList/domain/YxStoreHotList.java index 9d350e5d..997abb8b 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/hotList/domain/YxStoreHotList.java +++ b/zsw-bxg/src/main/java/co/yixiang/modules/hotList/domain/YxStoreHotList.java @@ -18,6 +18,7 @@ import cn.hutool.core.bean.copier.CopyOptions; import javax.validation.constraints.*; import java.sql.Timestamp; import java.io.Serializable; +import java.util.ArrayList; import java.util.List; /** @@ -32,20 +33,22 @@ public class YxStoreHotList implements Serializable { @TableId private Integer id; - /** 榜单名称 */ @NotBlank private String listName; + /** 榜单展示图片 */ + private String listImage; + + /** 所属月份 */ + private String mouth; /** 排序 */ private Integer sort; - /** 商品列表 */ private String productList; - /** 是否显示 */ private Integer isShow; diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/hotList/service/YxStoreHotListService.java b/zsw-bxg/src/main/java/co/yixiang/modules/hotList/service/YxStoreHotListService.java index 8d084477..6e2acf75 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/hotList/service/YxStoreHotListService.java +++ b/zsw-bxg/src/main/java/co/yixiang/modules/hotList/service/YxStoreHotListService.java @@ -49,5 +49,11 @@ public interface YxStoreHotListService extends BaseService { */ void download(List all, HttpServletResponse response) throws IOException; + /** + * app根据月份获取列表 + * @param mouth 想要查的月份 + */ + List getList(String mouth); + List getList(); } diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/hotList/service/impl/YxStoreHotListServiceImpl.java b/zsw-bxg/src/main/java/co/yixiang/modules/hotList/service/impl/YxStoreHotListServiceImpl.java index 6aca1a34..96b71315 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/hotList/service/impl/YxStoreHotListServiceImpl.java +++ b/zsw-bxg/src/main/java/co/yixiang/modules/hotList/service/impl/YxStoreHotListServiceImpl.java @@ -64,9 +64,10 @@ public class YxStoreHotListServiceImpl extends BaseServiceImpl queryAll(YxStoreHotListQueryCriteria criteria, Pageable pageable) { getPage(pageable); PageInfo page = new PageInfo<>(queryAll(criteria)); - page.getList().forEach(hotList->{ - List productArr = JSONUtil.toList(hotList.getProductList(), Integer.class); - List list1 =new ArrayList<>(); + PageResult result=generator.convertPageInfo(page, YxStoreHotListVo.class); + result.getContent().forEach(hotListVo->{ + List productArr = JSONUtil.toList(hotListVo.getProductList(), Integer.class); + ArrayList list1 =new ArrayList<>(); productArr.forEach(productId->{ LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); wrapper.eq(YxStoreProduct::getIsShow, ShopCommonEnum.SHOW_1.getValue()) @@ -78,10 +79,9 @@ public class YxStoreHotListServiceImpl extends BaseServiceImpl getList(String mouth) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(YxStoreHotList::getIsShow, ShopCommonEnum.SHOW_1.getValue()) + .orderByAsc(YxStoreHotList::getSort) + .eq(YxStoreHotList::getMouth,mouth); + return getHotListDTOS(wrapper); + } + ; @Override public List getList() { LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); wrapper.eq(YxStoreHotList::getIsShow, ShopCommonEnum.SHOW_1.getValue()) .orderByAsc(YxStoreHotList::getSort); + return getHotListDTOS(wrapper); + } + + + private List getHotListDTOS(LambdaQueryWrapper wrapper) { List list = generator.convert(baseMapper.selectList(wrapper),HotListDTO.class); list.forEach(hotListDto->{ List productArr = JSONUtil.toList(hotListDto.getProductList(), Integer.class); @@ -134,5 +148,4 @@ public class YxStoreHotListServiceImpl extends BaseServiceImpl productInfoList; + + /** 榜单展示图片 */ + private String listImage; + + /** 所属月份 */ + private String mouth; + /** 是否显示 */ private Integer isShow; diff --git a/zsw-bxg/src/main/java/co/yixiang/utils/HotListDTO.java b/zsw-bxg/src/main/java/co/yixiang/utils/HotListDTO.java index c6d1a742..bfe49695 100644 --- a/zsw-bxg/src/main/java/co/yixiang/utils/HotListDTO.java +++ b/zsw-bxg/src/main/java/co/yixiang/utils/HotListDTO.java @@ -16,6 +16,8 @@ public class HotListDTO implements Serializable { @TableId /** 榜单列表ID */ private Integer id; + /** 榜单展示图片 */ + private String listImage; /** 榜单名称 */ private String listName;