时间:2021-07-01 10:21:17 帮助过:33人阅读
serviceImpl层 @Override public List<ChuHuoDan> findAllByCountName(String moHuName, Integer pageNum, Integer pageSize) { moHuName="‘%"+moHuName+"%‘"; System.out.println (moHuName); map.put ( "moHuName",moHuName ); map.put ( "pageNum" ,pageNum); map.put ( "pageSize",pageSize ); return chuHuoDanMapper.findAllByCountName(map); }
Controller层 @RequestMapping("findChuHuoDanByCountName") public String findChuHuoDanByCountName(Model model, String moHuName, @RequestParam(value = "pageNum" ,defaultValue = "1") Integer pageNum, @RequestParam(value = "pageSize",defaultValue ="5")Integer pageSize){ if (pageNum==0){ pageNum=1; } count = chuHuoDanService.findCount (); limitPage = (int)Math.ceil ( count / pageSize ); allCH = chuHuoDanService.findAllByCountName (moHuName,(pageNum - 1) * pageSize, pageSize ); model.addAttribute ( "moHuName",moHuName ); model.addAttribute ( "list",allCH); model.addAttribute ("pageNum",pageNum); model.addAttribute ("firstPage",1); model.addAttribute ("lastPage",limitPage); return "show.jsp"; }
map在Sql中的传参 模糊查询limit分页
标签:int log app ret span sys put add findall