package com.caimei.www.controller; import com.caimei.module.base.entity.bo.JsonModel; import com.caimei.www.pojo.HomeFloor; import com.caimei.www.service.HomeService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ResponseBody; import java.util.List; /** * Description * * @author : Charles * @date : 2020/6/15 */ @Controller public class HomeController extends BaseController { private static final String HOME_PATH = "index"; private HomeService homeService; @Autowired public void setHomeService(HomeService homeService) { this.homeService = homeService; } /** * 首页页面路径 * @param model * @return */ @GetMapping("/index.html") public String home(final Model model) { model.addAttribute("msg", "首页"); List pageFloors = homeService.getHomePageFloor(); model.addAttribute("pageFloors", pageFloors); return HOME_PATH; } /** * 首页轮播图列表 * @return */ @GetMapping("/home/banner") @ResponseBody public JsonModel getHomeBanners() { return homeService.getHomeBanners(); } /** * 首页左侧广告图 * @return */ @GetMapping("/home/advertising") @ResponseBody public JsonModel getAdvertising() { return homeService.getAdvertising(); } /** * 首页推荐专区 * @return */ @GetMapping("/home/recommend") @ResponseBody public JsonModel getRecommendProducts() { return homeService.getRecommendProducts(); } /** * 首页专题数据 * @return */ @GetMapping("/home/topic") @ResponseBody public JsonModel getHomeTopicData() { return homeService.getHomeTopicData(); } /** * 顶部购物车数据 * @return */ @GetMapping("/header/cart") @ResponseBody public JsonModel getHeadCarts(Integer userId) { return homeService.getHeaderCart(userId); } }