package com.caimei.www.controller; import com.caimei.www.mapper.ProductDao; import com.caimei.www.pojo.JsonModel; import com.caimei.www.pojo.classify.Bigtype; import com.caimei.www.pojo.classify.SmallType; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import java.util.List; /** * Description * * @author : plf * @date : 2020/12/23 */ @Controller @RequestMapping("classification") public class ClassificationController extends BaseController { @Resource private ProductDao productDao; @GetMapping("/select.html") public String selectUp() { return "help/select"; } @GetMapping("bigTypeData") @ResponseBody public JsonModel bigTypeData(){ List bigtypeList = productDao.findBigtype(); bigtypeList.forEach((bigtype)->{ List smallTypes = productDao.findSmalltype(); bigtype.setSmallTypes(smallTypes); }); return JsonModel.success(bigtypeList); } }