PageRenderTime 52ms CodeModel.GetById 27ms RepoModel.GetById 0ms app.codeStats 0ms

/web/src/main/java/com/fasheng/web/location/LocationController.java

https://github.com/dawnsait/holywar
Java | 32 lines | 27 code | 5 blank | 0 comment | 0 complexity | 9733c12accf5f945d89bc961f684b15c MD5 | raw file
  1. package com.fasheng.web.location;
  2. import java.util.List;
  3. import org.springframework.stereotype.Controller;
  4. import org.springframework.ui.ModelMap;
  5. import org.springframework.web.bind.annotation.RequestMapping;
  6. import org.springframework.web.bind.annotation.RequestParam;
  7. import org.springframework.web.bind.annotation.ResponseBody;
  8. import com.alibaba.fastjson.JSON;
  9. import com.fasheng.service.dto.ProvinceDTO;
  10. import com.fasheng.service.service.DataServiceLocator;
  11. import com.fasheng.service.service.interfaces.ProvinceService;
  12. @Controller
  13. @RequestMapping("/location")
  14. public class LocationController {
  15. @RequestMapping("/test1")
  16. @ResponseBody
  17. public String testRest(ModelMap model){
  18. ProvinceService provinceService = DataServiceLocator.getProvinceService();
  19. List<ProvinceDTO> provinceList = provinceService.getAllProvinces();
  20. return JSON.toJSONString(provinceList);
  21. }
  22. @RequestMapping("/test2")
  23. @ResponseBody
  24. public String testRest(@RequestParam("code") String code, ModelMap model){
  25. return "code=" + code;
  26. }
  27. }