HomeController.java 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. package com.caimei.www.controller.unlimited;
  2. import com.caimei.www.controller.BaseController;
  3. import com.caimei.www.pojo.page.ImageLink;
  4. import com.caimei.www.pojo.JsonModel;
  5. import com.caimei.www.pojo.page.PageFloor;
  6. import com.caimei.www.pojo.page.ProductList;
  7. import com.caimei.www.service.page.HomeService;
  8. import org.springframework.beans.factory.annotation.Autowired;
  9. import org.springframework.stereotype.Controller;
  10. import org.springframework.ui.Model;
  11. import org.springframework.web.bind.annotation.GetMapping;
  12. import org.springframework.web.bind.annotation.ResponseBody;
  13. import java.util.List;
  14. /**
  15. * Description(接口已搬至spi)
  16. *
  17. * @author : Charles
  18. * @date : 2020/6/15
  19. */
  20. @Controller
  21. public class HomeController extends BaseController {
  22. private static final String HOME_PATH = "index";
  23. /** 错误页面 */
  24. private static final String ERROR_PATH = "error/404";
  25. private static final String SEARCH_CHILDREN = "error/search_children";
  26. private HomeService homeService;
  27. @Autowired
  28. public void setHomeService(HomeService homeService) {
  29. this.homeService = homeService;
  30. }
  31. /**
  32. * 首页页面路径
  33. * @param model
  34. * @return
  35. */
  36. @GetMapping("/index.html")
  37. public String home(final Model model) {
  38. model.addAttribute("msg", "首页");
  39. return HOME_PATH;
  40. }
  41. /**
  42. * 404
  43. */
  44. @GetMapping("/404.html")
  45. public String errorPage(final Model model) {
  46. model.addAttribute("msg", "404页面");
  47. return ERROR_PATH;
  48. }
  49. /**
  50. * 腾讯公益
  51. */
  52. @GetMapping("/search_children.html")
  53. public String searchChildren(final Model model) {
  54. model.addAttribute("msg", "腾讯公益");
  55. return SEARCH_CHILDREN;
  56. }
  57. /**
  58. * 首页轮播图列表
  59. * @return
  60. */
  61. @GetMapping("/home/banner")
  62. @ResponseBody
  63. public JsonModel<List<ImageLink>> getHomeBanners() {
  64. return homeService.getHomeBanners();
  65. }
  66. /**
  67. * 首页推荐专区
  68. * @return
  69. */
  70. /*
  71. @GetMapping("/home/recommend")
  72. @ResponseBody
  73. public JsonModel<List<ProductList>> getRecommendProducts() {
  74. return homeService.getRecommendProducts();
  75. }
  76. */
  77. /**
  78. * 首页楼层专题数据
  79. * @return
  80. */
  81. @GetMapping("/home/floor")
  82. @ResponseBody
  83. public JsonModel<List<PageFloor>> getHomePageFloorData() {
  84. return homeService.getHomePageFloorData();
  85. }
  86. /**
  87. * 首页左侧广告图
  88. * @return
  89. */
  90. @GetMapping("/home/advertising")
  91. @ResponseBody
  92. public JsonModel<List<ImageLink>> getAdvertising() {
  93. return homeService.getAdvertising();
  94. }
  95. }