ClassificationController.java 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package com.caimei.www.controller;
  2. import com.caimei.www.mapper.ProductDao;
  3. import com.caimei.www.pojo.JsonModel;
  4. import com.caimei.www.pojo.classify.Bigtype;
  5. import com.caimei.www.pojo.classify.SmallType;
  6. import org.springframework.stereotype.Controller;
  7. import org.springframework.web.bind.annotation.GetMapping;
  8. import org.springframework.web.bind.annotation.RequestMapping;
  9. import org.springframework.web.bind.annotation.ResponseBody;
  10. import javax.annotation.Resource;
  11. import java.util.List;
  12. /**
  13. * Description
  14. *
  15. * @author : plf
  16. * @date : 2020/12/23
  17. */
  18. @Controller
  19. @RequestMapping("classification")
  20. public class ClassificationController extends BaseController {
  21. @Resource
  22. private ProductDao productDao;
  23. @GetMapping("/select.html")
  24. public String selectUp() {
  25. return "help/select";
  26. }
  27. @GetMapping("bigTypeData")
  28. @ResponseBody
  29. public JsonModel bigTypeData(){
  30. List<Bigtype> bigtypeList = productDao.findBigtype();
  31. bigtypeList.forEach((bigtype)->{
  32. List<SmallType> smallTypes = productDao.findSmalltype();
  33. bigtype.setSmallTypes(smallTypes);
  34. });
  35. return JsonModel.success(bigtypeList);
  36. }
  37. }