@@ -0,0 +1,1974 @@
+package com.lance.querydsl.web;%0A%0Aimport java.util.HashMap;%0Aimport java.util.List;%0Aimport java.util.Map;%0A%0Aimport javax.servlet.http.HttpServletRequest;%0A%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.stereotype.Controller;%0Aimport org.springframework.web.bind.annotation.PathVariable;%0Aimport org.springframework.web.bind.annotation.RequestMapping;%0Aimport org.springframework.web.bind.annotation.RequestMethod;%0Aimport org.springframework.web.bind.annotation.ResponseBody;%0A%0Aimport com.alibaba.fastjson.JSON;%0Aimport com.lance.querydsl.entity.CityEntity;%0Aimport com.lance.querydsl.json.ResultInfo;%0Aimport com.lance.querydsl.service.CityService;%0A%0A@Controller%0Apublic class IndexController %7B%0A%09@Autowired%0A%09private CityService cityService;%0A%0A%09@RequestMapping(value=%7B%22%22,%22/%22,%22index%22%7D, method=RequestMethod.GET)%0A%09public String index() %7B%0A%09%09return %22index.jsp%22;%0A%09%7D%0A%09%0A%09//List%0A%09@ResponseBody%0A%09@RequestMapping(value=%22list%22, method=RequestMethod.POST)%0A%09public String list(String hotelName) %7B%0A%09%09Map%3CString, Object%3E map = new HashMap%3C%3E();%0A%09%09List%3CCityEntity%3E infos = cityService.findAll(hotelName);%0A%09%09map.put(%22rows%22, infos);%0A%09%09map.put(%22total%22, infos.size());%0A%09%09return JSON.toJSONString(map); %0A%09%7D%0A%09%0A%09//Save%0A%09@ResponseBody%0A%09@RequestMapping(value=%22save%22, method=RequestMethod.POST, produces = %22application/json; charset=UTF-8%22)%0A%09public String save(CityEntity city, HttpServletRequest request) %7B%0A%09%09try %7B%0A%09%09%09cityService.save(city);%0A%09%09%7D catch (Exception e) %7B%0A%09%09%09e.printStackTrace();%0A%09%09%09return ResultInfo.error(-1, e.getMessage());%0A%09%09%7D%0A%09%09return ResultInfo.success();%0A%09%7D%0A%09%0A%09/**%0A%09 * Delete%0A%09 * @param id%0A%09 * @return%0A%09 */%0A%09@ResponseBody%0A%09@RequestMapping(value=%22delete/%7Bid%7D%22, method=RequestMethod.GET, produces = %22application/json; charset=UTF-8%22)%0A%09public String delete(@PathVariable int id) %7B%0A%09%09try %7B%0A%09%09%09cityService.delete(id);%0A%09%09%7D catch (Exception e) %7B%0A%09%09%09e.printStackTrace();%0A%09%09%09return ResultInfo.error(-1, e.getMessage());%0A%09%09%7D%0A%09%09return ResultInfo.success();%0A%09%7D%0A%7D%0A

add index controller