首页接口完善
This commit is contained in:
parent
e0b63e116d
commit
6ff6d4c92f
@ -59,4 +59,22 @@ public class HomeController {
|
||||
List<CmsSubject> subjectList = homeService.getSubjectList(cateId,pageSize,pageNum);
|
||||
return CommonResult.success(subjectList);
|
||||
}
|
||||
|
||||
@ApiOperation("分页获取人气推荐商品")
|
||||
@RequestMapping(value = "/hotProductList", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public CommonResult<List<PmsProduct>> hotProductList(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(value = "pageSize", defaultValue = "6") Integer pageSize) {
|
||||
List<PmsProduct> productList = homeService.hotProductList(pageNum,pageSize);
|
||||
return CommonResult.success(productList);
|
||||
}
|
||||
|
||||
@ApiOperation("分页获取新品推荐商品")
|
||||
@RequestMapping(value = "/newProductList", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public CommonResult<List<PmsProduct>> newProductList(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(value = "pageSize", defaultValue = "6") Integer pageSize) {
|
||||
List<PmsProduct> productList = homeService.newProductList(pageNum,pageSize);
|
||||
return CommonResult.success(productList);
|
||||
}
|
||||
}
|
||||
|
@ -34,4 +34,14 @@ public interface HomeService {
|
||||
* @param cateId 专题分类id
|
||||
*/
|
||||
List<CmsSubject> getSubjectList(Long cateId, Integer pageSize, Integer pageNum);
|
||||
|
||||
/**
|
||||
* 分页获取人气推荐商品
|
||||
*/
|
||||
List<PmsProduct> hotProductList(Integer pageNum, Integer pageSize);
|
||||
|
||||
/**
|
||||
* 分页获取新品推荐商品
|
||||
*/
|
||||
List<PmsProduct> newProductList(Integer pageNum, Integer pageSize);
|
||||
}
|
||||
|
@ -88,6 +88,18 @@ public class HomeServiceImpl implements HomeService {
|
||||
return subjectMapper.selectByExample(example);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PmsProduct> hotProductList(Integer pageNum, Integer pageSize) {
|
||||
int offset = pageSize * (pageNum - 1);
|
||||
return homeDao.getHotProductList(offset, pageSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PmsProduct> newProductList(Integer pageNum, Integer pageSize) {
|
||||
int offset = pageSize * (pageNum - 1);
|
||||
return homeDao.getNewProductList(offset, pageSize);
|
||||
}
|
||||
|
||||
private HomeFlashPromotion getHomeFlashPromotion() {
|
||||
HomeFlashPromotion homeFlashPromotion = new HomeFlashPromotion();
|
||||
//获取当前秒杀活动
|
||||
|
Loading…
x
Reference in New Issue
Block a user