/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
- package com.fasheng.web.location;
- import java.util.List;
- import org.springframework.stereotype.Controller;
- import org.springframework.ui.ModelMap;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestParam;
- import org.springframework.web.bind.annotation.ResponseBody;
- import com.alibaba.fastjson.JSON;
- import com.fasheng.service.dto.ProvinceDTO;
- import com.fasheng.service.service.DataServiceLocator;
- import com.fasheng.service.service.interfaces.ProvinceService;
- @Controller
- @RequestMapping("/location")
- public class LocationController {
- @RequestMapping("/test1")
- @ResponseBody
- public String testRest(ModelMap model){
- ProvinceService provinceService = DataServiceLocator.getProvinceService();
- List<ProvinceDTO> provinceList = provinceService.getAllProvinces();
- return JSON.toJSONString(provinceList);
- }
-
- @RequestMapping("/test2")
- @ResponseBody
- public String testRest(@RequestParam("code") String code, ModelMap model){
- return "code=" + code;
- }
- }